Skip to Content

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

Display the column according

hi all.

i want to display the column according to the user enter.

The table contain admino, fname, lname, contact in seq order.

If user specify to display the contact and fname only, the column must display the contact column first then follow the fname. Below is my code. It follow the order of the table, i cant make it follow the user specify. How can i do that?

REPORT ZGARY_CONCAT1.

PARAMETERS:field1(30).

PARAMETERS:field2(30).

PARAMETERS:field3(30).

PARAMETERS:field4(30).

PARAMETERS:field5(30).

TABLES: ZSTUDGARY.

DATA: it_vbak TYPE TABLE OF ZSTUDGARY WITH HEADER LINE,

wa_fld(72) TYPE C,

it_fldtab LIKE TABLE OF wa_fld.

if field1 <> ''.

append field1 to it_fldtab.

endif.

if field2 <> ''.

append field2 to it_fldtab.

endif.

if field3 <> ''.

append field3 to it_fldtab.

endif.

if field4 <> ''.

append field4 to it_fldtab.

endif.

if field5 <> ''.

append field5 to it_fldtab.

endif.

SELECT (it_fldtab)

INTO CORRESPONDING FIELDS OF TABLE it_vbak

FROM ZSTUDGARY.

IF SY-SUBRC = 0.

LOOP AT it_vbak.

write:/ it_vbak.

ENDLOOP.

ENDIF.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question