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

Reg: MOdify

Former Member
0 Likes
595

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?

6 REPLIES 6
Read only

Former Member
0 Likes
567

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.

Read only

dani_mn
Active Contributor
0 Likes
567

HI,

check this code.

itab-field1 = new_values.

itab-field2 = new_values.

MODIFY itab transporting field1 field2

WHERE MATNR = required_matnr.

Regards,

Read only

Former Member
0 Likes
567

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
567

Hi,

if itab-matnr = condition.

..add values here

modify itab transporting <modified fields> where matnr = itab-matnr.

endif.

Read only

anversha_s
Active Contributor
0 Likes
567

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

Read only

Former Member
0 Likes
567

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 .