Application Development and Automation 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: 
Read only

How to call two smartforms with using a single print program

Former Member
0 Likes
1,183

Hi,

I have a requirement wherein I need to call two smartforms using a single print program.

The interface parameters are different in two smartforms.

I presently solved the issue using the smartform names as the reference.

Can anyone let me know if there is any other way to solve it.

I heard something about global params. But not sure.

Please let me know the best possible way to solve this issue.

Thanks and Regards,

Debabrata

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
974

Hi Debabrata,

Based on the condition in your print program you can call the below code

fname1 TYPE rs38l_fnam.

IF -


.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORMS'

importing

fm_name = fname1

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.*

CALL FUNCTION FNAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS=

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

fname2 TYPE rs38l_fnam.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORMS'

importing

fm_name = fname2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.*

CALL FUNCTION FNAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS=

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

7 REPLIES 7
Read only

Former Member
0 Likes
974

Hi Debabrata ,

use the below logic


loop at itab.

if itab-notification = '10'.

call smartform S1

ELSEIF ITAB-NOTIFICATION = '20'.

CALL SMARTFORM S2

ELSEIF ITAB-NOTIFICATION = '30'.

CALL SMARTFORM S3

ENDIF.

endloop.

Thanks!

Read only

Former Member
0 Likes
975

Hi Debabrata,

Based on the condition in your print program you can call the below code

fname1 TYPE rs38l_fnam.

IF -


.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORMS'

importing

fm_name = fname1

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.*

CALL FUNCTION FNAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS=

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

fname2 TYPE rs38l_fnam.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORMS'

importing

fm_name = fname2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.*

CALL FUNCTION FNAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS=

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

Read only

0 Likes
974

hi,

In smartforms, only one layout can called at a time...

through some if endif, logic we can call different but only one form is possible..

try like this,

if sy-subrc = 0.

form = 'ZCOMMERCIAL_INVOICE'."Smartform object

else.

form = 'ZPROFORMA_INVOICE'.

endif.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = form

IMPORTING

fm_name = fnam

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

it will call either commercial invoice or proforma invoice..

Read only

0 Likes
974

Hi,

Thanks.

Is this the only method? Are we supposed to use two CALL FUNCTION calls?

As stated earlier, I have already used this logic in my print program.

Is there any other way of using only one Call Function formname?

Thanks and Regards,

Debabrata

Read only

0 Likes
974

hi,

i think that is not possible,

because once your control shifts from driver program to smartforms..

it wont come back to the driver program to call another smartforms..

you can try like..

call another smartforms in the final window program lines..

i didnot tried, you can check..

regards

vijay..

Read only

Former Member
0 Likes
974

Hi,

yes u can call two layouts in a single script

To call a second layout from another layout u need to use

function module start_form and end_form...

we can call two layout in print program.......not assining in

nace.

exp:

open form: first from name.

write form:

start form : second layout name.

end form:

close form.

Hope this will help you:

Regards:

Alok

Read only

Former Member
0 Likes
974

answered