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: 

Delay the posting with Bapi

Former Member
0 Kudos

Hi Experts

thre 3 types of move ment type postings,

101,541and y08

here iam Posting movement type 541 using bapi BAPI_GOODSMVT_CREATE

before that system posting 101

after 541 posting yo8 is posting sytem only

sequence is 101(system posting) --> 541with custem programe using Bapi ---> yo8 (system posting)

my requirement is delay the posting of 541 upto completing of y08 ( sysem posting)

Required sequence is 101 (system posting) --> yo8 (system posting) -->541with custem programe using Bapi

how can i resolve this problem , Please advice me .

Thanks in advance

Regards

Saimedha

10 REPLIES 10

Former Member
0 Kudos

Hi!

at the end of bapi you can put this piece of code



          call function 'BAPI_TRANSACTION_COMMIT'
            exporting
              wait = 'X'.

*or*

COMMIT WORK.
WAIT UP TO 5 SECONDS.

Former Member
0 Kudos

Hi Sai,

Could you please be more clear about your requirement? What is your requirement and what are you trying to achieve?

Please do note that consecutive goods movement posting is not allowed with in same LUW...

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

There is no need of any wait statements


call function 'BAPI_TRANSACTION_COMMIT'
            exporting
              wait = 'X'.  "Make sure you are passing this

@Kris -

Please do note that consecutive goods movement posting is not allowed with in same LUW

It creates problem only when we use the bapi in migo transaction badis' or exits like one after another because MB_GOODSMOVEMENTCREATE can be called only once not twice before a commit work. But if the bapi is executed from progarm for different movement types there wont be any problem( witha commit work and wait after each bapi call ). Correct me if i am wrong

0 Kudos

Hello Keshav,

But if the bapi is executed from progarm for different movement types there wont be any problem( witha commit work and wait after each bapi call )

COMMIT WORK AND WAIT just makes the update process synchronous i.e., the cursor is held till the LUW is complete.

How will this behaviour ensure that Mvmt YO8 is completed before 541 given that both are executed in separate LUWs? As per the OP, 541 Mvmt is updated via BAPI whereas YO8 is a system posting.

Let me know your thoughts.

BR,

Suhas

0 Kudos

Hi Suhas,

541 Mvmt is updated via BAPI whereas YO8 is a system posting.

if this is the case then it will create problem. I meant if both the movements were posted from program. If the scenario is like migo posts one movement and after that a movement needs to be posted by bapi then some thing like a call function in background task should do.This must be placed in the appropriate method of badi.

We had a similar case once...so a remote fm was created and executed in background task as a seperate unit in the method of badi. It worked fine. To be frank i am not too much familiar with the RFC types etc

0 Kudos

@Keshav, Would we be able to post another goods movement from the BADI of the preceding goods movement? wouldn't it end up in the same LUW (unless we are going for V2 update)?

Is there a option to configure a Output type for Y08 posting? and this output type can be set up to generate a MBGMCR* IDOC for 541 posting?

0 Kudos

Hi Kris,

A special function 08 output type should do. But if you see the call function in background task as seperate unit will do. This is what SAP help says about CALL FUNCTION - IN BACKGROUND TASK.

When the transactional call is made, the name of the called function, together with the destination and the actual parameters given in parameter list, are registered for the current SAP LUW in the database tables ARFCSSTATE and ARFCSDATA of the current SAP system under a unique transaction ID (abbreviated as TID, stored in a structure of type ARFCTID from the ABAP Dictionary, view using transaction SM58). Following this registration, the program making the call is continued by way of the statement CALL FUNCTION.

When executing the COMMIT WORK statement, the function modules registered for the current SAP LUW are started in the sequence in which they were registered

0 Kudos

My mistake... I was reading it as update task rather than background task

0 Kudos

Thanks for quick reply,

But iam not resolved this issue.

when iam delaying 541 posting using waite up to 20 second s

same time y08(system posting) also delaying 20 seconds .

iam not getting required sequnce ie

101(system posting ) --> Y08 (system posting) -->541(manuval posting)

regards

Saimedha

0 Kudos

Hi,

It seems like your Y08 depends on the completion of 101 & 541, If this is the case then, may be you can try posting 542 after executing your transaction and then post Y08. You can create an event(SM62) for this purpose which will trigger another program(need to schedule this program through SM36) that will execute 542 & Y08. Though this is not a solution, I mean it will just solve your purpose, in case you are not able to seperate the two movements(541 & Y08)

Also there is some setting in SPRO from where you can maintain these movements.

Regards,

Gopal