‎2006 Oct 16 6:52 AM
Hi all,
I have to keep on modifying the internal table by adding the values into it based on a particular field Matnr.Int table like mara.How can i do this?
‎2006 Oct 16 6:58 AM
Hi,
just make use of
loop at itab into wa.
wa-matnr = x + a.
modify itab from wa transporting matnr.
endloop.
Hope this helps.
Reward useful answers.
Regards,
Shrita.
‎2006 Oct 16 6:59 AM
HI,
check this code.
itab-field1 = new_values.
itab-field2 = new_values.
MODIFY itab transporting field1 field2
WHERE MATNR = required_matnr.
Regards,
‎2006 Oct 16 7:01 AM
I guess, you are not appending records and just need to substitute values for other fields in a record.
Maybe this can give you some idea:
types: begin of t_data,
matnr like mara-matnr,
fld1 like sy-tabix,
fld2 like sy-tabix,
fld3 like sy-tabix,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
....
....
*** Suppose now we have our internal table data with material numbers
data: l_index like sy-tabix.
loop at it_data into wa_data.
l_index = sy-tabix.
wa_data-fld1 = sy-tabix * 1.
wa_data-fld2 = sy-tabix * 2.
wa_data-fld3 = sy-tabix * 3.
modify it_data from wa_data index l_index.
endloop.Also, you can use stmt like
modify it_data from wa_data where matnr = wa_data-matnr.
Kind Regards
Eswar
‎2006 Oct 16 7:03 AM
Hi,
if itab-matnr = condition.
..add values here
modify itab transporting <modified fields> where matnr = itab-matnr.
endif.
‎2006 Oct 16 7:04 AM
hi,
before that :- modify statemnt will modify a record if there is record having the same key like that of record in work area.
if there is no record in itab with key of work area record, it will insert a new record in itab.
look this sample code.
loop at itab into wa.
wa-field1 = data1.
wa-field2 = data2.
wa-field 3= data3.
modify itab from wa transporting field1 field2 field3. "there shuld not be any chang in key field.
endloop.
rgds
anver
if hlped pls mark points
‎2006 Oct 16 7:37 AM
Hi ...
If you are using internal table with header line. ...
Then you can modify like this ..
Loop at itab .
Select * from mara where ' condition' .
itab-a = mara-matnr . .
Modify itab .
endloop.
Thanks .