Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
Anonymous

Function module/BAPI/Class for Cancel pick in SAP EWM

Related Questions

Leave an answer

Leave an answer

1 Him Answer

  1. Try following code, It will work

    FUNCTION zewm_f_cancel_pick.
    *”———————————————————————-
    *”*”Local Interface:
    *” IMPORTING
    *” VALUE(IV_LGNUM) TYPE /SCWM/LGNUM
    *” VALUE(IT_DOCID) TYPE /SCWM/DLV_DOCID_ITEM_TAB
    *” VALUE(IV_QNAME) TYPE TRFCQNAM
    *”———————————————————————-
    WAIT UP TO 2 SECONDS.
    DATA: lo_hu_mon TYPE REF TO zcl_ewm_cancpick_mon.
    DATA: lv_noexecute TYPE sy-input.
    DATA: lt_ret TYPE bapirettab.
    DATA: lv_msg TYPE msgtx.

    *–Append message for queue start
    MESSAGE s171 INTO lv_msg.
    PERFORM add_message TABLES lt_ret
    USING lv_msg.

    *–Get HU List
    TRY.
    DATA(lo_dlv) = /scwm/cl_dlv_management_prd=>get_instance( ).
    DATA(ls_read_options) = VALUE /scwm/dlv_query_contr_str( data_retrival_only = abap_true ). “lock_result = abap_true
    DATA(ls_include) = VALUE /scwm/dlv_query_incl_str_prd( head_status = abap_true ).
    lo_dlv->query(
    EXPORTING
    iv_doccat = /scdl/if_dl_c=>sc_doccat_out_prd
    it_docid = it_docid
    is_read_options = ls_read_options
    is_include_data = ls_include
    IMPORTING
    et_headers = DATA(lt_headers)
    et_hu_headers = DATA(lt_hu_headers)
    et_hu_items = DATA(lt_hu_items)
    eo_message = DATA(lo_message) ).

    CATCH /scdl/cx_delivery INTO DATA(lx_dlv).

    ENDTRY.

    *–Cancelpick Delivery
    lo_hu_mon = zcl_ewm_cancpick_mon=>get_instance( ).

    lo_hu_mon->/scwm/if_mon_hu~cancel_hu_pick(
    EXPORTING
    iv_lgnum = iv_lgnum
    it_data = lt_hu_headers
    ).

    DATA(lt_return) = lo_hu_mon->get_message( ).

    *–Append message for queue ending
    MESSAGE s172 INTO lv_msg.
    PERFORM add_message TABLES lt_ret
    USING lv_msg.

    *–form return table for the queue
    IF lt_ret[] IS NOT INITIAL.
    APPEND LINES OF lt_ret TO lt_return.
    ENDIF.

    IF VALUE #( lt_return[ type = ‘E’ ]-type OPTIONAL ) = ‘E’.
    /spe/cl_qrfc_services=>end_queue_processing(
    EXPORTING
    it_message = lt_return ” Table with BAPI Return Information
    ).
    ENDIF.
    /spe/cl_qrfc_services=>end_queue_processing(
    EXPORTING
    it_message = lt_return ” Table with BAPI Return Information
    ).

    *create Queue FM for update
    CALL FUNCTION ‘TRFC_SET_QIN_PROPERTIES’
    EXPORTING
    qin_name = iv_qname
    no_execute = lv_noexecute
    EXCEPTIONS
    invalid_queue_name = 1
    OTHERS = 2.

    CALL FUNCTION ‘ZEWM_F_CANCEL_PICK_MOVE’
    IN BACKGROUND TASK AS SEPARATE UNIT
    DESTINATION ‘NONE’
    EXPORTING
    iv_lgnum = iv_lgnum
    it_hu_hdr = lt_hu_headers
    it_hu_itm = lt_hu_items.

    COMMIT WORK AND WAIT.

    /spe/cl_qrfc_services=>end_queue_processing(
    EXPORTING
    it_message = lt_return ” Table with BAPI Return Information
    ).
    ENDFUNCTION.