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: 

Badi or user exit to transfer data post GI in delivery

0 Kudos

hello gurus

I need some help with the following.

we want to generate a posting 107 in a PO, when a GI from a delivery is done.

I will explain: we create a NB PO which generates a SD order with EDI.

a Delivery is created from this SD order and when the GI is done for the delivery, we want to generate a Mvt 107 to the originating PO.

for various reasons we cannot use Intercompany process but I have seen a post

https://answers.sap.com/questions/10495759/vl02n---user-exit-after-lending-document-created.html

where the guy uses bapi BAPI_GOODSMVT_CREATE at the same point, when posting GI in VL02N.

I am not sure how to use it in my case tho: can someone help?

6 REPLIES 6

DominikTylczyn
Active Contributor
0 Kudos

Hello alisa.schlossberg-majer

I'd suggest using a custom output type determined in the GI material document. The output processing program can get all the data from the GI and call BAPI_GOODSMVT_CREATE to post 107. The details of BAPI_GOODSMVT_CREATE call depend hugely on your specific scenario, so I can give you precise guidance here. However the BAPI is very well documented.

Have a look at my response https://answers.sap.com/questions/13666905/packing-proposal-at-sales-order-level-automatic.html?chil... on how to redirect the output processing to a separate LUW in order to avoid locking conflicts if the output is processed immediately during the GI material document posting.

Best regards

Dominik Tylczynski

hello Dominik

thank you for your reply.

your idea looks quite interesting: I just confess I never tried such a method, can you help?

basically, what we need is the following:

after GI from the delivery, I need the system to retrieve the info about the PO and items, which is stored in the SD order at item level and for each item issued, a movement 107 has to be added to the PO item.

how can I generate an output message that will trigger this process?

0 Kudos

alisa.schlossberg-majer

20 hours ago

hello Dominik

thank you for your reply.

your idea looks quite interesting: I just confess I never tried such a method, can you help?

basically, what we need is the following:

after GI from the delivery, I need the system to retrieve the info about the PO and items, which is stored in the SD order at item level and for each item issued, a movement 107 has to be added to the PO item.

how can I generate an output message that will trigger this process?

DominikTylczyn
Active Contributor
0 Kudos

Hello alisa.schlossberg-majer

alisa.schlossberg-majerTo build output determination based automation you basically need the following

Customization of a custom output type

You can set all the customization in NACE transaction, application ME "Inventory Management". Material documents based output determination uses only one procedure ME0001, so your output type needs to be assigned to it. Refer to the following notes on MM-IM output determination:

The output type should be set with "Transmission Medium" = 8 "Special function" and a custom output processing program should be assigned to it. The output type can be partner independent.

Activation of MM-IM output determination for users posting GIs

That is done with NDR user parameter - see the note 3079393 - MIGO: How to set checkbox "Print via Output control" in header data by default

Output determination program implementation

Here you will need help of a ABAPer skilled with output processing implementation. The program interfaces with output determination with global declaration of NAST table:

TABLES:  nast.

The program needs to implement an entry FORM routine with the interface:

FORM <form name> USING iv_returncode TYPE any iv_us_screen  TYPE any. 

If you want to process the output and thus post 107 immediately after GI posting the entry FORM routine should redirect the processing to a separate LUW with the following code:

  DATA: lf_leave           TYPE xfeld.

* (0) Redirect this NAST processing to separate LUW - in case it is
* called with processing time 4 (Immediate) in the update task
CALL FUNCTION '/SPE/CALL_PROC_IN_NEW_LUW'
EXPORTING
is_nast = nast
IMPORTING
ef_leave = lf_leave.

IF NOT lf_leave IS INITIAL.
* Per default we set the status on error, so that it can be reprocessed
* in error processing (RSNAST0F) if there is any syntax error / update
* termination / ... in the decoupled NAST processing.
rc = 4.
EXIT.
ENDIF.

The basic logic of the output processing program:

  1. get the details of the GI material document
  2. call BAPI_GOODSMVT_CREATE with the details of GI e.g. material number, batch, quantity, to post 107 receipt
  3. if the BAPI call is ok, call BAPI_TRANSACTION_COMMIT, otherwise call BAPI_TRANSACTION_ROLLBACK
  4. report all the messages with NAST_PROTOCOL_UPDATE

Best regards

Dominik Tylczynski

0 Kudos

dear dominik

thank ou for your extensive explanation, looks interesting I will certainly submit the idea.

one last question: what do you suggest in case of cancellation og the GI? (VL09)

0 Kudos
alisa.schlossberg-majer

The original automation we have discussed is to post 107 GR right after delivery GI posting. So to post GI cancellation (VL09) in your process, you need to post GR cancellation first. Therefore GR cancellation can not be automated from GI cancellation. I'd suggest that you go for a manual process here, especially that VL09 is not that common.