- The document declares local variables and constants used to get packaging specifications for a product. It retrieves the material ID and packspec keys for the given material number, then reads the packspec details to get the quantities defined at the layer and pallet levels. Any errors encountered are handled by messages.
- The document declares local variables and constants used to get packaging specifications for a product. It retrieves the material ID and packspec keys for the given material number, then reads the packspec details to get the quantities defined at the layer and pallet levels. Any errors encountered are handled by messages.
- The document declares local variables and constants used to get packaging specifications for a product. It retrieves the material ID and packspec keys for the given material number, then reads the packspec details to get the quantities defined at the layer and pallet levels. Any errors encountered are handled by messages.
- The document declares local variables and constants used to get packaging specifications for a product. It retrieves the material ID and packspec keys for the given material number, then reads the packspec details to get the quantities defined at the layer and pallet levels. Any errors encountered are handled by messages.
Download as TXT, PDF, TXT or read online from Scribd
Download as txt, pdf, or txt
You are on page 1of 3
*-> Local Data Declarations
DATA: ls_content_query TYPE /scwm/s_ps_content_query,
lt_ps_keys TYPE /scwm/tt_ps_header_key, lv_severity TYPE bapi_mtype, lv_matid_16 TYPE /scwm/de_matid, lt_matid_tab TYPE /scmb/mdl_matid_tab, lt_object TYPE /scwm/tt_ps_object, lv_matnr TYPE /scwm/de_matnr, lt_return TYPE bapirettab.
* Define Local Constants
CONSTANTS : lc_layer TYPE /scwm/de_psleveltype VALUE 'LAYR', lc_palet TYPE /scwm/de_psleveltype VALUE 'PALT', lc_e TYPE bapi_mtype VALUE 'E', lc_x TYPE bapi_mtype VALUE 'X', lc_a TYPE bapi_mtype VALUE 'A'.
SELECT SINGLE matid "Secondary Index fetch FROM /sapapo/matkey INTO @DATA(lv_matid_22) WHERE matnr = @lv_matnr. IF sy-subrc NE 0. MESSAGE e011(zgmc_ewm_msg). ENDIF. * Converting matid from 22 to 16 CALL FUNCTION '/SCMB/MDL_GUID_CONVERT' EXPORTING iv_guid22 = lv_matid_22 IMPORTING ev_guid16 = lv_matid_16.
APPEND INITIAL LINE TO lt_matid_tab ASSIGNING FIELD-SYMBOL(<lfs_matid_tab>).
IF <lfs_matid_tab> IS ASSIGNED. <lfs_matid_tab>-matid = lv_matid_16. ls_content_query-matid = lt_matid_tab.
lt_ps_keys IS INITIAL. MESSAGE e012(zgmc_ewm_msg). ENDIF. CLEAR: lv_severity, lt_return. IF lt_ps_keys IS NOT INITIAL. *-> Get Pack. Spec. details CALL FUNCTION '/SCWM/API_PACKSPEC_READ' EXPORTING it_ps_id = lt_ps_keys IMPORTING et_object = lt_object ev_severity = lv_severity et_return = lt_return.
ENDIF.
IF lv_severity CA wmegc_severity_eax AND
lt_object IS INITIAL. LOOP AT lt_return ASSIGNING FIELD-SYMBOL(<lfs_return>) WHERE type = lc_e OR type = lc_x OR type = lc_a. MESSAGE e013(zgmc_ewm_msg). EXIT. ENDLOOP.
UNASSIGN : <lfs_return>. ENDIF.
CLEAR: lv_severity, lt_return.
* Reading the first entry to find out the quantity in layer
* and pallet IF lt_object IS NOT INITIAL. et_object = lt_object. ENDIF. READ TABLE lt_object ASSIGNING FIELD-SYMBOL(<lfs_object>) INDEX 1. IF <lfs_object> IS ASSIGNED. et_level = <lfs_object>-levels.
READ TABLE <lfs_object>-levels ASSIGNING FIELD-SYMBOL(<lfs_level>) WITH KEY
level_type = lc_layer. IF <lfs_level> IS ASSIGNED. ev_cs_layer_quan = <lfs_level>-total_quan. ENDIF. READ TABLE <lfs_object>-levels ASSIGNING <lfs_level> WITH KEY level_type = lc_palet. IF <lfs_level> IS ASSIGNED. ev_cs_pallet_quan = <lfs_level>-total_quan. ENDIF.