cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Partner Function From PO to Delivery

Former Member
0 Kudos

Hi Experts,

For a return to suppliers flow, I need to retrieve the partner function ("Carrier") from a PO into a delivery. It seems that in standard it is not possible...

So is anyone know what is the user exit to copy over PO partner functions into an inbound delivery document ?

Thanks a lot for ur help,

Guillaume

Accepted Solutions (0)

Answers (2)

Answers (2)

marceldebeer
Discoverer
0 Kudos

Hello Guillaume, I wrote some code for MV50AFZ1 for USEREXIT_SAVE_DOCUMENT_PREPARE

and this works perfectly.

* Start of 09.04.2014 MDB

* Insert to copy the carrier from the purchase order to the delivery

* in the stock transport order process

* It is fine-tuned and limited to the STO process and made dynamic!!!

* The information is passed through to XVBPA and other related tables

* in source code of FV50XF0B_B_ABHAENGIGE_TABELLEN and filling

* the partner tables using the type of partner e.g. NRART = 'LI'

* in LVCOMU04 at code CASE COM_VBPA-NRART


IF xlikp-LFART EQ 'NL' AND xlikp-UPDKZ EQ 'I'.

* lfart = NL; just for stock transport order process

* updkz = I; only when the replenishment delivery is created


DATA: BEGIN OF IT_LFA1 OCCURS 100,

            LIFNR  LIKE LFA1-LIFNR,

            ADRNR  LIKE LFA1-ADRNR,

            LAND1  LIKE LFA1-LAND1,

            NAME1  LIKE LFA1-NAME1,

            END OF IT_LFA1.


DATA: WA_VGBEL LIKE LIPS-VGBEL,

            WA_LIFNR LIKE LFA1-LIFNR,

            WA_FEHGR LIKE XVBPA-FEHGR.

 

WA_VGBEL = xlips-VGBEL.

WA_FEHGR = XVBPA-FEHGR.


SELECT LIFN2 FROM EKPA INTO WA_LIFNR

        WHERE EBELN = WA_VGBEL

          AND PARVW EQ 'SP'.

* We are adding the carrier so partner role SP (=CR) defaulted.

SELECT LIFNR ADRNR LAND1 NAME1

     INTO TABLE IT_LFA1

       FROM LFA1

         WHERE LIFNR = WA_LIFNR.

    LOOP AT XVBPA.

       MOVE XVBPA-FEHGR TO WA_FEHGR.

* FEHGR () is a standard ABAP Domain available within your

* SAP system (depending on your version and release level).

* at creation 09.04.2014 FEHGR = '07'. Made dynamic!

    ENDLOOP.


ENDSELECT.


LOOP AT IT_LFA1.


   CLEAR XVBPA.

   XVBPA-MANDT = xlikp-MANDT.

   XVBPA-VBELN = xlikp-VBELN.

   XVBPA-POSNR = '000000'.

* Defaulted by selection above: SP (=CR)

   XVBPA-PARVW = 'SP'.

   XVBPA-LIFNR = IT_LFA1-LIFNR.

   XVBPA-ADRNR = IT_LFA1-ADRNR.

   XVBPA-LAND1 = IT_LFA1-LAND1.

* ADRDA = D means read address from ADRC (master) with ADRNR

   XVBPA-ADRDA = 'D'.

* For UPDKZ: check whether you have passed UPDKZ in XVBPA UPDKZ

* has below values INSERT (I),DELETE (D),UPDATE(U) etc

* as we do insert we need 'I'.

   XVBPA-UPDKZ = 'I'.

   XVBPA-NAME1 = IT_LFA1-NAME1.

* table TPAR contains partner type for partner roles.

* partner type of carrier (CR=SP) is LI lieferschein, vendor

   XVBPA-NRART = 'LI'.

* FEHGR made dynamic!

   XVBPA-FEHGR = WA_FEHGR.

* just spras english is enough...

   XVBPA-SPRAS = 'E'.


APPEND XVBPA.


ENDLOOP.


ENDIF.

* End of 09.04.2014 MDB

Former Member
0 Kudos

Hello,

sorry for the late reply.

the takeover of partners out of the purchase order into the inbound delivery only supports the partner role 'Supplier'. This is part of the standard functionality.

If you would like to install a solution outside the standard you could use userexit_save_document_prepare (MV50AFZ1) where you could read the other partner roles out of the purchase order into table XVBPA.

br,Gabor