Skip to Content

User exit/BADi PO creation

I am looking for a user exit where I can update a Z table with PO line items after a PO is created using Me21/Me21n. (After commit ) . Please let me know if you can help.

Thanks in advance,

shareen

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2007 at 09:00 PM

    Hi Shareen,

    Before you save the PO, Check the Program name of that screen in Status bar.

    Take that Program name, and find the Package of that program.

    Take that Package name and goto SE84 Transaction.

    Expand Enhancements in the left panel, double click on enhancements.

    Provide the Package Name and execute it will show you all the available userexits.

    Take out the once which will trigger at Save event.

    Write the code into that and get the item details into your internal table.

    Update data to ZTable from the internal table.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 29, 2007 at 09:08 PM

    If it is sufficient to have an exit for ME21N only, then I'd suggest using BAdI ME_PROCESS_PO_CUST.

    If it must be working with ME21 then the SMOD enhancement MM06E005 (and specifically the function module EXIT_SAPMM06E_013) is probably what you need. This will work with both ME21 and ME21N if I'm not mistaken.

    Add a comment
    10|10000 characters needed characters exceeded

    • Guys..finally got this working.

      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 LIKE LINE OF L_POITEMT .
        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 .
      
      *  CALL METHOD IM_HEADER->GET_ITEMS->GET_DATA
      *    RECEIVING
      *      RE_ITEMS = L_POITEMT.
      *
      *
      *  CALL METHOD L_POITEMT->GET_DATA
      *    RECEIVING
      *      RE_DATA = L_POITEM_TAB .
      *      .
      
          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' AND ( L_LIFNR EQ '6001943' OR
                                              L_LIFNR EQ '6001887' OR
                                              L_LIFNR EQ '6002706' ).
      
              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 .
      

  • Posted on Nov 29, 2007 at 10:31 PM

    Thanks for useful comments from everyone.This issue is solved now

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.