cancel
Showing results for 
Search instead for 
Did you mean: 

Loop in SAP script to print dynamic data in the form

Former Member
0 Kudos

Hi All,

I have a requirement with SAP script, i have numerous records in the internal table which i need to printy them using the SAP script form.I have the form created with windows of variable type and default parameter as ID - Item data.

In the program ,i am calling the WRITE_FORM function to print the windows in the form.

But this prints only the last record of the internal table ,it dosn not tprint all the records from the itab?

How should i take care of this requirement of mine.In the form page i have defined my varibale windows with fixed values for "left" "upper" "width" and "hght" parameters.Will this cause any issue?How can i make sure that the windows display dynamic data (in loop) from the internal table?

Also how can i take care of printing that runs for multiple pages ?

Please suggest?

Thanks in advance,

Swati

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

The MAIN window will take care of Dynamic Data.

Loop u r internal table(itab).

Call function Write_form.

endloop.

Write internal table fields in u r Script.

Eg: itab-matnr,itab-mblnr etc.

Former Member
0 Kudos

You can print the data how you would like to structure. For example item data to be printed with header line in all pages. Then you can write the header structure say Item no., Item, Description, Quantity, UoM. Create another page in script and by defauly MAIN window will be there. You can adjust the co-ordinates of MAIN wondow so that you can use complete sheet not like FIRST page (many other data will be printed). Try this and let me know if any more assistance needed.

Regards,

Prasanth

Former Member
0 Kudos

Hi Prashanth,

Following is my requirement ,

Invoice no: .......... Packing Date: .......

-


PO_NO Shipping Part Description Qty

-


1)

2)

3)

...

..

...

-


Total .........

-


Grand Total ..........

-


In this case can you please help me in suggesting the MAIN window structure and the other required window strutcures?

It will be a great learning from you as i am really confused about use of SAP scripts.

Thanks in advance,

Swati

Former Member
0 Kudos

Hi,

Generally MAIN window is used to print the dynamic data as it can spread to many pages and also default window. Generally, other window types except MAIN window used to print specific and minimal inforamtion like addresses of company, customer etc, running description like addressing customer, legal information. The size of the window can be guessed prior based on type of data printing. But in other cases like item data which you could not expect how many lines it will be as any standard order can accomodate max. of 999 lines.

Hope I might addressed your problems. If still not, please provide further details of what information you would like to print and how you designed the form so that it would be great to look into further.

Regards,

Prasanth

Former Member
0 Kudos

Hi Prashanth,

What should be the structure of the MAIN window in such cases?Can you provide me with some example how should the ITEM DATA ?

Thanks for the help.

Swati