Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Found a BADI method that is triggered after a PO is created :

ME_PROCESS_PO_CUST~CLOSE .

This is what I did :

METHOD IF_EX_ME_PROCESS_PO_CUST~CLOSE.
 
  DATA: L_POITEMT TYPE PURCHASE_ORDER_ITEMS ." MMPR_UEKPO.
  DATA: L_LIFNR TYPE LIFNR .
  DATA: LV_ZSLOC_CUSTCLOTH TYPE ZSLOC_CUSTCLOTH .
  DATA: L_POITEM_TAB TYPE STANDARD TABLE OF EKPO .
  DATA: L_POITEM TYPE EKPO .
  DATA: LV_EBELN TYPE EBELN .
 
 
  CHECK SY-TCODE EQ 'ME21N' .
 
  IF SY-UCOMM EQ 'MESAVE' OR SY-UCOMM EQ 'OPT1'.
 
    GET PARAMETER ID 'BES' FIELD LV_EBELN .
 
    SELECT *  INTO TABLE L_POITEM_TAB FROM EKPO WHERE EBELN EQ LV_EBELN .
 
    LOOP AT L_POITEM_TAB INTO L_POITEM.
 
      SELECT SINGLE LIFNR INTO L_LIFNR FROM EKKO WHERE EBELN EQ L_POITEM-EBELN .
 
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
        EXPORTING
          INPUT  = L_LIFNR
        IMPORTING
          OUTPUT = L_LIFNR.
 
      IF L_POITEM-WERKS EQ '2010' .
 
        CLEAR LV_ZSLOC_CUSTCLOTH .
 
 
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = L_POITEM-EBELN
          IMPORTING
            OUTPUT = L_POITEM-EBELN.
 
        LV_ZSLOC_CUSTCLOTH-EBELN = L_POITEM-EBELN.
        LV_ZSLOC_CUSTCLOTH-EBELP = L_POITEM-EBELP.
        LV_ZSLOC_CUSTCLOTH-ERDAT = SY-DATUM.
        LV_ZSLOC_CUSTCLOTH-ERZET = SY-UZEIT .
        LV_ZSLOC_CUSTCLOTH-LGORT = L_POITEM-LGORT.
 
        SELECT SINGLE VBELN VBELP INTO (LV_ZSLOC_CUSTCLOTH-VBELN,LV_ZSLOC_CUSTCLOTH-VBELP) FROM EKKN WHERE EBELN EQ L_POITEM-EBELN AND
                                                                                                           EBELP EQ L_POITEM-EBELP.
        IF SY-SUBRC EQ 0.
 
          MODIFY ZSLOC_CUSTCLOTH FROM LV_ZSLOC_CUSTCLOTH .
 
        ENDIF.
 
      ENDIF.
 
    ENDLOOP.
 
  ENDIF .

  • No labels

1 Comment

  1. Former Member

    Hi,

    Good aveek.Thanks for sharing code with us.