how to update database??

Question: I changed the contents of a predefined table (changing the values of fields) using internal table in loop statement
After changing I want to update the database with this new data.
Can anybody please help??

Answer:
I changed the contents of a predefined table (changing the values of fields) using internal table in loop statement
After changing I want to update the database with this new data.
Can anybody please help??

RTFOH: Update
_________________
--
Joe Ambush

Answer:
I used update statement but its not updating.
Here is code
[FIELD-SYMBOLS: <f1>,<f2>,<f3>,<f4> type any.
select prodh into table i_prodh from mvke where matnr in s_matnr.
loop at i_prodh.

write:/ i_prodh-prodh.
assign i_prodh-prodh+0(2) to <f1>.
write:/ <f1>.
assign i_prodh-prodh+2(3) to <f2>.
write:/ <f2>.
assign i_prodh-prodh+5(4) to <f3>.
write:/ <f3>.
assign i_prodh-prodh+9(4) to <f4>.
write:/ <f4>.
endloop.
select prodh1 prodh2 prodh3 prodh4 into table i_vrsio from s901 where
matnr in s_matnr and vrsio in s_vrsio.
loop at i_vrsio.
write:/ i_vrsio-prodh1.
move <f1> to i_vrsio-prodh1.
write:/ i_vrsio-prodh1.
write:/ i_vrsio-prodh2.
move <f2> to i_vrsio-prodh2.
write:/ i_vrsio-prodh2.
write:/ i_vrsio-prodh3.
move <f3> to i_vrsio-prodh3.
write:/ i_vrsio-prodh3.
write:/ i_vrsio-prodh4.
move <f4> to i_vrsio-prodh4.
write:/ i_vrsio-prodh4.
collect i_vrsio.
write:/ i_vrsio.
endloop.

update s901 set: prodh1 = i_vrsio-prodh1
prodh2 = i_vrsio-prodh2
prodh3 = i_vrsio-prodh3
prodh4 = i_vrsio-prodh4
where vrsio in s_vrsio
and matnr in s_matnr.
]
Here the task is to split prodh into 4 prodhs and then update the database with the new records of 4 prodhs.
Please kindly help me.[/code]

Answer:
I used update statement but its not updating.
Here is code

if sy-subrc eq 0.
move i_vrsio-prodh1 to s901-prodh1.
move i_vrsio-prodh2 to s901-prodh2.
move i_vrsio-prodh3 to s901-prodh3.
move i_vrsio-prodh4 to s901-prodh4.
update s901.
endif.


Here the task is to split prodh into 4 prodhs and then update the database with the new records of 4 prodhs.
Please kindly help me.

Answer:
You are using a COMMIT WORK statement if you get a valid return code from your update statement aren't you?

Otherwise the system will rollback and you will lose your modifications.
_________________
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru
Copyright ?2007 - 2008 www.jt77.com