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: 

Error when calling function module...

aris_hidalgo
Contributor
0 Kudos

Hello Experts,

I keep on getting the same error when I try to call my form. The error

is: 'Incorrect parameter with CALL FUNCTION.' I checked all the variables

and the tables that I pass but it is all correct. I compared it with the other

program that has a very similar logic and also calls the same form. But why is

this one gets an error?

Below is the routine:


PERFORM call_smartform.

FORM call_smartform.
  DATA: lv_control TYPE ssfctrlop,
        lv_options TYPE ssfcompop,
        ld_function TYPE rs38l_fnam.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZFI_UL_INV'
    IMPORTING
      fm_name            = ld_function
    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 ld_function
    EXPORTING
      control_parameters = lv_control
      output_options     = lv_options
      s_belnr            = s_belnr-low
      l_name1            = l_name1
      l_name2            = l_name2
      l_ort01            = l_ort01
      l_pstlz            = l_pstlz
      l_stras            = l_stras
      l_kunnr            = l_kunnr
      l_mwsts            = l_mwsts
      l_fipos            = l_fipos
      l_txbhw            = l_txbhw
      l_total            = l_total
      l_zterm            = l_zterm
      l_augdt            = l_augdt
      l_augcp            = l_augcp
      l_hzuon            = l_hzuon
      l_vertn            = l_vertn
      l_altkt            = l_altkt
    TABLES
      i_bseg             = i_bseg2
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    "call_smartform
Hope you can help me guys. Thank you and take care!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

A Sample Program Calling Smartforms

REPORT  ZTACA_DRIVER_SMARTFORM                  .

Tables : sflight.
Data : fm_name TYPE rs38l_fnam.

*data : Begin of it_flttab occurs 0,
*        carrid type sflight-carrid,
*        connid type sflight-connid,
*        fldate type sflight-fldate,
*        seatsmax type sflight-seatsmax,
*        seatsocc type sflight-seatsocc,
*        End of it_flttab.

data : it_flttab like table  of sflight.
Data : g_salary type i .
*       it_flttab type standard table of ty_flt.
g_salary = 1000.


select carrid connid fldate seatsmax seatsocc from sflight into
corresponding fields of table it_flttab.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZTACA_SMFORM2'
*   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
     salary = g_salary
  TABLES
     it_flttab = it_flttab
  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

Sudheer

6 REPLIES 6

Former Member
0 Kudos

Hi,

A Sample Program Calling Smartforms

REPORT  ZTACA_DRIVER_SMARTFORM                  .

Tables : sflight.
Data : fm_name TYPE rs38l_fnam.

*data : Begin of it_flttab occurs 0,
*        carrid type sflight-carrid,
*        connid type sflight-connid,
*        fldate type sflight-fldate,
*        seatsmax type sflight-seatsmax,
*        seatsocc type sflight-seatsocc,
*        End of it_flttab.

data : it_flttab like table  of sflight.
Data : g_salary type i .
*       it_flttab type standard table of ty_flt.
g_salary = 1000.


select carrid connid fldate seatsmax seatsocc from sflight into
corresponding fields of table it_flttab.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZTACA_SMFORM2'
*   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
     salary = g_salary
  TABLES
     it_flttab = it_flttab
  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

Sudheer

0 Kudos

Hi,

1) Check the TYPE's for each paramter

2) Try commenting one paramter at a time and execute, The paramter after commenting which solves the error is the culprit then you just need to find out the problem with that paramter.

Regards,

Sesh

Former Member
0 Kudos

Hi,

Vijay

Check it is most activated versioon of FM of Smartforms.

Otherwise Activate it again. Whcih will delete the log.

Reward if useful

Former Member
0 Kudos

hi,

U should dynamically declare the function module name.

Former Member
0 Kudos

Hi,

First you should make sure the SSF function interface is correct in your program. The best way to achieve it is:

In the Form Builder go to Environment -> Name of the function module

Copy the name of function module

In your program use 'Insert pattern' with the function name you copied from the smartform

Replace function name copied from the form with the variable ld_function, which holds the function name returned by SSF_FUNCTION_MODULE_NAME.

Make sure that the variables you are passing to the function module are the same type as interface parameters defined in the smartform.

aris_hidalgo
Contributor
0 Kudos

Hello again guys,

Thank you for your replies. The reason why it keeps getting an error is that

I declared a new variable in my smartforms and forgot to tick the 'OPTIONAL'

checkbox so when I call the form, it requires the variable which I forgot to pass.

Again, thank you guys!