SCWM/EWM Enhancement to send HU unit of measure to ERP-Scale

You are here:
In standard SAP, EWM does not send the HU unit of measure to ERP-Scale. This can cause the “cannot update unit of measure” error when weighing handling units in SAP SCWM/EWM using ERP-Scale.
By implementing this enhancement, EWM includes the HU UoM in the request to ERP-Scale.
BAdI Definition/SCWM/EX_WRKC_UI_GET_WEIGHTDetermine the Weight of an HU With a Scale
Interface/SCWM/IF_EX_WRKC_UI_GET_WEIGHT
method /SCWM/IF_EX_WRKC_UI_GET_WEIGHT~GET_WEIGHT_FROM_SCALE.
************
  DATA: ls_weight TYPE /scwm/s_hu_scale,
        lt_weight TYPE TABLE OF /scwm/s_hu_scale,
        ls_msg_text(80) TYPE c,
        ls_huhdr_new TYPE /scwm/s_huhdr_int,
        ls_huhdr_old TYPE /scwm/s_huhdr_int,
        ls_scale TYPE /scwm/tscale,
        lv_skip TYPE xfeld.
*Step 1: get scale rfc-destination from Customizing:
  ls_weight-scale_name = is_workcenter-scale.
  SELECT SINGLE * FROM /scwm/scale INTO ls_scale
                  WHERE scale = ls_weight-scale_name.

  IF sy-subrc IS NOT INITIAL OR ls_scale-scale_rfc IS INITIAL.
    MESSAGE e042(/scwm/ui_packing)
            WITH ls_scale-scale ls_scale-scale_rfc.
  ENDIF.
* Step 2: get HU before it was weighed

  ls_huhdr_old = cs_hu_changed.
*================================================
* Send HU UOM to ERP-Scale
*-------------------------
* Pocket Programs 2014.
*================================================
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  move ls_huhdr_old-UNIT_GW to ls_weight-UNIT_GW.
*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
* Step 3: connect to scale
  APPEND ls_weight TO lt_weight.
  CALL FUNCTION '/SCWM/HU_WEIGHT_FROM_SCALE'
    DESTINATION ls_scale-scale_rfc
    TABLES
      et_weight             = lt_weight
    EXCEPTIONS
      communication_failure = 1  MESSAGE ls_msg_text
      system_failure        = 2  MESSAGE ls_msg_text.
  READ TABLE lt_weight INTO ls_weight INDEX 1.
  IF NOT sy-subrc IS INITIAL.
    CONCATENATE ls_scale-scale_rfc ls_msg_text
                   INTO ls_msg_text SEPARATED BY space.
    MESSAGE ls_msg_text TYPE 'E'.
  ENDIF.

  IF ls_weight-g_weight IS INITIAL.
    MESSAGE e043(/scwm/ui_packing).
  ENDIF.
  ls_huhdr_new = ls_huhdr_old.
* take weight as gross weight
  CATCH SYSTEM-EXCEPTIONS convt_no_number = 9 .
    cs_weight-quan = ls_huhdr_new-g_weight = ls_weight-g_weight.
    cs_weight-unit = ls_huhdr_new-unit_gw  = ls_weight-unit_gw.
  ENDCATCH.
  IF sy-subrc = 9.
    MESSAGE e043(/scwm/ui_packing).
  ENDIF.

  cs_hu_changed = ls_huhdr_new.
  cv_hu_changed = 'X'.

endmethod.

 

Was this article helpful?
Dislike 0
Views: 149
Still have questions? Create a support ticket