cancel
Showing results for 
Search instead for 
Did you mean: 

In a single line - More than one value in script

former_member1292715
Participant
0 Kudos

Hi,

In script, I have to print 3 materials in each line. For example, if I have 10 entries in an internal table GT_MARA. I need to print as below.

1. Material A 2. Material B 3. material C

4. Material D,,,,,,

10. Material K

At the moment I am printing one by one.

LOOP AT GT_MARA.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'MATERIAL'
            window  = 'MAIN'.
ENDLOOP.

How to achieve this? Please suggest.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member1292715
Participant
0 Kudos

Anybody now???

I might have confused you all. Please forget the numbering. Can I get output as below.

Material-A  Material-B Material-C
Material-D  Material-E Material-F
Material-H  Material-I Material-J
Material-K

antony_paul2
Active Participant
0 Kudos

Better create a new internal table with the following stucture

BEGIN OF ITAB,

matnr1 type matnr,

matnr2 type matnr,

matnr3 type matnr,

.............................

.............................

END OF ITAB,

then populate this itab from GT_MARA

data: l_flag.

loop at gt_mara.

if itab-matnr1 is initial.

clear flag.

itab-matnr1 = gt_mara-matnr.

exit.

endif.

if itab-matnr2is initial.

itab-matnr2 = gt_mara-matnr.

exit.

endif.

if itab-matnr3 is initial.

flag = 'X'.

itab-matnr3 = gt_mara-matnr.

append itab.

endif.

AT LAST.

IF flag <> 'X'.

append itab.

ENDIF.

ENDAT.

endloop.

Then use itab while calling ur script

former_member1292715
Participant
0 Kudos

Hi Antony,

Thanks for your reply. In this logic, again we have to populate values to other internal table. But, is there any standard way to achieve this using paragraph format and tabs?

Regards,

Yasin.

antony_paul2
Active Participant
0 Kudos

I dont think this can be achived by any other means.

Main reason is that you are looping gt_mara and calling the text element. So at that instance u have only 1 record of your itab

available in the script, but material number 2 & 3 is in the next 2 lines of yuor itab...