Application Development 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: 

Modifying Tables in Background

Former Member
0 Kudos

Hi

I am facing problem, when modifying tables when executed in Background. The custom table is not getting updated / modified.

The same program works fine, when i execute in foreground.

I have used commit work.

Regards

Madhan Doraikannan

10 REPLIES 10

Former Member
0 Kudos

Hello Madhan,

The reasons for the problem are difficult to pinpoint with the information given.

--> What do you mean by "not getting updated"? Is the program getting executed or not?

--> Use some information messages / write statements (for example, to check the sy-subrc values) in your code to see where the problem is occurring.

--> Go to transaction SM50 and see how many entries you have with the type BGD. You must have atleast one entry for this.

Regards,

Anand Mandalika.

0 Kudos

Hi Anand

Yes i am getting message stating that SALES Deal saved

which i even get when executed in fore groud.

I also tried, with to write a sy-subrc when executed in background.

Like i have put if sy-batch = 'X'.

write sy-subrc.

I am getting sy-subrc = 0.

I have 3 entries of BGD in SM50 transaction

Any thoughts on the same

Regards

Madhan Doraikannan

0 Kudos

Hello Madhan,

Time to look at your code. How are you updating the database tables? From your previous messages in this forum, I guess you are using some BAPI to do that. Is that correct? If yes, then are you using BAPI_TRANSACTION_COMMIT after your BAPI call?

If you are already doing this, then please paste your code here. Atleast the parts around where the update is expected to happen.

Regards,

Anand Mandalika.

0 Kudos

Assuming you use some bapi - check also if there are messages in the return table which should be one of the parameters.

Christian

0 Kudos

NO i am just modifying the table directly

select single * from ZSD_SALES_DEAL into wa_sales_deal where

SALES_DEAL = v_knuma .

move 'X' to wa_sales_deal-PROCESSED_FLAG .

modify ZSD_SALES_DEAL from wa_sales_deal .

commit work.

Regards

Madhan Doraikannan

0 Kudos

Hi

TO give some background about this

We are loading about millions of condition records into sales deal.

when using BDC we recorded a 6 to 8 records per second.

I did some debugging and took the final function module which SAP uses of updating the data into database.

But i am doing all validations before calling SAP function module.

We are successful and recorded around 800 records per second.

Which was massive performance achievement.

This function module is called in update task.

After this function module is executed.

I am writing a perform statement to upload my own custom table saying sales deal updated.

This works fine when i execute in Foreground.

But fails in Background

I hope this info is more useful

Regards

Madhan Doraikannan

0 Kudos

Check the returncode after select single maybe your read was not successful - so it would update a record with empty key fields. (I know that does not explain why it work in foreground).

Also processed_flag is not part of the key, is it?

Christian

0 Kudos

Hi

If i had a delay of 5 seconds.

It is working.

But i am sure this is not right approach.

Any views on the same

Regards

Madhan Doraikannan

0 Kudos

I guess the table you were trying to update relys on the data being updated in the update task. If you do asynchronous posting it is likely that the data has not been posted to the databbase at the time when you were trying to update your table.

Without knowing the coding and the exact process it is difficult to advice.

I would suggest to try it with SET UPDATE LOCAL before the function module is called.

Another way is to perform your update routine via perform on commit - but then you have to remove the commit work in the form and the form must be called before the commit work of the function module

Christian

0 Kudos

Hi Madhan,

The following code snippets will help in better diagnosis of the problem -

1. Call to the Function Module.

2. Call to your subroutine.

3. All statements between 1 and 2.

With the given information, I guess I could give you one hint: Try out giving a COMMIT WORK AND WAIT after the call to the FM and before the call to your subroutine.

Regards,

Anand Mandalika.