Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

getting values into sapscript via loop in driver program

Former Member
0 Kudos

Hi all,

I'm new at sapscripts and I want to know how to pass values into sapscript via a loop. the requirement is like below,

Invoice No.: Invoice No.1, Invoice No.2, Invoice No.3, and so on......

Invoice Date: date1, date2, date3 and so on......

the invoice numbers and invoice dates are coming from loop. but the problem is the labels are also getting printed for each loop iteration, as shown below.

Invoice No. :

Invoice Date:

Invoice No. :

Invoice Date:

Invoice No. :

Invoice Date:

in the script it is like below

Tax Invoice No.: &V_INVNO&,

Tax Invoice Date: &V_INVDATE&

So plz suggest me where I should write the labels so that they will appear once. Thanks.

3 REPLIES 3

atul_mohanty
Active Contributor
0 Kudos

Hi -

Segregate the Invoice & Invoice in to two different internal table in the driver program.

1. First print the invoice no label In the command box of the SAP script there is a command to handle to continue printing in the same line.

2. Then loop over invoice number internal table then print the invoice no using WRITE_FORM . In the command box of the SAP script there is a command to handle to continue printing in the same line.

3. Next print the invoice date label In the command box of the SAP script there is a command to handle to continue printing in the same line.

4 Then loop over invoice date internal table then print the invoice no using WRITE_FORM . Similarly in the command box of the SAP script there is a command to handle to continue printing in the same line.

Let us know, if it helps.

Clemenss
Active Contributor
0 Kudos

Hi Debapriya Gupta,


it's hard to create a Form from scratch if you are new to sapscript.


You may check Example of a Print Program

You will use text elements in the FORM and trigger them via FUNCTION 'WRITE_FORM', i.e. create a text element for invoice no and one for invoice date, then loop at invoices and call the two elements.


Sorry for the bad formatting - always dangerous to use sap scn. Never expect it will be user-friendly.


Regards Clemens




Former Member
0 Kudos

hi debapriya,

You have to write labels in the in the header only.