‎2007 Nov 05 4:53 AM
Hi All,
I want to select some rows from table ( T1, say ) and update a particular column value( T1-C, say ) with a value in the variable( Var1, say) for these selected rows. What would be the best statement for doing the same ?..
Thanks in Advance, Sudeep..
‎2007 Nov 05 4:58 AM
Hi..
You can do this using...
UPDATE <DB TABLE>
SET <FIELD> = <VALUE>
WHERE <CONDITION>.
Eg:
Update KNA1 set Ort01 = 'New York' Where Land1 = 'US'.
Reward if Helpful.
‎2007 Nov 05 4:57 AM
Hi
Select *
from T1
into table lt_T1
where <ur condition>.
Loop at lt_T1 into wa_T1.
wa_T1-C1 = var1.
modify lt_T1 from wa_T1 index sy-tabix.
Endloop.
Thanks
Vasudha
‎2007 Nov 05 4:58 AM
Hi..
You can do this using...
UPDATE <DB TABLE>
SET <FIELD> = <VALUE>
WHERE <CONDITION>.
Eg:
Update KNA1 set Ort01 = 'New York' Where Land1 = 'US'.
Reward if Helpful.
‎2007 Nov 05 4:59 AM
Hi,
Try this..
data: itab type standard table of T1,
wa type T1.
*" Select the data.
select * from T1 into itab where..
*" modify the internal table with the value VAR1 for field C.
wa-c = var1.
MODIFY itab FROM wa WHERE c <> var1.
*" Update the database.
UPDATE T1 FROM TABLE itab.
*" commit the database.
COMMIT WORK.
Thanks
naren
‎2007 Nov 05 6:47 AM
Hi Sudeep,
Try the following code:-
Select * form T1 into corresponding fields of table itab_T1
where <condition>.
Loop at itab_T1 into wa_T1.
wa_T1-C = var.
Modify itab_T1 from wa_T1 transporting c.
clear wa_T1.
endloop.
Reward Points if useful.
Regards,
Shilpi