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

background updation

Former Member
0 Likes
1,055

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.

8 REPLIES 8
Read only

Former Member
0 Likes
925

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

Read only

0 Likes
925

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.

Read only

Former Member
0 Likes
925

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

Read only

0 Likes
925

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 .

Read only

0 Likes
925

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

Read only

0 Likes
925

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.

Read only

0 Likes
925

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

Read only

0 Likes
925

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.