cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms

former_member212002
Active Contributor
0 Kudos

Hello Experts,

I have created a smartform with name zform_1 and code for the same looks something like this,


REPORT  ZFORM_1.

DATA FNAM TYPE rs38l_fnam.
DATA : DATE LIKE  SY-DATUM VALUE 'SY-DATUM',
       TCODE LIKE SY-TCODE VALUE 'SY-TCODE'.

 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     FORMNAME                 = 'ZFORM_1'
*    VARIANT                  = ' '
*    DIRECT_CALL              = ' '
*  IMPORTING
    FM_NAME                  = FNAM
  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.

Now my problem is when i try to call the fm 'fnam' it says it is not available.when i replaced 'fnam' with system generated function module then i got a runtime error say the parameter 'fm_name' is not defined.

what can i do to solve this problem.Any kind of help or suggestion will be appreciated.

Regards

Abhinab

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I think the FNAM function module is not placed. Place the following code.

CALL FUNCTION fnam

EXPORTING

......

.....

.....

IMPORTING

......

.....

.....

TABLES

......

.....

.....

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

Regards

Srini

Former Member
0 Kudos

Hi,

After u activating the form goto

---> Environment - Function module name

it will display popup with function module name that means it will generate a function module for that form . if u want to check that function module double click on that FM u can check . Now u can follow the driver progran.

SantoshKallem
Active Contributor
0 Kudos

DATA: FNAME TYPE RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZFORM'
 IMPORTING
   FM_NAME                  = FNAM
 EXCEPTIONS
   NO_FORM                  = 1
   NO_FUNCTION_MODULE       = 2
   OTHERS                   = 3
          .
CALL FUNCTION FNAM --> to get use u r generated function module and replace with fnam) given paramenters depends on func mod.
EXPORTING
    archive_index                  = toa_dara
    archive_parameters         = arc_params
    control_parameters         = ls_control_param
    output_options               = ls_composer_param
    user_settings                = space
    i_nast                           = nast
    PUR_OR                       = PURCHASE_ORDER
    CURRENCY                   = CURRENCY
 IMPORTING
   JOB_OUTPUT_INFO            = my_output_info
  TABLES
    ITAB1                      = IT_EKPO
 EXCEPTIONS
   FORMATTING_ERROR           = 1
   INTERNAL_ERROR             = 2
   SEND_ERROR                 = 3
   USER_CANCELED              = 4
   OTHERS                     = 5

Regards,

santosh

Former Member
0 Kudos

hi,

please follow the following steps.

1. Goto SMARTFORMS transaction and give the form name and press execute button.

2. SE37 window will be dipslayed with FM name EX: /1BCDWB/SF00000109

3. Copy the Fm name and Go to the report when you want to call the smartfrom and Using Patters(Ctrl+F6) button call the FM by pasting the copied name.

4. now replace the FM /1BCDWB/SF00000109 with FNAM.

former_member212002
Active Contributor
0 Kudos

Hii Avinash,

Ur suggestion is generating a run time error in my system, saying tht the parameter fm_name is not defined.

Regards

Abhinab

former_member212002
Active Contributor
0 Kudos

Thanks to all of u for ur valuable suggestion.

but their was a silly mistake in the code tht the importing was commented.

Regards

Abhinab Mishra

Former Member
0 Kudos

Hi

Can you attach the smartform generated Fm also here...??

Vishwa.

former_member212002
Active Contributor
0 Kudos

HIi Vishwa,

The code looks something like this while using the system generated function module.



REPORT  ZFORM_1.

DATA /1BCDWB/SF00000022 TYPE rs38l_fnam.
DATA : DATE LIKE  SY-DATUM VALUE 'SY-DATUM',
       TCODE LIKE SY-TCODE VALUE 'SY-TCODE'.

 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     FORMNAME                 = 'ZFORM_1'
*    VARIANT                  = ' '
*    DIRECT_CALL              = ' '
*  IMPORTING
    FM_NAME                  = /1BCDWB/SF00000022
  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 '/1BCDWB/SF00000022'
   EXPORTING
*    ARCHIVE_INDEX              =
*    ARCHIVE_INDEX_TAB          =
*    ARCHIVE_PARAMETERS         =
*    CONTROL_PARAMETERS         =
*    MAIL_APPL_OBJ              =
*    MAIL_RECIPIENT             =
*    MAIL_SENDER                =
*    OUTPUT_OPTIONS             =
*    USER_SETTINGS              = 'X'
     MYDATE                     = date
     TCODE                      = tcode.
*  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.