Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

building an internal table from another internal table

Hello Friends,

I have an internal table with say for eg : 15 materials. I need to display them on the sapscropt form .

I want to format this internal table into another internal table with 3 columns and each column having 5 materials so that i can fit all the 10 materials on one page.

Please advise .

Thank you ,

Teresa

Eg: itab1

m1

m2

m3

m4

m5

m6

I need the new itab2 to look like

col1 col2 col3

m1 m2 m3

m4 m5 m6

Tags:
replied

Hi Teresa lytle,

Following code solves your problem:

REPORT ZMA_TEST .

Tables: mara, makt.

data: begin of itab occurs 0,
      matnr like mara-matnr,
"      maktx like makt-maktx,
end of itab.

data: begin of itab2 occurs 0,
       matnr like makt-matnr,
       matnr2 like makt-matnr,

      end of itab2.


select matnr into table itab from makt up to 15 rows where spras eq 'E'.

data: i type i, y type i.


describe table itab lines i.

y = i / 2.


loop at itab from 1 to y.

  itab2-matnr = itab-matnr.
  append itab2.

endloop.


loop at itab from y to i.
  itab2-matnr2 = itab-matnr.
  append itab2.

endloop.


loop at itab2.
  write: itab2.
endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question