Creating a new scale model class for LOG-PP-CFB

You are here:

The default scale model class provided by SAP for communication via an RFC connection does not pass the unit of measure (UOM) to ERP-Scale. This means that ERP-Scale is unable to convert the weight received from the sale to the UOM required by SAP and can lead to incorrect data being returned to SAP.

We advise creating a custom scale model class by copying the standard class CL_CFB_SCALE_MODEL_RFC_1.

Please review SAP Note 1532217 for information regarding creating a new scale model class.

Copy the class CL_CFB_SCALE_MODEL_RFC_1 to ZPP_CL_CFB_SCALE_MODEL_RFC_1 and make the following code changes:

  ENDIF.

  lv_unit = ls_scale-unit.

*---------------------------------------------------------------------*
* Send tare to scale system.

*=====================================================================
* Pocket Programs - ERP-Scale    May 2016
*---------------------------------------------------------------------
* With a tare of Zero, no UOM is sent to ERP-Scale. This can lead to
* inconsistent results as there is no check that the UOM returned
* from the scale matches the UOM expected by SAP
*---------------------------------------------------------------------
* Modify code to always send tare with UOM to ERP-Scale , even if
* tare is zero.
*=====================================================================
*  IF iv_tare > 0.
    CALL METHOD me->pack_tare
      EXPORTING
        iv_unit        = lv_unit
        iv_tare        = iv_tare
      IMPORTING
        ev_tare_packed = lv_data.

    CALL METHOD me->send_command(
      EXPORTING
        iv_funcname        = lv_funcname
        iv_command         = gc_command-send_tare
        iv_rfc_destination = lv_rfc_destination
        iv_device          = lv_device
        iv_data            = lv_data
      IMPORTING
        ev_retcode         = lv_retcode ).

    IF  lv_retcode <> '0'.
      ev_manual_mode = abap_true.
      EXIT.
    ENDIF.

*  ELSE.
**   Send a "clear tare" command.
*    CALL METHOD me->send_command(
*      EXPORTING
*        iv_funcname        = lv_funcname
*        iv_command         = gc_command-clear_tare
*        iv_rfc_destination = lv_rfc_destination
*        iv_device          = lv_device
*      IMPORTING
*        ev_retcode         = lv_retcode ).
*
*    IF  lv_retcode <> '0'.
*      ev_manual_mode = abap_true.
*      EXIT.
*    ENDIF.
*  ENDIF.

*---------------------------------------------------------------------*
* Read stable weight

 

Was this article helpful?
Dislike 0
Views: 2