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 use the function module ....

Former Member
0 Likes
827

hi

how to use the function module ssf_function_module_name in smartforms

3 REPLIES 3
Read only

Former Member
0 Likes
544

Hi..

If you are using this Function module, you can get the generated function module name of smartform dynamically. It is good progrmaming practice to get the fucntion module name dynamically because there might be some problems if you are hard coding in program.

This will return the name of the function module and then from the exporting parameters you can use the fucntion module name to pass parameters to Smartforms.

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

  • http://sapr3.tripod.com

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.

<b>Reward points if useful</b>

Regards

Ashu

Read only

Former Member
0 Likes
544

Hi ,

when evr u creeate a Smartform , it will generate a Function Module which is Dynamic, i.e in ur Dev system , it will generate a FM (say FM1 for ex) , wen u login to other system ( Quality/Prod) and activate it will generate another FM (say FM2 ) .

( as the FM changes from system to sytem , u shud never hard code the FM namein ur Driver Program)

For ur question, --> First Get the FM name (ex : FM_TEST is system generated one) , then

Call Function 'ssf_function_module_name '

Export

Form name = 'YFORM'---> form name

IMport

FMNAME= l_FM---> variable holding Function module name.

Call Function 'FM_TEST'

import

..

..

..export

After this Just Just replace the 'FM_TEST' with l_FM.

Hope this is clear.

Revert back if any issues,

Reward with points if helpful.

Regards,

Naveen

Read only

Former Member
0 Likes
544

HI,,

&----


*& Report ZASHUFORM

*&

&----


*&

*&

&----


REPORT ZASHUFORM.

DATA FNAME LIKE RS38L-NAME.

DATA ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.

SELECT *

UP TO 400 ROWS

FROM MARA

INTO TABLE ITAB.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZASHUFORM' <b>"form name</b>

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FNAME <b>'" variable for fm name</b>

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 FNAME

  • EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS = wa_ctrlop

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

  • OUTPUT_OPTIONS = wa_outopt

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO = t_otfdata

    • JOB_OUTPUT_INFO =

    • JOB_OUTPUT_OPTIONS =

TABLES

ITAB = ITAB

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.

<b>Rewards points</b>