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

append split data into internal table w.r.t fields

Former Member
0 Likes
484

Hai friends,

I am getting the data matnr : 13235,12124,34234

and maktx : aaaa,bbbb , cccc

and lgort : 234, 345, 456

But I have taken the structure as begin of itab

matnr like -


,

maktx like -


,

lgort like-----,

end of itab.

now the data as i need to append first row as 13235 to matnr

aaaa to maktx

234 to lgort,

and second row as 12124 to matnr

bbbb to maktx

345 to lgort

and same as third row

Iam spliting the data but the problem is here matnr is variable i.e based on counter of matnr it should append those no of rows

please give the solution,

prasad.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
437

Hi Prasad,


Loop at i_matnr.
  itab-matnr = i_matnr-matnr. 
  Read table i_maktx with key matnr = i_matnr-matnr.
  if sy-subrc = 0.
   itab-maktx = i_maktx-maktx.
  endif.

  Read table i_lgort with key matnr = i_matnr-matnr.
  if sy-subrc = 0.
   itab-lgort = i_lgort-lgort.
  endif.
  append itab.
Endloop.

1 REPLY 1
Read only

Former Member
0 Likes
438

Hi Prasad,


Loop at i_matnr.
  itab-matnr = i_matnr-matnr. 
  Read table i_maktx with key matnr = i_matnr-matnr.
  if sy-subrc = 0.
   itab-maktx = i_maktx-maktx.
  endif.

  Read table i_lgort with key matnr = i_matnr-matnr.
  if sy-subrc = 0.
   itab-lgort = i_lgort-lgort.
  endif.
  append itab.
Endloop.