Application Development 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: 

smartform

Former Member
0 Kudos
178

Hin Friends,

Suppose i created a snartform and activated it. It generayes a FM. Then in the print pgm i will call this FM .Suppose if i transport this smartform and pgm into quality or production server and exicute it, it will re generate Fm. Then the same FM which have called in development server works or it will generate another FM in production server?

Thanks in Advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
154

HI

It will generate separate FM name. so instead of hardcoding the FM name in the print program you can use the FM

<b>DATA: FM_NAME TYPE RS38L_FNAM.</b>

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTKISH'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

to retrieve the FM name in the variable FM_NAME call it using

<b>call function FM_NAME</b>

  • 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

ITAB1 = <internal table name>

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

regards

kishore

please close one of the thread.

Message was edited by: Harikishore Sreenivasulu

10 REPLIES 10

Former Member
0 Kudos
155

HI

It will generate separate FM name. so instead of hardcoding the FM name in the print program you can use the FM

<b>DATA: FM_NAME TYPE RS38L_FNAM.</b>

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTKISH'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

to retrieve the FM name in the variable FM_NAME call it using

<b>call function FM_NAME</b>

  • 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

ITAB1 = <internal table name>

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

regards

kishore

please close one of the thread.

Message was edited by: Harikishore Sreenivasulu

0 Kudos
154

the fm FM_NAME should be called by clicking pattern in se 38 screen ...how to call it?

0 Kudos
154

Hi Jak,

when you activate the Smartform it will give the fm , take that ,giveit in pattern, and it will give all parameters required.

and later replace with variable, from the ssf function module.

*-Function Module  /1BCDWB/SF00000027
        CALL FUNCTION v_function_module
          EXPORTING
            control_parameters = ds_control
            output_options     = ds_print_opt
            user_settings      = space
            i_supp             = x_logo
            i_last_pg          = v_last_pg
            i_tknum            = vbco3-tknum
            i_vsart            = v_vsart
            i_sammg            = v_sammg
          TABLES
            it_item            = it_item
            it_sales           = it_sales1
            it_total           = it_total2                  "it_total1
            it_summary         = it_summary
            it_header          = it_hdr1
            it_ship_header     = it_ship_header
          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

vijay

0 Kudos
154

Hi JAk

you can call it directly by

call function fm_name

i have given the code in the first reply

regards

kishore

former_member188685
Active Contributor
0 Kudos
154

Hi,

it will generate new one,

*-Print the form using smartforms
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZTEST'
    IMPORTING
      fm_name            = v_function_module
    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 v_function_module
          EXPORTING
            control_parameters = ds_control
            output_options     = ds_print_opt
            user_settings      = space
            i_supp             = x_logo
            i_last_pg          = v_last_pg
            i_tknum            = vbco3-tknum
            i_vsart            = v_vsart
            i_sammg            = v_sammg
          TABLES
            it_item            = it_item
            it_sales           = it_sales1
            it_total           = it_total2                  "it_total1
            it_summary         = it_summary
            it_header          = it_hdr1
            it_ship_header     = it_ship_header
          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.

so it will take care of the generated one.

regards

vijay

0 Kudos
154

How to call this V_Functionmodule?...by clicking on Pattern?

0 Kudos
154

Hi,

After the FM is generated,copy the name of FM generated.

Then in your ABAP Program,in pattern,paste the FM name you copied from SE37.

Then it will list all the export,import and Table parameters.

After that just replace the FM name by V_Functionmodule as explained already in the example.

KIndly reward points if it helps.

0 Kudos
154

Hi Vijay,

I have done as you told.First i hard coded the FM and called.Then i replaced that FM with variable.But i am getting Short dump at call function statement: Call Function FM_NAME.

Here is my code:

REPORT ZTES5 .

tables: vbak,vbap.

data: begin of i_sales occurs 0,

vbeln like vbak-vbeln,

ekorg like vbak-vkorg,

kunnr like vbak-kunnr,

matnr like vbap-matnr,

end of i_sales.

DATA: FM_NAME type RS38L_FNAM.

*selection-screen

selection-screen begin of block b1 with frame title text-001.

select-options: s_vbeln for vbak-vbeln.

selection-screen end of block b1.

perform get_data.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ztestform'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

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'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

i_sales = i_sales

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 get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data .

select avbeln avkorg akunnr bmatnr into table i_sales from

vbak as a inner join vbap as b on avbeln = bvbeln where a~vbeln in

s_vbeln.

endform. " get_data

0 Kudos
154

Hi,

obviously you will get dump, if you don't pass the parameters properly to the FM.

check what you required and what not..

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
i_sales = i_sales
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5

regards

vijay

0 Kudos
154

thanks friends....working now