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: 

Program behaving differently in debugger & as online transaction

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member215344
Contributor
0 Kudos

Hi Sunny,

You can use SET UPDATE TASK LOCAL statement before each BAPI call and then issue COMMIT WORK.

Thanks,

Ajay Bose

12 REPLIES 12

Former Member
0 Kudos

Check on your commit statements whether they have been placed at proper places

0 Kudos

Dear Maju

Thanks for prompt reply.

All commits are done properly & at right places.

Any other reason you can sight.

Regards

Sunny

karun_prabhu
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

former_member215344
Contributor
0 Kudos

Hi Sunny,

You can use SET UPDATE TASK LOCAL statement before each BAPI call and then issue COMMIT WORK.

Thanks,

Ajay Bose

0 Kudos

Dear Ajay

Thanks a lot. It worked.

Regards

Sunny

0 Kudos

You are welcome 🙂

raymond_giuseppi
Active Contributor
0 Kudos

Triggering debug mode with break-points can trigger database commit  and of course will generate "human delay"

Regards,

Raymond

Former Member
0 Kudos

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

vamsixk
Active Participant
0 Kudos

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

former_member195402
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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