‎2009 Jan 13 10:32 AM
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
‎2009 Jan 13 10:39 AM
hi,
afer commit write statement as follwos:
wait up to 5 sec.
thanks,
anupama.
‎2009 Jan 13 10:45 AM
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
‎2009 Jan 13 10:49 AM
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
‎2009 Jan 13 10:54 AM
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
‎2009 Jan 13 10:58 AM
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
‎2009 Mar 09 10:33 AM
What is the use of COMMIT WORK statement? what is its advantage? Reply me asap.