Showing results for 
Search instead for 
Did you mean: 

Triggering a second Material Movement for the same material (322 after 632)

0 Kudos


We need to make a 322 after a 632 in order to move to Quality as the material comes from "Customer consignment" .

I have tried to call 'BAPI_GOODSMVT_CREATE' inside BADI~MB_DOCUMENT_UPDATE to trigger automatically 322 but it isn't working as the 632 is in process (COMMIT problem).

Any ideas how to do the second material document?

Thank you very much in advanced.

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor

Hello quiquec

If I were you, I would automate the second material document posting with output determination. You can set up a custom output type and determine it with the first material document. Then you put all the posting logic to create the second document into the output processing routine. This approach has a couple advantages:

- you can store any messages coming from the second document posting into the output processing log with the NAST_PROTOCOL_UPDATE function

- if anything goes wrong with the second material document posting, you can easily monitor that with standard SAP transaction and reprocess the output

- you can set up output determination very flexible way to make sure the second document is posted only for the right first documents.

On top of that, as you have the posting logic already implemented in the BAdI, it will be very easy to port it to the output determination processing.

Once you do that, you need to make sure that the second document is posted in a separate logical unit of work (LUW) from the first one. Otherwise you'll hit the problem you already have. That can be achieved in two ways:

- either process the output with processing time 3, i.e. not immediately when the first document is posted

- or process the output with processing time 4 i.e. immediately with the first document posting but redirect the processing to a separate LUW using the following piece of code:

* (0) Redirect this NAST processing to separate LUW - in case it is
*     called with processing time 4 (Immediate) in the update task
      is_nast  = nast
      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.

That code comes from the /SPE/STO_ID_PROCESSING program, STO_ID_CREATION, which processes SPED output type and creates an inbound delivery from an outbound one in stock transfer scenarios.

Best regards

Dominik Tylczynski


Thank you very much. Very good solution.

Answers (2)

Answers (2)

0 Kudos


could you please explain in more dtails your business case behind that??



My organization lends sports equipment to other organizations for the organization of sports events.

This operation is free of charge.

At the end of the event, they return the borrowed equipment to us.

Upon arrival at our warehouse, the returned equipment undergoes a quality inspection to ensure that it is in good condition.

In SAP, we will perform:

- a movement "631" to deliver the material on consignment.

- a movement "632" for the return of the consigned material.

- At this point, we want to execute a 322 to move the stock to quality and create inspection lots. This is the step we would like to automate since it involves the same materials, batches, and quantities as in the 632.

-After completing the quality inspection, with the usage decision, we perform a 321 to return the stock to unrestricted.


0 Kudos

thx, I understand but a solution seems difficult...? I'm follow on this topic

0 Kudos


did you try to use the movment out of the UD whre you can define indi. movment types by customizing?

0 Kudos

Thank you.

We want to make the 322 to start de QM inspection. It's before de UD.