‎2008 May 13 7:22 AM
Hi Expart ,
Wht is work function module SSF_FUNCTION_MODULE_NAME calling smartform driver prg.
Regards
Bhabani
‎2008 May 13 7:26 AM
Hi ,
After getting the function module name, use the name(w_form_name as below) and call the function module by passing all the variables and tables you want to pass to the smart form
Get the function name for the smart form by passing the smartform name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_smartform
IMPORTING
fm_name = w_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
s_ctrlop-getotf = k_charx.
s_ctrlop-no_dialog = k_charx.
s_outopt-tdnoprev = k_charx.
Call the smartform
CALL FUNCTION w_form_name
EXPORTING
control_parameters = s_ctrlop
output_options = s_outopt
user_settings = 'X'
i_bun_date = w_bun_date
i_sup = w_sup
IMPORTING
job_output_info = t_otfdata
TABLES
t_oeb = t_oeb_final
t_opa_fcr = t_opa_fcr
t_opa_req = t_opa_req
t_opa_inc = t_opa_inc
t_next_bundle = t_next_bundle
t_text = text_tab
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
Message : Error opening smartform
MESSAGE text-009 TYPE 'I'.
ENDIF.
‎2008 May 13 7:28 AM
Hi Bhabani,
This FM returns the name of the FM generated by specified smart form,
You may not use this FM and directly call the FM generated by the smartform but this will give dump in prod as name of the FM generated in the prod will not be same as the name in development.
So we use the FM: SSF_FUNCTION_MODULE_NAME to get the name of the FM generated by the smartform at run time.
Reward if useful.
Regards
Bikas
‎2008 May 13 8:03 AM
Hi
if u write the code in se38 for smartforms then we have to assign that form name in the driver program so we call
SSF_FUNCTION_MODULE_NAME fm.In this we give our form name.
i am sending u sample code.go through it.
--
data:wa_lfa1 type zsf_lfa1,
wa_ekko type zsf_ekko,
it_ekpo type zsf_ekpo_tb,
v_ebeln type ekko-ebeln,
v_name type rs38l_fnam.
--
selection-screen begin of block b1 with frame title text-001.
parameters:p_ebeln type ekko-ebeln.
selection-screen end of block b1.
----
AT SELECTION-SCREEN
----
at selection-screen.
perform validate_ebeln.
perform get_data_from_ekko.
perform get_data_from_lfa1.
perform get_data_from_ekpo.
----
END-OF-SELECTION
----
end-of-selection.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'Z50886_SMARTFORMS'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = v_name
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.
--
*'/1BCDWB/SF00000724'
call function v_name
exporting
wa_lfa1 = wa_lfa1
wa_ekko = wa_ekko
tables
it_ekpo = it_ekpo
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.
&----
*& Form VALIDATE_EBELN
&----
form validate_ebeln .
select single ebeln
from ekko
into v_ebeln
where ebeln eq p_ebeln.
if sy-subrc <> 0.
message e030.
exit.
endif.
endform. " VALIDATE_EBELN
&----
*& Form GET_DATA_FROM_LFA1
&----
form get_data_from_lfa1 .
if wa_ekko-lifnr is not initial.
select single lifnr
land1
name1
ort01
pstlz
regio
from lfa1
into wa_lfa1
where lifnr eq wa_ekko-lifnr.
endif.
endform. " GET_DATA_FROM_LFA1
&----
*& Form GET_DATA_FROM_EKKO
&----
form get_data_from_ekko .
select single ebeln
bukrs
bstyp
bsart
aedat
ernam
lifnr
from ekko
into wa_ekko
where ebeln eq p_ebeln.
endform. " GET_DATA_FROM_EKKO
&----
*& Form GET_DATA_FROM_EKPO
&----
form get_data_from_ekpo .
if not wa_ekko is initial.
select ebeln
ebelp
aedat
matnr
bukrs
matkl
from ekpo into corresponding fields of table it_ekpo
where ebeln = wa_ekko-ebeln.
endif.
endform. " GET_DATA_FROM_EKPO
‎2008 May 13 8:24 AM
Hi,
SMARTFORM <----
> Function Module
For Every smartform,There is one Function Module (se37),.This FM, is GENERATED DYNAMICALLY,and the name is also dynamic. IT MEANS, that the FM name will Be DIFFERENT.in DEV, QA and PRD Server.Hence, we CANNOT HARDCODE the fm name.So, to fetch the FM name, given the smartform name,
this fm SSF_FUNCTION_MODULE_NAME is used. After that, we call the FM dynamically,with some specified/pre-defined format
Check this link.I am expalining here how to use this function module.
https://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=36109&version=2
Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
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
GS_MKPF = INT_MKPF
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.
Regards,
Raj.