Application Development and Automation 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: 
Read only

Select statement issue

suganya_rangarajan
Participant
0 Likes
711

Hi,

I have a FM which will update the database table.The FM also does the commint.

After that when I try to do select query to the table,sy-subrc returns 0(succeeds) in debug mode but returns 2(fails) in real scenario i.e when i don't have breakpoints.

Any solution for the issue.

Thanks

Suganya

5 REPLIES 5
Read only

Former Member
0 Likes
678

The V1 update process has probably not completed. When you do the COMMIT, do a COMMIT WORK AND WAIT.

Rob

Read only

Former Member
0 Likes
678

Hi,

When u are in debug mode , commit work will be executed by system. so u can select the data immediately after update.

but when u execute normally commit will be executed when the transaction ends, so it cant fetch immediately after update.

after update try BAPI_TRANSACTION_COMMIT

exporting wait = 'X'.

this will work

Read only

Former Member
0 Likes
678

Suganya,

Explicitly write a commit work statement after Function module.

<b> Reward for helpful answers</b>

Satish

Read only

Former Member
0 Likes
678

As Rob suggested, add AND WAIT to the commit statement. Also check your table and see if it is buffered (technical settings). If it is buffered, you can add BYPASSING BUFFER to your SELECT statement.

Read only

SAPAI
Participant
0 Likes
678

please use commit work and wait.

actually you need to wait for the commit work to get completed and database updation.

you can put explicit wait also but not recommended.