cancel
Showing results for 
Search instead for 
Did you mean: 

SCRIPT - Print text continuously in a loop

former_member1292715
Participant
0 Kudos

Hi Guys,

In script, I want to print text continuosly in a loop. I searched SCN, but I couldn't find anything related. Perhaps, I dont know what keyword to feed in the search.

For example, I have 10 materials in an internal table gt_mara. As of now, it is printing as below.

MAT 1

MAT 2

MAT 3

My code for the above is,

LOOP AT gt_mara INTO gwa_mara.

  CALL FUNCTION 'WRITE_FORM'
   EXPORTING
    element = 'MATERIAL'
    window  = 'MAIN'.

ENDLOOP.

In script,

/E	 	MATERIAL
P1	 	<HB>&GWA_MARA-MATNR& </>

But I need to print in a single line as below. How can I acheive this?

MAT 1 MAT 2 MAT 3

Please excuse me for posting in a wrong forum.

Edited by: P Yasin on Mar 29, 2010 11:12 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196079
Active Contributor
0 Kudos

Hi

you can do this...


LOOP AT gt_mara INTO gwa_mara.
 
concatenate gwa_mara-matnr into matnr separated by space.
 
ENDLOOP.

  CALL FUNCTION 'WRITE_FORM'
   EXPORTING
    element = 'MATERIAL'
    window  = 'MAIN'.

In script,


P1	 	<HB>&MATNR& 

regards

Marco

Former Member
0 Kudos

It is because in your interanls table gt_mara has material in different lines.For three loop pass you will get three differnet lines.

You need to change your logic to print. Since you want to print all material in onle line so I am assuming you don't have many materials to be printed as we can print 6 -7 materials in one line.

move all your material into another table as one record and print it.

former_member1292715
Participant
0 Kudos

Hi ANurag,

Sorry. You misunderstood my question. NOT in a SNGLE LINE but as a continuous text.

The number of materials can be more than 20. I need to print continuously as below.

MAT1 MATERIALLLLLLLLLLLLLLLLLLL2 MMMMMMATERIAL3

MATERIAL4 MAT5 MATERIALLLLLLLLLLLLLLLLLLLLLLLL6

@Marco,

I can not do the way you suggested because I have some other component along with the material to print. Actually this is not my requirement, it is something similar. Is there any way like 'APPEND' in WRITE_FORM or APPEND in Paragraph format??

former_member196079
Active Contributor
0 Kudos

P Yasin

Try to concatenate all the thext you need in the row....i don't thing there're an append statement...

Regards

Marco