2013 Apr 29 1:46 PM
Hello ABAPer,
I am practicing SMARTFORMS. I created SF now i want to call it so i use FM SSF_FUNCTIONA_MODULE_NAME as shown below, I can reach upto selection screen but nothing happening after that point, not getting output. plz explain me why ? how can i get output ? I think FM_NAME has some thing to do this. IF YES plz explain in detail y we use FM_NAME & if no need to use FM_NAME then how i can get output.
TABLES : MARA.
DATA : ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS : MATERIAL FOR MARA-MATNR.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR IN MATERIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSFORM_HAPPY'
* VARIANT = ' '
* DIRECT_CALL = ' '
* IMPORTING
* FM_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.
2013 Apr 29 2:07 PM
2013 Apr 29 2:48 PM
2013 Apr 29 2:49 PM
Have a look at program RLB_INVOICE which is driver for creating invoices. It shows very well how to use the FMs.
Regards
Clemens
2013 Apr 29 3:13 PM
Hi,
Get the FM_NAME and then call the function module FM_Name.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSFORM_HAPPY'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
Call function FM_NAME.
2013 Apr 29 3:17 PM
Hello.
There is a lot of information on the web how to print smartforms.
Have a look this post
http://www.erpgreat.com/smartforms/smartform-tutorial.htm
In addition, ur code is missing a lot, the FM SSF_FUNCTION_MODULE_NAME is missing the parameter FM_NAME and the the calling of FM_NAME function.
Search info
Regards
Miguel
2013 Apr 29 4:51 PM
FM is missing Former Member
lot of things missed in your code cross check once again
i think you should understand how the Smart forms function module is working in SAP.
please see the below link for your reference.
http://help.sap.com/saphelp_46c/helpdata/en/4b/83fb42df8f11d3969700a0c930660b/frameset.htm
http://www.erpgreat.com/smartforms/smart-006.htm
For easy tutorial there are so many links are there in Google .just check it
Regards,
Bastin.G
2013 Apr 29 6:18 PM
Hi All,
Thanks you all i will certainly try all of ur suggestion, but before that i just want to know
1 ) what is the difference between Function module FM_NAME and FNAME
2) As in report we check the performance, we can debug report....how we can debug the SF and how we heck SF performance.
--------------------------------------------------------------------------------------------------------------
CALL FUNCTION FM_NAME
TABLES
I_ZCUST = I_ZCUST
I_ZTRANSACTIONS = I_ZTRANSACTIONS
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.
ENDFORM.
-------------------------------------------------------------------------------
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.
---------------------------------------------------------------------------------------------------------------
Thanks
Happy
2013 Apr 29 10:05 PM
To answer your two questions:
Hope this helps!
Eric
2013 Apr 30 6:01 AM
Hi Happy,
Whenever you create and activate a smartform, it will automatically generate a Function Module in the background. This function module name depends on the SAP Client on which we run the form.
So the FM name may be different for different systems for the same smartform. Since this is internally generated, so we need to call the FM "SSF_FUNCTION_MODULE_NAME" in order to get this function module (Importing paramerer FM_NAME). Then we call FM_NAME in our program. This will actually execute the smartform.
If you need to debug a smartform Just do the following steps and you will be there in the ABAP debugger for the form:
1) T-code SMARTFORMS->Give the form name and press display button.
2) Menu->Environment->Function Module name.
3) Copy the FM name and open it in SE37.
4) Search for the perform "GLOBAL_INIT". This perform includes all the codes that you had written in the smartform.
5) You can put session break point anywhere in this perform.
6) Now execute the form and you will be inside debugger.
Hope this will help you.
2013 Apr 29 7:57 PM
Happy,
You're almost there, you just need to call a second FM. The FM 'SSF_FUNCTION_MODULE_NAME' does not print the smartform. It returns the name of the FM that will print the smartform, data type rs381_fnam. There is no difference between FM_NAME or FNAME, you can call the variable whatever you want.
Try this code:
TABLES : MARA.
DATA : ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
* Add this variable, it's the name of the FM to call
DATA: G_FM_NAME TYPE RS381_FNAM.
SELECT-OPTIONS : MATERIAL FOR MARA-MATNR.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR IN MATERIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSFORM_HAPPY'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = G_FM_NAME "Make sure and uncomment this!
* 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.
*This is the Second FM Call
CALL FUNCTION G_FM_NAME
EXPORTING "Add the parameters of your smartform here
TABLES "Add table parameters if you have them
* EXCEPTIONS "Add exceptions if you want
.
This will print the smartform.
Best,
Eric
2013 Apr 30 5:16 AM
Hi Happy,
After calling the ssf_function_module_name, it will return you the actual function module to be called for printing the smartform and then call that function module. since you are in learning stage your question should have been why need to call the ssf_function_module_name...................following is something a collected for you.
Whenever a Smart Form is generated, a function module is generated and the naming convention for that Smart Form is done internally by using Number range object or something similar. In the above case, the function module name is /1BCDWB/SF00000359. The function module for the next new and activated Smart Form would be /1BCDWB/SF00000360.
So when this Smart Form is transported from the development to Quality or Production system, a new function module name is generated according to the number series available in that system. If the above program is transported to either quality or production system, the program might go for a dump as the function module is not available in that system. To handle this situation, we use the function module SSF_FUNCTION_MODULE_NAME to get the name of the function module for a Smart Form dynamically. If the form is not active, the function module SSF_FUNCTION_MODULE_NAME raises the exception NO_FORM.
thanks and regards,
narayan
2013 Apr 30 7:05 AM
First read carefully some help.sap.com documentation like Integrating the Smart Form into the Application
Regards,
Raymond
2013 Apr 30 7:57 AM
Hello Happy,
In the function module...
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSFORM_HAPPY'
* VARIANT = ' '
* DIRECT_CALL = ' '
* IMPORTING
* FM_NAME =
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3.
In this function module first pass the variable in the Importing section by name FM_Name.
when you pass the variable in this FM_NAME. your smartform function module name will be copied in the Variable.
When it is copied in the variable. Then call function module like this.
suppose your variable name is fmname.
call function fmname
export
-----
import
--------
like this you have to call your smartform with fmname.
and also one more important this.
when you are carring values to smartform from driver program . You have to declare the variables which are coming from the driver program in the Form Interface of the smartform...
by that you can see the desire output...
This is how we can call the smartform and see the output.
If you are having any doubts or any questions regarding this post please let me know...
Thanks,
vijay
2013 Apr 30 8:35 AM
HI All,
Thanks u all for ur reply now i am clear with this concept, I tried above code however i faced two problem 1) i get an error TYPE RS381_FNAM doesn't exist and FM FM_NAME doesn't exist. so just want to know do i need to create this or its in build in SAP. I am practicing in IDES.
2013 Apr 30 10:09 AM
2013 Apr 30 3:27 PM
HI Namrata,
Thanks for reply ur suggestion resolve my 1st query plz help me out with 2nd query which is when i call FM FM FM_NAME it give me an error FM_NAME doesn't exist. so just want to know do i need to create this or its in build in SAP. I am practicing in IDES.
2013 May 01 1:03 AM
*&--------------------------------------------------------------*
*& Report Z_CALL_SMARTFORM *
*& Sample Function calls ZSMARTFORMS_SALES_DOCUMENTS smartform *
*&--------------------------------------------------------------*
Hi,
Check the following code.
REPORT Z_CALL_SMARTFORM.
DATA :
fm_name TYPE rs38l_fnam,
it_vbak TYPE TABLE OF vbak.
SELECT * FROM vbak into TABLE it_vbak
WHERE vbeln GE '0100000004'
AND vbeln LE '0100000010'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORMS_SALES_DOCUMENTS'
IMPORTING
FM_NAME = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
CALL FUNCTION fm_name
TABLES
it_vbak = it_vbak
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
If this does not work. Please post your code.
Cheers,
Arindam
2013 May 02 6:06 AM
Hi Happy,
You need to declare the FM_NAME i.e FM_NAME type RS38L_FNAM. You have to replace the generated function module by FM_NAME.
I hope this will help you.Please let me know if anything is required.
Thanks,
Namrata.
2013 May 01 6:54 AM
Dear,
please call samrtforms functional mudule after SSF_FUNCTION_MODULE_NAME.
2013 May 01 8:00 AM
Hi Happy,
Following is the driver program, you will understand the basics after this. If any issues, do let me know.
*&---------------------------------------------------------------------*
*& Report ZGB_RFQ
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZGB_RFQ.
tables: lfa1, "vendor master(general section)
ekko, "purchasing document header
ekpo, "purchasing document item
t001, "company codes
eket. "Scheduling Agreement Schedule Lines
PARAMETERS: p_rfq type ekpo-ebeln. "rfq number
* p_acc type lfa1-lifnr. "vendor account number
*-------------------------------------------*
" Name of the Function Module
*"--------------------------------------------------------------------*
DATA :
fm_name TYPE rs38l_fnam.
types: begin of ty_ekpo, "purchasing document item
ebeln type ekpo-ebeln, "purchasing document no.
ebelp type ekpo-ebelp, "purchasing item no.
ematn TYPE ekpo-ematn, "material number
ktmng type ekpo-ktmng, "changed from ekpo-menge
txz01 type ekpo-txz01, "short text
bukrs type ekpo-bukrs, "company code
END OF ty_ekpo.
types: BEGIN OF ty_lfa1, "vendor master (general section)
lifnr TYPE lfa1-lifnr, "vendor no.
name1 type lfa1-name1, "name1
stras type lfa1-stras, "house no. and street
ort01 type lfa1-ort01, "city
pstlz type lfa1-pstlz, "po box postal code
END OF ty_lfa1.
types: BEGIN OF ty_ekko, "puchasing document header
ebeln TYPE ekko-ebeln, "purchasing document no.
lifnr type ekko-lifnr,
aedat type ekko-aedat, "date on which record was created
END OF ty_ekko.
types: BEGIN OF ty_t001, "company codes
bukrs type t001-bukrs, "comapany code
butxt type t001-butxt, "name of the company code or comapany
END OF ty_t001.
types: begin of ty_eket, "Scheduling Agreement Schedule Lines
ebeln type eket-ebeln, "purchasing document no.
ebelp type eket-ebeln, "purchasing item no.
eindt type eket-eindt, "item delivery date
END OF ty_eket.
TYPES: begin OF ty_final,
name1 type lfa1-name1,
stras type lfa1-stras,
ort01 TYPE lfa1-ort01,
pstlz TYPE lfa1-pstlz,
lifnr TYPE lfa1-lifnr,
butxt TYPE t001-butxt,
aedat type ekko-aedat,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
ematn TYPE ekpo-ematn,
ktmng TYPE ekpo-ktmng,
txz01 type ekpo-txz01,
lfdat TYPE eban-lfdat,
bukrs type ekpo-bukrs,
eindt type eket-eindt,
END OF ty_final.
data: it_ekko type TABLE OF ty_ekko,
it_ekpo TYPE TABLE OF ty_ekpo,
it_lfa1 TYPE TABLE OF ty_lfa1,
it_t001 type table of ty_t001,
it_eket type table of ty_eket,
it_final TYPE TABLE OF ty_final.
data: wa_EKKO type ty_ekko,
wa_ekpo type ty_ekpo,
wa_lfa1 TYPE ty_lfa1,
wa_t001 type ty_t001,
wa_eket type ty_eket,
wa_final type ty_final.
*BREAK-POINT.
SELECT ebeln ebelp ematn ktmng txz01 bukrs
from ekpo
INTO TABLE it_ekpo
WHERE ebeln = p_rfq.
If sy-subrc <> 0.
message 'Invalid RFQ Number' type 'E'.
endif.
If not it_ekpo is INITIAL.
select ebeln lifnr aedat from ekko
into table it_ekko
FOR ALL ENTRIES IN it_ekpo
where ebeln = it_ekpo-ebeln.
select lifnr name1 stras ort01 pstlz
from lfa1 into table it_lfa1
FOR ALL ENTRIES IN it_ekko
where lifnr = it_ekko-lifnr.
select bukrs butxt
from t001
into TABLE it_t001
for all entries in it_ekpo
where bukrs = it_ekpo-bukrs.
select ebeln ebelp eindt
from eket
into table it_eket
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and ebelp = it_ekpo-ebelp.
ENDIF.
LOOP AT it_EKPO INTO wa_EKPO.
move-corresponding wa_ekpo to wa_final.
READ TABLE it_ekko INTO wa_ekko WITH KEY ebeln = wa_ekpo-ebeln.
move-corresponding wa_ekko to wa_final.
READ TABLE it_t001 into wa_t001 with key bukrs = wa_ekpo-bukrs.
move-corresponding wa_t001 to wa_final.
read table it_eket into wa_eket with key ebeln = wa_ekpo-ebeln ebelp = wa_ekpo-ebelp.
move-corresponding wa_eket to wa_final.
READ TABLE it_lfa1 INTO wa_lfa1 with KEY lifnr = wa_ekko-lifnr.
MOVE-CORRESPONDING wa_lfa1 to wa_final.
append wa_final to it_final.
clear wa_final.
endloop.
* endloop.
*
*loop at it_final into wa_final.
* write:/ wa_final-name1, wa_final-stras,
* wa_final-ort01,
* wa_final-pstlz,
* wa_final-lifnr,7
* wa_final-butxt,
* wa_final-aedat,
* wa_final-ematn,
* wa_final-ktmng,
* wa_final-txz01,
* wa_final-eindt.
* endloop.
**
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSF_GB_RFQ'
IMPORTING
fm_name = fm_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.
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'
it_final = it_final
* 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.
Regards
Purnand
2013 May 01 8:19 AM