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: 

How to pass value in FM?

Former Member
0 Kudos
552

Hi,

I want to know how to pass values of a particular SELECT-OPTIONS into an Function module.

for e.g. : SELECT-OPTIONS :S_TCODE FOR TSTC-TCODE OBLIGATORY.

Now, here i want to pass value of S_TCODE into a functtion module.

Pls help me with this.

Thanks.

Regards.

3 REPLIES 3

Former Member
0 Kudos
271

Hi

U can create an TABLES parameter without reference in your function module:

CALL FUNCTION 'Z_MY_FUNCTION'

...................................

TABLES

SEL = S_TCODE[].

Max

Former Member
0 Kudos
271

if function module has input table then u can pass s_matnr directly to table and u can execute the FM for getting the output.

if function module doesnot have a table but a field then

loop at s_matnr.

call the FM which will return the value.

append this value to internal table.

endloop.

use the internal table for processing.

Former Member
0 Kudos
271

Hi Rahul,

Tables passed using TABLES parameters in a FM have a default header line. Using header lines is obsolete in the context of ABAP Objects. So try to avoid using TABLES parameters in FM (and elsewhere e.g. in FORM routines). TABLES statement is already an obsolete statement now in the same context.

You may use the CHANGING parameters for passing this select-options. You may create a Table Type in the ABAP Dictionary that will look like similar to your select-options selection table. Make use of S_SIGN and S_OPTION data elements. .

Alternatively, you may define an internal table type using TYPE GROUP radiobutton in the ABAP Dictionary. You need to include this type group using TYPE-POOLS statement in the global data of the function group in which your FM exists.

Now, on the FM Changing tab, define the table parameter and refer to this table type using TYPE reference.

Hope this helps.

Thanks

Sanjeev