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.
Showing results for 
Search instead for 
Did you mean: 

How to display multiple line items using a driver program in smart form ?

0 Kudos


I am looping my internal table which contains two line items. Each line item belongs to two pages in my smart form. There are totally three pages in my smart form.

------> Selection Screen

The First page is header level which contains the RFQ number.

--> RFQ number (Header) which is the Page_1.

The Second and the third pages belong to item level which contains the line item number and their bidder details.

--> Line Item No. 1 and it's description name which is Page_2.

--> Line item no. 1 detail which is the Page_3.

Please find attached the images for your reference.

Issue am facing:

If I am calling my smart form inside my loop. I am getting only the first line item. If I call the smart form from outside the loop, I am getting only the second line item.

A solution needed for:

Therefore, to display all the line items, How should I apply logic in the driver program.


Active Contributor

Try to get some consistency between the interface of the form and the way you call it.

Also if you call the form multiple time (calling it once a header parameter and an internal table of items was too simple?) don't forget to manage open/close related parameters to get a single spool (parameters no_open and no_close in the Control Structure.)

Start reading some document like Defining the Form Interface in Smart Forms online documentation.

0 Kudos

Hi Raymond,

Thank you for your response and sharing the links. The open/ close related logic helped me a lot to close this object. Looking forward to your guidance and cooperation for the future posts as well.



Active Contributor

A smart form is not sapscript.

Change the smart form to accept an RFQ number.

In the smartform define a table of RFQ items and populate that item

Create a loop in the main window, printing out the header texts etc as required and the item details. Issue a new page to print page 2. At the end of page 2 if there are more items issue a new page command.

0 Kudos

Hi Richard,

Thank you for spending time in replying to the post. You helped me understand how to use a page command & its purpose. Looking forward to your guidance for future posts as well.



Active Contributor

Do what Richard said in the form. You can look at a standard invoice Smartform, for example, to see how the form interface is done in the header/item scenario.

Naturally, in the driver program, in the LOOP you'll need to fill in the internal table with the line items and start the form (passing the data to it through its interface) as soon as you got all the items in that internal table. This is really simple, general logic looks like this:

LOOP AT <headers>
  LOOP AT <items> WHERE something = header
<time to call the form>

Don't forget about clean-up in between and what Raymond mentioned.

When in doubt - look at the standard SAP output programs.

Hi Jelena,

Yes, I used the same logic for header and item. Also, I referred to some standard smart form programs.

Still, I had three pages. So, I was in a confusion to reply to all of you. Finally, I got my result by swapping the main window to the third page and the secondary window to the second page.

I kindly convey my sincere apologies to all three people for my delayed response. Your help meant to be so helpful to me. Thanks a bunch for spending the time to reply my query.

Looking forward to the same help and cooperation from @Jelena Perfiljeva, @ Raymond Giuseppi, and @Richard Harper. Thank you so much.



Active Contributor

Thanks for the follow-up! If your question is answered you might want to close it as explained in this blog.