Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

User exit PO creation

former_member125661
Contributor
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Use the customer exit: MM06E005, FM: EXIT_SAPMM06E_012

(Check Customer-Specific Data Before Saving), hope this helps.

Rajeev

0 Kudos

Rajeev,

This is before saving. I need something after saving.

Thanks,

shareen

0 Kudos

Try with FM EXIT_SAPMM06E_017

Same enhancement

Thanks

Seshu

0 Kudos

Dear Seshu,

When EXIT_SAPMM06E_017 is triggered, the PO is still not created. Since I need the PO # to update the Ztable, I cannot use this exit.

0 Kudos

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_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 .

Thanks everyone for the useful suggestions and your time .

0 Kudos

hI shareen,

Can u pls send the whole code if u dont mind, because i got same requirement and iam not good enough in badis.

my mail id: Jagadeesh.bachu@gmail.com

Thanks &Regards

Jagadeeshwar.B

0 Kudos

The whole code is posted right above your message .