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: 

Create Good Movement in VL01N

Former Member
0 Kudos

Dear All,

On ECC6, TCode VL01N, Pgm SAPMV50A, Include MV50AFZ1, User Exit USEREXIT_SAVE_DOCUMENT.

We are trying to post additionnal good movement with BAPI_GOODSMVT_CREATE :

1) In Background task :

It works fine, SD doc flow is correctly fed but we can not get return and therefore can not control potential errors.

2) In Foregroung task :

If we leave DELIV_NUMB and DELIV_ITEM, we get DUMP with err msg VL302 saying that delivery does not exist yet. If we clear DELIV_NUMB and DELIV_ITEM then it works, but SD Doc flow is not fed.

We tried tricky things such as Commit before and/or after calling Bapi but no success. We tried also to call BAPI in foreground-test to get potential error msg, but for an unknown reason, then next call in background failed.

help appreciated,

Regards,

Francois

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

Look at OSS [ Note 415716 - User exits in delivery processing|https://service.sap.com/sap/support/notes/415716]

FORM routine USEREXIT_SAVE_DOCUMENT (include MV50AFZ1)

Purpose

The routine is used to save your own data when saving deliveries. Delivery data cannot be changed here anymore since it has already been transferred to the update.

Call

The call occurs when the document is saved (routine BELEG_SICHERN, program SAPMV50A) immediately before the COMMIT WORK statement.

Data access

As in the routine USEREXIT_SAVE_DOCUMENT_PREPARE, you can access all the global data of the delivery. When you create the delivery, the document number of the delivery is now also known.

If your own data is to be updated, this should be done using function modules that can be updated. Depending on how the indicator V50AGL-SYNCHRON (Release 3.1I: KZ_SYNCHRON) has been set, carry out the update in synchronous or asynchronous mode:

  • V50AGL-SYNCHRON = 'X': Synchronous update

  • V50AGL-SYNCHRON = ' ': Asynchronous update, required to call the update function module with the addition IN UPDATE TASK.

Never use your own COMMIT WORK or ROLLBACK WORK statements.

Display of messages

The output of messages or user dialogs is generally not allowed since a COMMIT WORK is sent implicitly here. In serious cases, processing can be terminated with a message of the type 'A'.

You may have to check this Synchronized flag, and in some case execute the BAPI in background task, so it will be processed after every update task function module executer by the calling program have been executed;

Regards

Former Member
0 Kudos

Hi

I think it should include the BAPI in a new fm available to call in update task of type V2.

0 Kudos

In V2 update most database update will be performed, in background taskl, V1 and V2 updates will have been processed

As i am a coward cautious guy i would use a background task where i will be allowed to play with commit and the like.

Regards

Former Member
0 Kudos

Dear All,

I tried call "in update task", no success it failed even earlier in process.

No more ideas ?

Regards

0 Kudos

Really, try CALL FUNCTION XXXX IN BACKGROUND TASK

Regards