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

reading internal table, column wise!

Former Member
0 Likes
2,513

friends,

have an internal table with four rows like this..

MATNR QTY01 QTY02 QTY25

800000 50 20 10

i need to manipulate this internal table and populate another int. table like this,

matnr date qty

800000 01.12.06 50

800000 02.12.06 20

800000 25.12.06 10

that is, i should read qty01 (field name) and take the last two digits as the date of the current month and the qty. against that as the demand for that material on that date...how to do this? i need to read the first int. table column wise, and also read the int. table field? not able to get any idea..need your inputs...thanks all

3 REPLIES 3
Read only

Former Member
0 Likes
761

Hi Sathish,

fieldsymbols: <fs> type any.

data: w_fieldname(10),

counter(2).

Loop at table1.

table2-matnr = table1-matnr.

w_fieldname = 'table1-QTY'.

do 3 times.

counter = counter + 1.

say for example if your table1 fields are matnr QTY1 QTy2

concatenate w_fieldname counter into w_fieldname.

say for example if your table1 fields are matnr QTY01 QTy02

concatenate w_fieldname '0' counter into w_fieldname.

Assign (w_fieldname) to <fs>.

Table2-QTy = <fs>.

Append table2.

enddo.

endloop.

This is useful if your first internal table fields are fixed . Still you can get a view how to use.

Reqard points if it is helpful.

Reagrds,

kiran i

Read only

Former Member
0 Likes
761

Hi Sathish,

Regarding getting the field name of the internal table, please refer the below links,

Also, there are many threads reg this topic, if you want check then type 'get internal table field name' in the search of SDN.

Regards,

Hema.

    • Reward points if it's useful.

Read only

Clemenss
Active Contributor
0 Likes
761

Hi,

more or less symbolic code; adapt to your needs

data: num2 type numc2.
field-symbols: <qty> type any.
loop at itab.
  do 31 times.
  num2 = sy-index.
  concatenate 'QTY' num2 into field.
  assign component field of structure itab to <qty>.
  check sy-subrc = 0.
  itab2-matnr = itab-matnr.
  itab2-date = sy-datum
  itab2-date+6(2) = num2.
  itab2-qty = <qty>.
  collect itab2."if more than one record per month (?)
  enddo.

endloop.

Sorry, I got interrupter for some hours - don't know if already solved.

Regards,

Clemens

just formatted by:

Clemens Li