Skip to Content

EWM scrapping reversal - /SCWM/ADGI

Hi All,

My question is regarding the scrapping functionality in t-code /SCWM/ADGI.

Scrapping works fine - we have the new 'reason for movement' config in place so that the posting back to ERP is complete.

But how does SAP expect any reversals to be processed?

If we set the GI process to 'CANC' then we can enter the previously created material document but the reason for movement is NOT mandatory therefore the posting back to ERP fails.

If we set the GI process to 'SCRP', then when we process a partial qty we can enter a minus (eg -10) and this in effect does do a reversal. But this only works if there is some remaining stock left in the bin.

If a user scrapped off an entire bin qty in error, how can they undo this??

I've researched this thoroughly, I can't find any guide.

Any hints or tips appreciated.

Regards

Guy

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 17 at 09:00 AM

    Hi Heather,

    "If we set the GI process to 'CANC' then we can enter the previously created material document but the reason for movement is NOT mandatory therefore the posting back to ERP fails."

    Yes "reason for movement" is not mandatory for 'CANC' option, even if you write any reason for movement it won't effect on warehouse task document. However I have made enhancement to fix this issue.

    Sample Codes ;

    Include "/SCWM/RGI_SCRAPF01" , Begin of "cancel_document" form ;

    ENHANCEMENT 1  ZEWM_ENH_RGI_SCRAPF01.    "active version
    
      DATA: lt_ordim_c_temp TYPE /scwm/tt_ordim_c,
    
            lt_guid_coll_group_temp TYPE /lime/t_guid_coll_group,
    
            lt_coll_w2im_temp       TYPE /lime/t_coll_w2im.
    
      DATA: BEGIN OF ls_cancel_reason,
    
            old_tanum   TYPE /SCWM/TANUM,
    
            reason  TYPE /SCWM/DE_REASON,
    
            END OF ls_cancel_reason.
    
        FIELD-SYMBOLS:
    
          <ls_coll_w2im_temp> TYPE /lime/s_coll_w2im,
    
          <ls_ordim_c_temp>   TYPE /scwm/ordim_c.
    
    
    
      "CANCELLATION OF MATERIAL DOCUMENT
    
      "REASON OF MOVEMENT IMPROVEMENT
    
    
    
        CALL FUNCTION '/SCWM/TO_READ_SINGLE'
    
          EXPORTING
    
            iv_lgnum     = p_lgnum
    
            iv_tanum     = p_tanum
    
          IMPORTING
    
            et_ordim_c   = lt_ordim_c_temp
    
          EXCEPTIONS
    
            wrong_input  = 1
    
            not_found    = 2
    
            foreign_lock = 3
    
            error        = 4
    
            OTHERS       = 5.
    
    
    
        LOOP AT lt_ordim_c_temp ASSIGNING <ls_ordim_c_temp>.
    
    *   Fill guid_coll_group for LIME collection
    
          APPEND <ls_ordim_c_temp>-guid_to TO lt_guid_coll_group_temp.
    
        ENDLOOP.
    
    
    
    *   Read LIME collection
    
        CALL FUNCTION '/LIME/COLL_MONITOR'
    
          EXPORTING
    
            i_coll_type        = 'W2IM'
    
            it_guid_coll_group = lt_guid_coll_group_temp
    
          IMPORTING
    
            et_coll_w2im       = lt_coll_w2im_temp.
    
    
    
        READ TABLE lt_coll_w2im_temp INDEX 1 ASSIGNING <ls_coll_w2im_temp>.
    
        IF sy-subrc = 0.
    
          IF <ls_coll_w2im_temp>-reason = 'SCRP'.
    
    
    
              clear: ls_cancel_reason.
    
              FREE MEMORY ID 'FROM_ZEWM_ENH_RGI_SCRAPF01_TO_ZEWM_ENH_GM_POST'.
    
    
    
              READ TABLE lt_ordim_c_temp ASSIGNING <ls_ordim_c_temp>
    
                                         with key tanum = <ls_coll_w2im_temp>-tanum
    
                                                  tapos = <ls_coll_w2im_temp>-tapos.
    
              IF sy-subrc = 0 and <ls_ordim_c_temp>-reason is NOT INITIAL.
    
                IF P_REASON is NOT INITIAL.
    
                  MESSAGE ID 'ZEWM' TYPE 'I' NUMBER 999
    
                        WITH 'Do not fill -Reason for Movement- field, because it already exists'
    
                        DISPLAY LIKE 'E'.
    
                  RETURN.
    
                ENDIF.
    
                P_REASON = <ls_ordim_c_temp>-reason.
    
                "hazır <ls_ordim_c_temp>-reason ı yaz
    
                ls_cancel_reason-old_tanum  = <ls_ordim_c_temp>-tanum.
    
                ls_cancel_reason-reason = <ls_ordim_c_temp>-reason.
    
    
    
                EXPORT ls_cancel_reason TO MEMORY ID 'FROM_ZEWM_ENH_RGI_SCRAPF01_TO_ZEWM_ENH_GM_POST'.
    
              ELSEIF sy-subrc = 0 and P_REASON is NOT INITIAL.
    
                "hazır P_REASON ı yaz
    
                ls_cancel_reason-old_tanum  = <ls_ordim_c_temp>-tanum.
    
                ls_cancel_reason-reason = P_REASON.
    
    
    
                EXPORT ls_cancel_reason TO MEMORY ID 'FROM_ZEWM_ENH_RGI_SCRAPF01_TO_ZEWM_ENH_GM_POST'.
    
              ELSE.
    
                  MESSAGE ID 'ZEWM' TYPE 'I' NUMBER 999
    
                        WITH 'Fill -Reason for Movement- field' DISPLAY LIKE 'E'.
    
                  RETURN.
    
              ENDIF.
    
          ENDIF.
    
        ENDIF.
    
    ENDENHANCEMENT.

    FM "/SCWM/GM_POST" , Begin of "gm_post" form ;

    ENHANCEMENT 1  ZEWM_ENH_GM_POST.    "active version
    
      DATA: BEGIN OF ls_cancel_reason,
    
            old_tanum   TYPE /SCWM/TANUM,
    
            reason  TYPE /SCWM/DE_REASON,
    
            END OF ls_cancel_reason.
    
    
    
      IMPORT ls_cancel_reason FROM
    
      MEMORY ID 'FROM_ZEWM_ENH_RGI_SCRAPF01_TO_ZEWM_ENH_GM_POST'.
    
    
    
      IF ls_cancel_reason is NOT INITIAL.
    
        LOOP AT gt_ordim_c ASSIGNING FIELD-SYMBOL(<fs_ordim_c_tmp>).
    
          IF ls_cancel_reason-old_tanum = <fs_ordim_c_tmp>-orig_to.
    
            <fs_ordim_c_tmp>-reason = ls_cancel_reason-reason.
    
          ENDIF.
    
        ENDLOOP.
    
      ENDIF.
    
    
    
      FREE MEMORY ID 'FROM_ZEWM_ENH_RGI_SCRAPF01_TO_ZEWM_ENH_GM_POST'.
    
      CLEAR: ls_cancel_reason.
    
    
    
    ENDENHANCEMENT.

    "If a user scrapped off an entire bin qty in error, how can they undo this??"

    I have tried this scenario but it has worked.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded