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

Commit Work

Former Member
0 Likes
694

Hi Experts,

I have a requirement at the end of which a number is generated(Say Business Partner no. or Sales order number.)

If I try to use the number immediately afterwards(in the same program) I get an error like the number does not exist.

Evidently, the database takes some time to be updated(4-5 seconds).

Is there any way to make this process instantaneous?

I have already used Commit work / BAPI_TRANSACTION_COMMIT.

Thanks and Regards,

Ravi

6 REPLIES 6
Read only

Former Member
0 Likes
633

hi,

afer commit write statement as follwos:

wait up to 5 sec.

thanks,

anupama.

Read only

Former Member
0 Likes
633

Hi Ravi,

Actually i don't know to do it in system, bcoz system takes some time .

i am having one alternate solution wait u put delay conditon there till ur BAPI commiting when commit finish nad u have that no u can us no.

Do.

  • Receiving task results

RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT' --Put ur BAPI There after Commit i don't know its working for bapi or not

EXCEPTIONS

RESOURCE_FAILURE = 1

communication_failure = 2 MESSAGE lv_mssg

system_failure = 3 MESSAGE lv_mssg

OTHERS = 4.

if sy-subrc = 0.

""Do your Process

exit

else.

  • Wait in a task

CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

PERFORMING f_task_end ON END OF TASK

EXPORTING

seconds = 5 " Refresh time

busy_waiting = space

EXCEPTIONS

RESOURCE_FAILURE = 1

communication_failure = 2 MESSAGE lv_mssg

system_failure = 3 MESSAGE lv_mssg

OTHERS = 4.

enddo.

also check syntex i make this in hurry.

Put send u ur feedback/query i am wating

Read only

Former Member
0 Likes
633

Hey Guys,

I have done that too.

But we are talking about 1000 such records at a time.

5 seconds per record gives 5000 seconds.

Or 82 minutes??????

Regards,

Ravi

Read only

SujeetMishra
Active Contributor
0 Likes
633

Hello Deep,

BAPI "BAPI_TRANSACTION_COMMIT" is already doin commit and wait. you can check the function module.

only thing you can do is first check whatever updates you are doing in your program check if sy-subrc = 0 then use commit work and wait.

then you use above BAPI.

Have a Nice Day.

regards,

Sujeet

Read only

Former Member
0 Likes
633

You can use a Do enddo here. Inside this you can select the data from database and exit if the record is found. If the record is not found, you can increament a counter and wait for 1 second. if the counter reaches upto a certain limit , then you can forcefully exit.


data counter type i.
do.
 select  (fields) from (table)
   into (wa)  
      where <condtion>.

   if sy-subrc = 0 or counter = 10.  " for example
     exit.
   endif.

add 1 to counter.
wait up to 1 seconds.

This way , the program will try to select the data and after 10 seconds it will forecefull exit if the record is still not fetched. But in most cases it might exit at the first select if the sy-subrc is 0.

regards,

Advait

Read only

Rushikesh_Yeole
Contributor
0 Likes
633

What is the use of COMMIT WORK statement? what is its advantage? Reply me asap.