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

modify database table

Former Member
0 Likes
492

my code updates a database table zbh_test but only 1 entry ie, the 4th record

i want all the entries of my internal table, only the header data is getting updated

types:begin of str,

mandt type vbak-mandt,

vbeln type vbak-vbeln,

erdat type vbak-erdat,

user type sy-uname,

end of str.

data:itab type table of str with header line.

data:wa_itab type str.

start-of-selection.

select mandt vbeln erdat from vbak into table itab package size 10.

endselect.

loop at itab.

itab-user = 'bhanum'.

modify itab.

endloop.

modify zbh_test from table itab.

commit work.

please let me know

4 REPLIES 4
Read only

Former Member
0 Likes
466

Hi Bhanu,

do like this

types:begin of str,
mandt type vbak-mandt,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
user type sy-uname,
end of str.

data:itab type table of str.
data:wa_itab type str.

start-of-selection.
select mandt vbeln erdat from vbak into table itab package size 10.
endselect.



loop at itab into wa.
wa-user = 'bhanum'.
modify itab from wa.
endloop.

modify zbh_test from table itab.
commit work.

<b>Reward Points if it helps,</b>

Satish

Read only

0 Likes
466

no not working

Read only

Former Member
0 Likes
466

also no need of endselect

Read only

former_member404244
Active Contributor
0 Likes
466

Hi,

change ur code..

start-of-selection.

select mandt vbeln erdat from vbak into corresponding fields of table itab package size 10.

loop at itab into wa_itab.

wa_itab-user = 'bhanum'.

modify itab from wa_itab.

clear wa_itab.

endloop.

modify zbh_test from table itab.

if sy-subrc eq 0.

commit work.

endif.

Rewrad if helpful.

Regards,

Nagaraj