cancel
Showing results for 
Search instead for 
Did you mean: 

print data at new line in SAP Scripts

Former Member
0 Kudos

Hi,

Is there any way that i can print data at new line in sap scripts. I am looping my data and its printing in the same line but i need to print it at new line. Is there any formating options or any command to do that.

Thanks

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I have cheque printer issue... when we print on cheque each line are printing on the next line so what setting which i should follow? or what is the exact procedure to solve?

Florian
Active Contributor
0 Kudos

Hi Tushar,

maybe you work through this blog here and share more details, what exact your issue is.

~Florian

BTW: A new thread might be the better solution in your case

Former Member
0 Kudos

If the quantity of variables to print is variable, you might want to send it one by one, declaring a variable that will contain the value for each calling of the sapscript, this way you only print the lines you have. This could work for a complete unknow number of values.

If you know that the number of values has a maximun and a minimum, and they are only 3 or so instances possible, you could declare elements into the sapscript, one for each case, and call the one you need according to the data you need to print.

Former Member
0 Kudos

You can also control the output from the program, with simples if-then or AT END OF or similar in your LOOP.

And then, instead of writing to the window = 'MAIN' write to the window = 'your var window' in that instance, so normal printing for normal data and special printing for special data.

You can also declare ELEMENTS inside the sapscript to define areas of print code, and then call window = 'your window' and element = 'your element'. to differentiate different print instances.

Former Member
0 Kudos

to print data in new lines we normally do this way...

loop at itab.

write:/ itab-field1.

endloop.

Former Member
0 Kudos

If this must be done for every line just add a second line into the main window of the Sapscript and put there the text or &variables& you need.

Former Member
0 Kudos

Thanks for the reply. But the window is a var window not a main window.

naimesh_patel
Active Contributor
0 Kudos

Than you must take all the values from the internal table into the different variables and than print them.

In program:


READ TABLE ITAB INTO WA_TAB INDEX 1.
IF SY-SUBRC = 0.
  VAR1 = WA_TAB-FIELD1.
ENDIF.
* read all the lines and fill the VAR variables

In SAPScript:


/E LINE_VAR
/P &VAR1&
/P &VAR2&
/P &VAR3&
/P &VAR4&

Regards,

Naimesh Patel

Former Member
0 Kudos

the internal table size will vary so how can i store in the variables. I mean according to your logic i have declare variables based on the internal table size but my internal table size gonna vary.