‎2007 May 12 5:57 AM
Hi all,
I hav a program , in which i am creating a material document( using bapi goods mvt create). and using the generated material document number am updating a custom table. am running this in background.
My problem is when i cancell the background job, some times , the last generated material document is not updated in my custom table . ( since i might hav cancelled the job immediatley after the material document is created )
do we hav any provision , so that my job should get cancelled only after the custom table is updated.
Thanks & Regards,
sandeep.
‎2007 May 12 6:09 AM
hi sundeep,
have u used Bapi_transaction_commit after using the bapi so that it will trigger the database. Use BAPI alone cant hit the D/B.
Regards
alosn
‎2007 May 12 6:16 AM
Hi alson ,
Thanks for the reply .
I hav used transaction commit. after doing the transaction commit , am updating a custom table with the material number. My problem is , when i cancel the background job , some times the material doc no is not getting updated into the custom table . i want to prevent this situation . Do we hav any provision in sap , so that the background program should get cancelled only after updation of custom table with the material document number.
Regards,
Sandeep.
‎2007 May 12 7:48 AM
hi sudeep,
i guess u must be using either update or modify stmt to udpdate ur custom table bcz i guess a standard bapi cant update a ztable.
can u clarify regarding this, i mean wht happens when u run that bapi.
if u use update or modify they will directly hit the d/b table but u have to use comiit work and wait stmt. if u can elaborate ur reqmt i can give a sol. one morething if u r using upload or download functionmodules, they doesnt support BG processing.
regards
alson
‎2007 May 12 9:20 AM
Hi alson ,
Yes , u r right. I am using moidfy statement in order to update the ztable.
How can use commit and wait while updating the ztable.
Regards,
Sandeep .
‎2007 May 12 9:35 AM
Hi Sandeep,
You can use the statement commit work and wait for 5 seconds.
But can you please elaborate your requirement, as you are saying you need to update the ZTABLE even if you are canceling the background job.
Regards,
Atish
‎2007 May 12 9:48 AM
Hi,
i am creating material document using bapi_goods_mvt .
this material creation is in a loop . i.e. I am creating more than one material documents at a time.
after creating every material document number, with that material document number (MBLNR), am manually updating a ztable using modify statement .
Now , my porblem is when my user cancel the job .
In a situation , a material document is generated and begore it gets updated into ztable if my user cancelles the job ,my ztable is not updated with the newly created material document.
I should program in such a way that after generating a material document , it must update the ztable , then only the program should be stopped.How can i do dat?
evidently , i Hav no problem if my user doesnt cancel the job .
Regards,
Sandeep.
‎2007 May 12 9:55 AM
Hi Sandeep,
You can't stop the user from canceling the background job.
So what you can do is if the user is canceling the job then you should invoke the Fm BAPI_TRANSACTION_ROLLBACK instead of commit.
This will make sure that the material document will not get created if the user cancels the program
Regards,
Atish
‎2007 May 12 10:13 AM
Hi,
Probably u can try to invoke a deliberate delay time to update the table, so that there is enough time to update ur ZTable. This u can do by, creating a dummy loop, for the necessary delay time.