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

updating a custom table

Former Member
0 Likes
4,123

I am trying to update a custom table in BW with the following statement.

UPDATE customtable FROM TABLE ITAB1.

itab1 has entries but the customtable is not getting updated do i need to use any commit statement for that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,476

For UPDATE to work, entries have to exist in the data base table for the entries you want to update from the internal table. So in your caase, the entries likely don't exist in the database and you are getting sy-subrc = 4.

There is an implicit COMMIT at the end of the program, so adding one won't really help.

Rob

I am trying to update a custom table in BW with the following statement.

UPDATE customtable FROM TABLE ITAB1.

itab1 has entries but the customtable is not getting updated do i need to use any commit statement for that.

13 REPLIES 13
Read only

Former Member
0 Likes
2,476

Hi,

Right after that stmt write 'COMMIT WORK'.

This shud work.

Regards,

Vinod.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,476

Try MODIFY or INSERT, not sure about the syntax here.

MODIFY ztable FROM TABLE ITAB1.

or 

INSERT ztable FROM TABLE ITAB1.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,476

Hello,

Alwasy use Modify/Insert command to update the ZTABLE.

Vasanth

Read only

Former Member
0 Likes
2,476

Hi,

Yes..Give COMMIT WORK statement after the update statement.

Example

-


UPDATE customtable FROM TABLE ITAB1.

IF SY-SUBRC = 0.

COMMIT WORK.

ENDIF.

Thanks,

Naren

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,476

Which value get SY-SUBRC after your update.

Remembre not to change primary keys of your records.

regards.

Read only

Former Member
0 Likes
2,477

For UPDATE to work, entries have to exist in the data base table for the entries you want to update from the internal table. So in your caase, the entries likely don't exist in the database and you are getting sy-subrc = 4.

There is an implicit COMMIT at the end of the program, so adding one won't really help.

Rob

Read only

0 Likes
2,476

There are no entries in the custom table now so may be i can use modify statement as the table will be updated on a regular basis

Read only

0 Likes
2,476

That's what the others suggested and should be what you need.

Rob

Read only

0 Likes
2,476

Use Modify statement.

Read only

0 Likes
2,476

Thanks for your help. I have another problem. The custom table exists in both R/3 and BW. I have to update the R/3 table from the BW table. I am calling a function module from BW in a program with destination as test system of R/3 for updating the table in R/3 but the table is not getting updated . How can i correct this ?

Read only

0 Likes
2,476

Hope both R/3 and BW table are same. Check the calling FM excuted successfully.

Read only

0 Likes
2,476

This seems like a separate problem/question. You will likely get more responses if you open a new thread.

Rob

Read only

Former Member
0 Likes
2,476

Hi,

Use MODIFY statement..Which will insert a record if the matching key is not found..Also if the key is found it will update the record..

MODIFY customtable FROM TABLE ITAB1.

COMMIT WORK.

THanks,

Naren