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

Problem with database update using WAIT UP TO 30 SECONDS

Former Member
0 Likes
1,989

Hi guys,

I am using this FM BAPI_PROCORDCONF_CREATE_HDR to confirm my process order... but it seems to work intermittently, it sometimes confirm sometimes it skips this process and do not confirm....

Through debugging, it is doing well... it confirms the process order... however upon running the program, it works intermittently...

Our system is ECC 6.0... my suspect is that the ECC 6.0 runs faster than the older version hence having this problem with timing...

I used WAIT UP TO 30 SECONDS after the commit work... but it seems that this is not enough time yet for the system to update the database... i am afraid that extending only the time to wait in order to update the database would cause some risks for the program... to work intermittently...

I need your suggestion to make this work independent of time to wait for the system to update the DB...

I need your help...

Thanks a lot!

Rgds,

Mark

7 REPLIES 7
Read only

former_member156446
Active Contributor
0 Likes
1,582

use this:

call function 'BAPI_FIXEDASSET_CHANGE'
exporting
companycode = vl_ccode
asset = vl_asset
subnumber = vl_sub
generaldata = stl_generaldata
generaldatax = stl_generaldatax
importing
return = st_return.

call function 'BAPI_TRANSACTION_COMMIT'
wait = 'X'.

Read only

0 Likes
1,582

Thanks for your prompt response jackandjay...

but i actually use this after the bapi procordconfirm

call function 'BAPI_TRANSACTION_COMMIT'

wait = 'X'.

and after this bapi transaction commit i put my wait up to 30 seconds... it seems not to work...

Read only

Former Member
0 Likes
1,582

Did you use BAPI_TRANSACTION_COMMIT to commit the changes. Try this if not used.

Further you can try to lock the order in a DO loop with a wait of say 1 second in every loop pass. If the locking is successful, unlock the order and exit the loop. (This locking can happen only when the order is created in the database and hence this logic). Make sure that you have an upper limit of say 30 times for your loop so that it doesnt get caught in an indefinite loop in the event the order is not commited properly.

This looping actually gives you an option to keep your wait time varaible with maximum wait time going for exceptional cases alone.

Hope this helps.

Thanks

Vijay

Read only

0 Likes
1,582

Hi Vijay,

I am interested with your solution...

Can you provide sample code for this locking in a DO loop please?

Thanks so much...

Rgds,

Mark

Read only

0 Likes
1,582

I do not have SAP access right now. The code will be of this sort.

WHILE V_MAXCOUNT < 30.

CALL FUNCTION <your enqueue module> here. " Get the enqueue module for the order table that corresponds to your order type. Here you can pass the order number generated, that is obtained as a result of your BAPI

if sy-subrc eq 0.

call function <your dequeue module here>

EXIT. " You need not loop any further

else.

wait for 1 seconds.

endif.

V_MAXCOUNT = V_MAXCOUNT + 1.

ENDWHILE.

clear V_MAXCOUNT.

Read only

0 Likes
1,582

hi Vijay,

One last question... How will I know the enqueue and dequeue module that I'll be using...?

Thanks a lot!

Read only

0 Likes
1,582

Figure out which database table holds your order created, say AUFK.

for this the lock object is ESORDER.

Go inside this lock object in SE11.

Now look for "Lock Modules" in the GoTo Menu (I am not sure - pls check in the system)

This will give both Enqueue and Dequeue modules.

Thanks

Vijay