Hi all,
I have a table 'tab' with some records and this table 'tab' has two keys. I want to read a particular record with the two keys(I have these two key values). This record has a field unit of measure which is always 'L' and I want to overwrite Unit of measure value to 'Kg' in that field and modify the table with that row entry.
How can I do this. Please help..... Waiting....
Hi Raju,
Do like tjis:-
read table itab with key key1 = ? key2 = ?.
itab-unit = 'KG'.
modify itab index sy-tabix.
Hope this helps.
Reward if helpful.
Regards
-
Sachin Dhingra
Hi,
Check this code :
select fld1 fld2 form Ztable into table i_tab. loop at i_tab where fld1 = <val1> and fld2 = <val2>. i_tab-fld2 = 'kg'. modify i_tab. endloop. Changed code : <b> loop at i_tab where unit = 'L'. i_tab-unit = 'kg'. modify i_tab. endloop.</b> modify ztable from table i_tab.
Regards
Appana
*Reward Points for helpful answers
Message was edited by: L Appana
Are you talking about internal table or database table? It looks like you are talking about database table. Is it standard SAP or custom table? If it is standard SAP table, I don't suggest you modify them this way. Let us know the table name. If it is custom table, you are saying that it has two key fields key1 and key2, let us say. Is UOM one of them or is it a non-key field?
Hi Raju,
Let this be internal table it_test
key1 | key2 | name | unit |amount ------------------------------------ 1 | 2 | asd | P | 100.00 3 | 4 | ash | L | 200.00 5 | 6 | adsf | P |300.00 -------------------------------------
Lets assume that ( name = L ) can occur mulitple times
for different records in the internal table.
Then add this chunk of code to modify the contents of the field name form <b>L</b> to <b>Kg</b>.
LOOP AT it_test WHERE name = 'L'. it_test-name = 'Kg'. MODIFY it_test INDEX sy-tabix TRANSPORTING name. ENDLOOP.
Regards,
AS
Add a comment