Skip to Content
-1

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

Aug 03, 2017 at 10:43 AM

172

avatar image
Former Member

Hi,

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 for entering the RFQ number (header)

------> 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.

1.jpg (10.8 kB)
page-2-item.jpg (2.3 kB)
page-3-item.jpg (31.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Richard Harper Aug 03, 2017 at 12:34 PM
1

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

Regards,

Shan.

0
Raymond Giuseppi
Aug 03, 2017 at 11:12 AM
1

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

Regards,

Shan.

0
Jelena Perfiljeva
Aug 03, 2017 at 10:10 PM
1

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
ENDLOOP.
IF SY-SUBRC = 0.
<time to call the form>
ENDIF.
ENDLOOP.

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

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

Regards,

Shan.

1

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

1