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 database table

Former Member
0 Likes
848

Hello All,

I have a reqmnt. I am having a table created by user and I need to update few values in it. The scenario is there is table ZTAB and there is field F1 , i need to insert values of F1 in field F2, where FI is not initial. Please check out my logic.

itab like table of ZTab,

wa like line of itab,

Select * from ZTAB into itab.

loop at itab into wa where F1 IS NOT INITIAL.

wa-f2 = WA-f1.

**Here is doubt, shud i use modify or append***

append WA or modify wa to itab.???

endloop.

Modify ZTAB from itab.

thanks and regards,

Gaurav

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
825

Hi,

Please try this.


...

 modify itab from wa.
endloop.

modify ztab from table itab.

Regards,

Ferry Lianto

8 REPLIES 8
Read only

Former Member
0 Likes
825

can someone suggest me something better?

Read only

Former Member
0 Likes
825

Hello Gavrav,

DO like this:


itab like table of ZTab,
wa like line of itab,
Select * from ZTAB into itab.
loop at itab into wa where not F1 IS INITIAL. " Check here
wa-f2 = WA-f1.
***Here is doubt, shud i use modify or append****
modify itab from wa.    " Check here
endloop.
Modify ZTAB from itab.

If useful reward.

Vasanth

Message was edited by:

Vasanth M

Read only

0 Likes
825

one more thing

, do i need to use

append wa . after wa-f2 = WA-f1.

thanks,

Gaurav

Read only

0 Likes
825

No need of <b>Append WA</b>

Read only

Former Member
0 Likes
826

Hi,

Please try this.


...

 modify itab from wa.
endloop.

modify ztab from table itab.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
825

as you want just to modify the existing record with value F , just use modify

<b>modify itab from wa.</b>

Read only

Former Member
0 Likes
825

Hi ,

You need to use only modify, no need to append wa.

inside the loop use

<b>modify itab from wa.</b>

itab like table of ZTab,

wa like line of itab,

Select * from ZTAB into itab.

loop at itab into wa where F1 IS NOT INITIAL.

wa-f2 = WA-f1.

<b>modify itab from wa.</b>

endloop.

Modify ZTAB from itab.

Hope it helps

regards,

saumya

Read only

Former Member
0 Likes
825

Thanks All for you replies,

i have given points to ALL of you guys, but please if you have not received points do let me know, sometimes its an error in point allocation system