Skip to Content

Find reference to source Purchase Order when creating Purchase Order by Adopt (Copy) function

I would like to reference the source Purchase Order in a new Purchase Order created by adoption.

Sequence of steps:

1) In ME21N, I activate [Document Overview On]

2) run the selection for Purchase Orders.

3) Select the line items I want in the new PO and press the [Adopt] button.

4) A new PO is created.

I would like to make a reference in this new document to the source document. I will probably use a BADI at header or item level in the PO.

In this scenario, how may I find a reference to the "source document" in ABAP code?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 07, 2017 at 09:12 PM

    if you implement the cusomer-exit EXIT_SAPMM06E_012 you will have the reference document in parameter I_REKKO.

    JNN

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 07, 2017 at 11:16 PM

    Yes, Thank you. That is what I was looking for.

    The following code will get this reference in any code in the MEPO library code area, including transactions, badis, and exits:

    DATA: ref TYPE string. 
    FIELD-SYMBOLS: <rekko> TYPE ekko. 
    
    ref = '(SAPLMEPO)REKKO'.    "REKKO (EKKO aus Referenz) 
    ASSIGN: (ref) TO <rekko>. 
    
    IF <rekko> IS ASSIGNED.   
      IF <rekko>-ebeln IS NOT INITIAL. 
    *   <rekko>-ebeln   "<== is the reference Purchase Order from which this PO was ADOPTed.   
      ENDIF. 
    ENDIF.
    UNASSIGN: <rekko>.
    Add comment
    10|10000 characters needed characters exceeded