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

getting error in the function module

Former Member
0 Likes
3,144

Hi everybody.

I have created one function module in se37 and i am calling that function module in the se38 report, when i am executing the report it is throwing me an error.

here in my report i am having the select option fields ex matnr, in the function module importing i have given the parameter matnr over there and when i am running the report it is through an error that

"The function module interface allows you to specify only

fields of a particular type under "MATNR".

The field "S_MATNR" specified here is a different

field type "

IF i am giving the parameter instead of select-options in the report and executing, then the function module is getting triggered and receiving the data what ever the code is available in the source code.

can anyone help me out in this issue so that i can get the data while using the select-option instead of parameter.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Subhankar
Active Contributor
0 Likes
1,669

Hi,

In your SE38 report, you are taking MATNR as select option. Select option is nothing but a table with four parameter (SIGN OPTION LOW and HIGH).

And in your SE37 FM you are taking MATNR as PARAMETER. That's why this parameter mismatch error is coming. What you can do, instead of importing parameter use table parameter and type of the structure is /CWM/R_MATNR. (Also you can use importing or exporting parameter then you have to create one table TYpes for the structure /CWM/R_MATNR)

Note: When you pass the select option then use [] sign. As select option is a internal table with header line. (like S_MATNT[])

Thanks

Subhankar

6 REPLIES 6
Read only

Former Member
0 Likes
1,669

Hi,

Here is one way to proceed:

1) You have to change the parameter of your FM to match the type of a range table (on matnr)

2) use a internal table of the same type in your calling program, that you fill from your SO before passing it to the FM.

Something like:


DATA: lt_matnr TYPE /limeb/r_matnr, 
      g_matnr TYPE matnr.
SELECT-OPTIONS: so_matnr FOR g_matnr.

lt_matnr[] = so_matnr[].
CALL FUNCTION 'ZGET_MATNR'
  EXPORTING
    s_matnr = lt_matnr.

With the parameter (from FM) s_matnr beeing defined with the same type as internal table lt_matnr.

Kr,

m.

Read only

Subhankar
Active Contributor
0 Likes
1,670

Hi,

In your SE38 report, you are taking MATNR as select option. Select option is nothing but a table with four parameter (SIGN OPTION LOW and HIGH).

And in your SE37 FM you are taking MATNR as PARAMETER. That's why this parameter mismatch error is coming. What you can do, instead of importing parameter use table parameter and type of the structure is /CWM/R_MATNR. (Also you can use importing or exporting parameter then you have to create one table TYpes for the structure /CWM/R_MATNR)

Note: When you pass the select option then use [] sign. As select option is a internal table with header line. (like S_MATNT[])

Thanks

Subhankar

Read only

Former Member
0 Likes
1,669

Hi,

Actually, I wouldn't recommend the use of that tables parameter...

From sap help:

Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.

Exceptions

So i definitely would go with either importing or changing parameter...

Cheers,

m.

Read only

Subhankar
Active Contributor
0 Likes
1,669

Hi Manu,

I know tables parameters is a obsolete statement. That's why given the export import option also

(Also you can use importing or exporting parameter then you have to create one table TYpes for the structure /CWM/R_MATNR)

Regards

Subhankar

Read only

Former Member
0 Likes
1,669

hi Subhankar,

so you mean to say that instead of using the matnr in the parameter, i have to declare the variable in matnr in the tables and the associated type as /CWM/R_MATNR, and mjahr /CWM/R_MJAHR... etc.

Thanks in advance.

Regards

hyder

Read only

Former Member
0 Likes
1,669

thanks got the solution