Skip to Content
-1

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Aug 03, 2017 at 12:34 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 03, 2017 at 11:12 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 03, 2017 at 10:10 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded