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

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

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

davis_raja
Active Participant

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.

12 REPLIES 12

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

please look at program SF_EXAMPLE_03.

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

Regards.

0 Kudos

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?

Jelena
Active Contributor
0 Kudos

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.

karun_prabhu
Active Contributor
0 Kudos

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.

former_member187748
Active Contributor
0 Kudos

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.

0 Kudos

Hi,

Allow me to disagree the concept is working very well.

Some debugging is in order that is all.

And please look at program SF_EXAMPLE_03.

Regards.

atul_mohanty
Active Contributor
0 Kudos

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

nabheetscn
Active Contributor
0 Kudos

Jack

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

Nabheet

Clemenss
Active Contributor
0 Kudos

Hi Jack,

did you already try the smartform trace as offered by transaction SMARTFORM_TRACE or SFTRACE and documented in SAP Library - Information System Administration.

I remenber when there is not enough space in an output cell structure for a specific value, processing is finished without any message. As you might expect from any quality software 🙂

Regards

Clemens

davis_raja
Active Participant

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.

Former Member
0 Kudos

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.

Sijin_Chandran
Active Contributor
0 Kudos

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.