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: 

updating a custom table

Former Member
0 Kudos

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

Former Member
0 Kudos

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

13 REPLIES 13

Former Member
0 Kudos

Hi,

Right after that stmt write 'COMMIT WORK'.

This shud work.

Regards,

Vinod.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

MODIFY ztable FROM TABLE ITAB1.

or 

INSERT ztable FROM TABLE ITAB1.

Regards,

Rich Heilman

Former Member
0 Kudos

Hello,

Alwasy use Modify/Insert command to update the ZTABLE.

Vasanth

Former Member
0 Kudos

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

raymond_giuseppi
Active Contributor
0 Kudos

Which value get SY-SUBRC after your update.

Remembre not to change primary keys of your records.

regards.

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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

Rob

0 Kudos

Use Modify statement.

0 Kudos

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 ?

0 Kudos

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

0 Kudos

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

Rob

Former Member
0 Kudos

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