Skip to Content
author's profile photo Former Member
Former Member

During a loop, once a smartform is called why does it not proceed to the next iteration?

Hi Experts,

During a loop, say:

LOOP 5 times.

CALL SMARTFORM

ENDLOOP.


When a smartform is called, why doesn't it return/proceed to the next iteration? Does the call of a smartform indicate End of Program? Why, and how so?

Thanks in advanced.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on Jan 06, 2014 at 09:52 AM

    Dear Jack,

    The next iteration of the smartform will be processed after you press the BACK button.

    To skip this and bring all the iterations in a single spool with multiple pages, you need to use

    NO_OPEN and NO_CLOSE additions of the Control Parameter which you are passing to Smartform.

    On first iteration, it should be set like below,

    control_param-no_open = ' '.

    control_param-no_close = 'X'.

    On last iteration it should be set like below,

    control_param-no_open = 'X'.

    control_param-no_close = ' '.

    And for the remaining iterations, it should be set like below,

    control_param-no_open = 'X'.

    control_param-no_close = 'X'.

    This will create all the iterations in a single spool with multiple pages.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 06, 2014 at 11:39 AM

    As already mentioned by many here .

    The reason is that One form ( Smartform Print Command ) is called into one print request until and unless you explicitly provide conditions to include several forms into one print request

    Control Structure (SAP Library - Smart Forms)

    Printing Several Forms in One Print Request (SAP Library - Smart Forms)

    These two links will brief you the idea.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 03, 2014 at 02:52 PM

    Hi,

    please look at program SF_EXAMPLE_03.

    note the use of functions 'SSF_OPEN','SSF_CLOSE'.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I'm aware of these FMs. What I would like to know is why it isn't the same with:

      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

      CALL FUNCTION FMNAME. - Does this part immediately indicate end of program? when not matched with SSF OPEN and CLOSE?

  • Posted on Jan 03, 2014 at 06:10 PM

    I wrote programs before where Smartform(s) were called in a loop using the CALL FUNCTION <FMNAME>, never had any issues.

    You might want to be more specific, e.g. post the actual code and what exactly is happening in debugger.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2014 at 03:23 AM

    Hello Jack.

    Call to a smartform does not terminate the calling program. Control will return back.

    You can test it by yourself by setting a BREAK-POINT after the loop.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2014 at 04:45 AM

    Hi Jack,

    irrespective of looping on your smartforms, i don't know how you have done it, as once you are

    in smartforms, then how again you will back to your driver program again.

    Anyhow, i will sujjest you to drop the concept of looping on your smartform, and within smartform

    call your smartform as many times you wants by writing these code lines within smartforms.

    DESCRIBE TABLE it_tab LINES v_count.

    where you have to declare v_count as i, and it_tab will have the internal table in which your data

    has been fetch for as many times you wants to run your smartforms.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2014 at 04:59 AM

    Hi Jack -

    Please press the 'Back' Button once you have the Print Preview (if you are seeing the preview), it will go to next iteration.

    OR please put a break point on the loop and 'Back' Button once you have the Print Preview. You will see the iteration.

    Let us know for further help.

    Regards,

    Atul Mohanty

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2014 at 07:46 AM

    Jack

    What happens when you execute smartform is displayed and when you press back button what happens?? Next smartform is called or not??

    Nabheet

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 06, 2014 at 10:13 AM

    hello jack ,

    if u r internal table having 20 records u r calling the smart form with in loop it will print 20 times

    but each time u have to give the printer name and printing mode after print print privew are print u again interactively go back for each loop iteration.

    if u want to print 20 line items in one time u should create the single spool

    for this u have to pass the control parameters to the smart forms that already explained by

    davisraj and also see the bellow code

    loop at itab .

    AT FIRST.

    lv_controlparms-no_open = ' '

    lv_controlparms-no_close = 'x '

    ENDAT.

    Lv_controlparms-no_open = 'X'.

    Lv_controlparms-no_close = 'X'.

    ATLAST.

    lv_controlparms-no_open = ' X'

    lv_controlparms-no_close = ' '

    ENDAT

    call function " ur form name "

    endloop.

    Regards ,

    Pramodh.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.