Skip to Content
0

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

Sep 07, 2017 at 06:18 PM

43

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Jacques Nomssi Sep 07, 2017 at 09:12 PM
0

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

JNN

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Sep 07, 2017 at 11:16 PM
0

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>.
Share
10 |10000 characters needed characters left characters exceeded