‎2009 May 27 10:50 AM
Hi Experts,
can we call two form from one driver program.....
i have two form have different OUTPUT TYPES
I want to call both form from one deriver program.
if yes....please give the solution also.
thanks
babbal
‎2009 May 27 11:16 AM
Hi
you can very well call 2 SMARTFORMS in one driver program.
What will happen is after the first print priview when you press back u will get the second
preview screen.
Try this code
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSMARTFORM12' " Your first smartform name
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = w_fmname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
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 w_fmname
* 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 =
TABLES
T_SELECT = s_vbeln[]
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.
Use the same code once more in the same program to call the second smartform.
Regards
Hareesh Menon
Edited by: Hareesh Menon on May 27, 2009 12:16 PM
‎2009 May 27 11:04 AM
I will find out for you
Edited by: RavivarmanP on May 27, 2009 5:02 PM
‎2009 May 27 11:08 AM
sure you can do this.
just call your second form after the call of the first one.
no matter if sap script od smartforms, the call of your form is just a call of an FM.
and when calling FM´s you always get back to coding when they finished.
‎2009 May 27 11:16 AM
Yes sure you can do it.
In your driver program just give the condition on basis of which u are callinbg different smartfoms.
Like for standard purchase order u have purchase order category as NB and for Service PO something else.
So in driver program write if doc cate(whatever the field is) = 'NB'.
then call smartform1
else if doccat = 'Z.'
call smartform2
endif.
‎2009 May 27 11:16 AM
Hi
you can very well call 2 SMARTFORMS in one driver program.
What will happen is after the first print priview when you press back u will get the second
preview screen.
Try this code
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSMARTFORM12' " Your first smartform name
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = w_fmname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
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 w_fmname
* 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 =
TABLES
T_SELECT = s_vbeln[]
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.
Use the same code once more in the same program to call the second smartform.
Regards
Hareesh Menon
Edited by: Hareesh Menon on May 27, 2009 12:16 PM
‎2009 May 27 11:21 AM
yes you can do the same. first call the SSF_FUNCTION_MODULE_NAME function module, get the FM name of your smartform, call it once and then do the same the second time. This will trigger it when you are done with the first one.
However, it is not that advisable as it would be very confusing for the end user (if the user is happy with it, then no issues). You can instead,
create two pages first page with first forms layout and the second with a different layout.
You can call these on the basis of a condition (using radio buttons on the screen)
or you can submit this program to a different program and you can make that program call the second form.
Regards,
S.Dakshna nagaratnam.
‎2009 May 27 11:34 AM
HI Dakshna
but his requirment is,he has two different forms and not a single one and
both has to be called form one driver program.I think the mwthod
i have specified is the better way to achive
the same.
Regards
Hareesh Menon