You need  the data of the warehouse order you are processing right now, for example the exception code entered on the screen (Pick Denial).

DATA l_data            TYPE abap_func_parmbind.

DATA lt_exc_tab      TYPE /scwm/tt_rf_exc.
DATA l_exc             TYPE /scwm/s_rf_exc.

DATA l_confirm         TYPE /scwm/s_rf_ordim_confirm.
DATA lo_confirm_ref    TYPE REF TO /scwm/s_rf_ordim_confirm.


lt_data    = /scwm/cl_rf_bll_srvc=>get_data( ).

READ TABLE lt_data INTO l_data WITH KEY name = ‘ORDIM_CONFIRM’.

     lo_confirm_ref ?= l_datavalue.
     l_confirm = lo_confirm_ref->*.

     lt_exc_tab[] = l_confirmexc_tab[].
     LOOP AT lt_exc_tab INTO l_exc
       WHERE iprcode = ‘BIDP’. * It’s a partial Pick Denial

     ENDLOOP.


…..

CALL METHOD /scwm/cl_wm_packing=>get_instance
     IMPORTING
       es_hu_main  = l_hu_main
       eo_instance = lo_instance.

DATA lo_hu TYPE /scwm/s_huhdr_int.
     CREATE OBJECT l_obj_hu.
     DATA lt_ini_huhdr TYPE /scwm/tt_huhdr_int.
     CALL METHOD l_obj_hu->init_pack
       EXPORTING
         iv_badi_appl = lo_instance->gv_badi_appl
         iv_lgnum     = is_mat_lgnumlgnum
       IMPORTING
         et_huhdr     = lt_ini_huhdr
       EXCEPTIONS
         error        = 1
         OTHERS       = 2.
     IF sysubrc <> 0.
       EXIT.
     ENDIF.

    lp_mat =pmat_guid. * Packing Material

     ls_paramlgnum = is_mat_lgnumlgnum. * the warehouse number
     ls_paramappl = lo_instance->gv_badi_appl.
     ls_huhdr_createpmat_guid = lp_mat.* Packing Material

CALL METHOD l_obj_hu->/scwm/if_pack_bas~create_hu
       EXPORTING
         iv_pmat      = lp_mat
*       iv_huident   =
*       is_hu_create =
*       iv_nohuident =
         i_location   = ls_createvlpla
*       iv_loghu     =
       RECEIVING
         es_huhdr     = lo_hu
       EXCEPTIONS
         error        = 1
         OTHERS       = 2.
     IF sysubrc <> 0.
       EXIT.
     ENDIF.

     CALL METHOD l_obj_hu->/scwm/if_pack~save
       EXPORTING
         iv_commit = ‘X’
         iv_wait   = ‘X’
       EXCEPTIONS
         error     = 1
         OTHERS    = 2.
     IF sysubrc <> 0.
       EXIT.
     ENDIF.

.

* For reading delivery data using QUERY-method: prerequisite: docid is available

DATA lt_docid   TYPE /scwm/dlv_docid_item_tab.
DATA l_docid    TYPE /scwm/dlv_docid_item_str.
DATA lt_items   TYPE /scwm/dlv_item_out_prd_tab.
DATA l_item     TYPE /scwm/dlv_item_out_prd_str.
DATA lt_headers TYPE /scwm/dlv_header_out_prd_tab.
DATA l_header   TYPE /scwm/dlv_header_out_prd_str.
DATA ls_include TYPE /scwm/dlv_query_incl_str_prd.

ls_includeitem_product_ext = ‘X’.
ls_includeHEAD_REFDOC = ‘X’.
ls_includeHEAD_PARTYLOC =
ls_includeITEM_REFDOC =
*ls_include-item_sapext =
ls_includeitem_partyloc =
ls_includeITEM_hierarchy =
ls_includeITEM_PARTYLOC = ‘X’.
gv_docid = is_load_listhd_gendocid.
gv_dlv = /scwm/cl_dlv_management_prd=>get_instance( ).
l_dociddocid = is_load_listhd_gendocid.
*  l_docid-itemid = is_item-itemid.
l_dociddoccat = is_load_listhd_gendoccat.
APPEND l_docid TO lt_docid.

* Get instance of the delivery.

TRY.
     CALL METHOD gv_dlv->query
       EXPORTING
         it_docid        = lt_docid
         is_include_data = ls_include
       IMPORTING
         et_items        = lt_items
         et_headers      = lt_headers.
   CATCH /scdl/cx_delivery .
     EXIT.
ENDTRY.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Zayidu A

    Hi Experts,

              I want to create HU and the created HU must be barcoded and must be printed using SMARTFORMS in EWM???

    Please Experts do replyy…..

    Thanks.

    (0) 

Leave a Reply