2013 Oct 08 8:22 AM
Hi all
I'm facing a strange problem with my latest development where in a complete auto sales cycle is created in one-go. Cycle is as under:
Sales Order ---> Outbound Delivery ---> Billing ---> Credit Memo ----> Credit Note
I'm using BAPI for each of them (created subroutine for each BAPI processing with using output of previous subroutine as input to next routine) & have absolutely no trouble at each individual subroutine level.
Desired SD documents are being created & whole cycle works fine BUT ONLY IF it is run with breakpoints / in debugger.
But, when I run that program without breakpoints (thru T.code or directly from ABAP Editor both), only first level: Sales Order creation works fine & rest could not be done.
Anybody has some clue, where am I going wrong.
Useful replies will be appreciated & rewarded.
Regards
Sunny
2013 Oct 08 8:46 AM
Hi Sunny,
You can use SET UPDATE TASK LOCAL statement before each BAPI call and then issue COMMIT WORK.
Thanks,
Ajay Bose
2013 Oct 08 8:28 AM
Check on your commit statements whether they have been placed at proper places
2013 Oct 08 8:30 AM
Dear Maju
Thanks for prompt reply.
All commits are done properly & at right places.
Any other reason you can sight.
Regards
Sunny
2013 Oct 08 8:37 AM
Hello Sunny Kansal.
Even I had faced this issue.
Make use of COMMIT WORK AND WAIT / WAIT UP TO N SECONDS (N=1,2,..) after each process.
This will ensure sufficient time for DB server to update the data after each process.
Regards.
2013 Oct 08 8:45 AM
I understand that through a Z program you are trying to create all four entities...
Why don't you use update task module/ perform on commit which triggers after COMMIT in you main program.
After calling BAPI_TRANSACTION_COMMIT for sales order..your update task for outbound delivery should get called and inside that put check based on the SO number generated before.
Check should be whether SO is actually created in the system or not ?
and similarly other two processes.
Or else a WAIT statement may help you.
Regards
Ansumesh
2013 Oct 08 8:46 AM
Hi Sunny,
You can use SET UPDATE TASK LOCAL statement before each BAPI call and then issue COMMIT WORK.
Thanks,
Ajay Bose
2013 Oct 08 10:11 AM
2013 Oct 08 10:23 AM
2013 Oct 08 8:52 AM
2013 Oct 08 9:04 AM
Though performance incentive but just try this way:
1. once the sales order is created , use hte bapi transaction commit with wait option
2. check the database with the generated sales order number (check vbak table )
3. if record present ie sy-subrc 0 , continue for next step of creation outbound delivery
if record not present sy-subrc 4, wait until the DB is updated .
4. now create the delivery , use the bapi transaction commit with wait option
5 check the DB with the generated delivery number (check LIKP table)
6. if record present ie sy-subrc 0 , continue for next step of creation of billing
if record not present sy-subrc 4, wait until the DB is updated .
and so on check for first two steps and you will know what is going wrong .
and do let us know if u still have problems.
NOTE : in the above case you will not be able to rollback as u are committing at every stage.
Ideal way is to use the Update task FM to commit .
BR
Venkat
2013 Oct 08 9:10 AM
I Agree with raymond! Debugging generates Human delay.
Please Use the commit work statement along with the Wait addition.
Or maybe you can use an update task?
Regards,
Vamsi
2013 Oct 08 9:13 AM
Hi,
for BAPIs are no booking fm's you can't use the SET UPDATE TASK LOCAL. command.
After calling your BAPI you should call BAPI_TRANSACTION_COMMIT with the WAIT option.
Therefore set parameter WAIT to X.
Regards,
Klaus
2013 Oct 08 10:10 AM
Dear all
Thanks for your replies.
First & foremost the issue is resolved.
I was already using BAPI_TRANSACTION_COMMIT & that too with delay (WAIT option).
So, no issue with COMMIT was there.
I do agree that debugger generates human delays & that could be well handled with WAIT option as everyone is talking about and I was doing exactly same. But still the problem was persisting while running in online mode.
So, problem was in carrying updates to the next level, I guess. As my program was working ok till (n-1) levels provided I run it for 'n' levels. This symptom & Ajay Bose's reply showed me the path to resolve the same.
@Ajay Bose: Thanks for your valuable suggestion. That worked.
@Klaus: I have well used SET UPDATE TASK LOCAL just before the BAPI call & it resolved my issue. Any more inputs/suggestions/diagnosis on it? You are welcome
Thanks to all!
Sunny