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

Update statement

Former Member
0 Likes
1,002

Hi All,

can i use the below statement in loop endloop?

UPDATE zbmt_fsi_detail FROM TABLE i_zbmt_fsi_detail

Or else will it give any dump or perfomance issues?

I want all line items in i_zbmt_fsi_detail should be updated..Please help me out?

9 REPLIES 9
Read only

GauthamV
Active Contributor
0 Likes
983

Yes , you can use it.

Read only

Former Member
0 Likes
983

Hi,

Instead of the loop you can directly upldate the using statement.

UPDATE zbmt_fsi_detail FROM TABLE i_zbmt_fsi_detail

i_zbmt_fsi_detail should be smae structure as of zbmt_fsi_detail .

Read only

0 Likes
983

Hi Avinash,

Both the structures were same ..So i have used below staement only

UPDATE zbmt_fsi_detail FROM TABLE i_zbmt_fsi_detail.......

But each line item in that internal table is not getting updated to zbmt_fsi_detail.

Read only

Former Member
0 Likes
983

Hi,

Updating in the loop to the DB table is the performance issue.

so you

try below out side the loop.


MODIFY Z_TABLE from it_table.

here performance will be increased.

Thanks!

Read only

Former Member
0 Likes
983

hi,

updating a database table will create a performance problrm when large maount of data need to be updated. But update can be done inside a loop i have done similar requiremnt like this updating all the records in the internal tables as below.

LOOP AT it_upd1 INTO wa_upd.

UPDATE zdm_wtyprof SET upload_status = 'S'

WHERE spart = wa_upd-spart

AND mcodesd = wa_upd-mcodesd

AND prof = wa_upd-prof.

CLEAR wa_upd.

ENDLOOP.

Read only

Former Member
0 Likes
983

This should give you syntax error.

UPDATE can be used in LOOP....ENDLOOP

Refer:

http://help.sap.com/saphelp_NW04/helpdata/en/fc/eb3a94358411d1829f0000e829fbfe/content.htm

Read only

Former Member
0 Likes
983

Hi,

You can use like that. but the performance will be low. try to get all records in internal table then use that statement outside loop.

Thanks,

Srilakshmi.

Read only

Former Member
0 Likes
983

u can use it.

Read only

Former Member
0 Likes
983

Hi Shruti,

UPDATE..FROM TABLE.. is not very meaningful in LOOP ..ENDLOOP..

as it will update the table again ang again from the same table..

Instead either you just use UPDATE..FROM TABLE.. or UPDATE ..FROM wa...in a LOOP

However Update FROM TAble will have better performance anyday.

Each line in your internal table may not be reflected because of the key..

Go to your DB table and check the key columns there..then in your internal table see if any of the records have the same keys.. if u have any such record then it will be written just once in DB..

Edited by: Ankesh Saharan on Jan 21, 2009 2:46 PM