Have a Question on smartforms

I have a question on smartforms, I managed to create one and generated the function module but now when I call the function module of the form in my report I get an error. Please advise on what to do.
The code below that I am using.

Rajasekhar Kammili

*&---------------------------------------------------------------------*
*& Report  YZDS_SMARTFORM_1                         
*&---------------------------------------------------------------------*

REPORT  YZDS_SMARTFORM_1                        .
 
 
Tables: bkpf, bseg.
 
*----------------------------------------------------------------------
*Internal Tables to be used.
*----------------------------------------------------------------------
data: begin of int_table1 occurs 0.
      include structure bkpf.
data: end of int_table1.
 
data: begin of int_table2 occurs 0.
      include structure bseg.
data: end of int_table2.

*----------------------------------------------------------------------
*Selection Options to be used.
*----------------------------------------------------------------------
 
select-op! tions s_belnr for bkpf-belnr memory id 001.
select-options s_bukrs for bkpf-bukrs memory id 002.

select * from bkpf where belnr in s_belnr
                    and  bukrs in s_bukrs.
      move-corresponding bkpf to int_table1.
      append int_table1.
endselect.
 
*----------------------------------------------------------------------
*Calling the funtion module which was generated by the Smartform.
*----------------------------------------------------------------------
Call function 'SSF_FUNCTION_MODULE_NAME'
 Exporting
     formname = 'yzds_zsmart'
 Importing
     fm_name  = '/1BCDWB/SF00000002'
 Exceptions
     no_form            = 1
     no_function_module = 2
     others             = 3.
 
 if sy-sbrc <> 0.
   write :? 'ERROR ERROR'.
 endif.
 
 
 
Call funtcion fm_name
 tables
       l_bkpf    = int_table1
 Exceptions
       formatting_error  = 1
       internal_error    = 2
       send_error        = 3
       user_cancelled    = 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.
--------------------------------------------------

Try to avoid hard coding the function module (SSF_FUNCTION_MODULE_NAME)  - importing parameter,
instead declare a variable and then pass that value to that next calling function module .
Take a look at the code...below

Lokesh

data: fm_name type rs38l_fnam,

Call function 'SSF_FUNCTION_MODULE_NAME'
 Exporting
     formname = 'yzds_zsmart'
 Importing
     fm_name  = fm_name 
 Exceptions
     no_form            = 1
     no_function_module = 2
     others             = 3.
 
if sy-sbrc <> 0.
   write :? 'ERROR ERROR'.
 endif.
 
 
Call funtcion fm_name
 tables
       l_bkpf    = int_table1
 Exceptions
       formatting_error  = 1
       internal_error    = 2
       send_error        = 3
       user_cancelled    = 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.

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.