Skip to Content
Author's profile photo Danish Nadeem

PACKSPEC quantity of product in EWM

The below code provides the packspec quantity of a material in EWM.

data:

   lv_matnr            type /scwm/de_rf_matnr,

   lv_matnrd           type /scwm/s_rf_unlo_prodrfprod,

   it_matid            type /scmb/mdl_matid_tab,

   wa_matid            type line of /scmb/mdl_matid_tab,

   is_content_query    type /scwm/s_ps_content_query,

   et_packspec_content type /scwm/tt_packspec_nested,

   wa_packspec_content type line of /scwm/tt_packspec_nested,

   et_ps_keys          type /scwm/tt_ps_header_key,

   wa_ps_keys          type line of /scwm/tt_ps_header_key,

   ev_severity         type bapi_mtype,

   et_return           type bapirettab,

   cv_max_rows         type int4,

   iv_guid_ps          type /scwm/de_guid_ps,

   es_packspec_level   type /scwm/s_ps_level_int,

   it_levels           type /scwm/s_packspec_nestedlevels,

   wa_levels           type line of /scwm/s_packspec_nestedlevels,

   lv_packspec_qty     type p decimals 3.

*lv_matnr  = <material number>

call function ‘CONVERSION_EXIT_MDLPD_INPUT’

   exporting

     input  = lv_matnr

   importing

     output = lv_matnrd.

wa_matidmatid = lv_matnrd.

append wa_matid to it_matid.

clear wa_matid.

clear is_content_query.

clear et_packspec_content.

is_content_querymatid = it_matid.

call function ‘/SCWM/API_PACKSPEC_GETLIST’

   exporting

     is_content_query = is_content_query

   importing

     et_ps_keys       = et_ps_keys

     ev_severity      = ev_severity

     et_return        = et_return

   changing

     cv_max_rows      = cv_max_rows.

clear wa_ps_keys.

read table et_ps_keys into wa_ps_keys index 1.

clear iv_guid_ps.

iv_guid_ps = wa_ps_keysguid_ps.

clear et_packspec_content.

call function ‘/SCWM/PS_PACKSPEC_GET’

   exporting

     iv_guid_ps          = iv_guid_ps

   importing

     et_packspec_content = et_packspec_content

     es_packspec_level   = es_packspec_level

   exceptions

     error               = 1

     others              = 2.

if sysubrc <> 0.

* Implement suitable error handling here

endif.

clear wa_packspec_content.

read table et_packspec_content into wa_packspec_content index 1.

it_levels = wa_packspec_contentlevels.

clear wa_levels.

read table it_levels into wa_levels index 1.

lv_packspec_qty = wa_levelstrgqty.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Amol Chougule
      Amol Chougule

      Well done .. Appreciated