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

Select option as parameter in FM.

Former Member
0 Likes
3,684

Ho to pass select options as a parameters in function module.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,625

Ho to pass select options as a parameters in function module.

Hi,

If you know that only one or limited entires are there from the select-option, then pass all the select-option-low ( & select-option -high if it has ) then pass it as either using import or changing parameter. If the values in select-option are keep on changing then u can go with the above reply

Ho to pass select options as a parameters in function module.

10 REPLIES 10
Read only

bpawanchand
Active Contributor
0 Likes
1,625

Hi

You can use RANGES.

Regards

Pavan

Read only

0 Likes
1,625

how can i use?

Read only

0 Likes
1,625

Suppose s_matnr is your select option then u can pass

s_matnr-low and s_matnr-high (whichever you want) directly to the FM.

If you hav a list of selections then

Loop at s_matnr.

call fm<>

import

var = s_matnr-low

.

endloop.

Hope this helps!

Regards,

Prashant

Read only

0 Likes
1,625

hi

as per your query i can interpret that u need to pass your select option values into FM

for thhis firstly declare a variale or workarea or table as if type of FM parameter

now pass your select option value into it now pass that parameter to FM

hope it works

~hitesh

Read only

0 Likes
1,625

Hi

Do in the following way.

TABLES: mara.

DATA: r_matnr TYPE RANGE OF mara-matnr WITH HEADER LINE.

SELECT-OPTIONS s_matnr FOR mara-matnr.

LOOP AT s_matnr.
  MOVE-CORRESPONDING s_matnr TO r_matnr.
  APPEND r_matnr.
ENDLOOP.

CALL FUNCTION 'ZABC'
IMPORTING
  I_RANGE = R_MATNR
EXPORTING
  "....
.

In Function Module.

Pass the table R_MATNR & Declare the range in FM as below.

I_RANGE TYPE RSDSSELOPT

Read only

Former Member
0 Likes
1,625

Hi,

Just declare selection screen parameter match with Function module parameter and Give in Th FM.

Regards

JAna

Read only

Former Member
0 Likes
1,625

Hi,

I hope the below links can help you.

Thanks,

Khushboo.

Read only

Former Member
0 Likes
1,625

There are ways to do it...

In the Function module using the Table parameter you can do it.

Have a table parameter to hold the select option , Don't type refer to any DDIC structure or field.

In the implementation of the function module you can do some thing like this,.

"example you want to pass matnr select option

data: r_selopt type range of matnr.

data: wa_opt like line of r_selopt.

r_selopt = table_param[].

in the call function side you pass the select option directly to the table parameter directly.

call function 'ZTEST_FUNCTION_SLECTOPTION'
tables
 table_param = s_matnr.

Read only

Former Member
0 Likes
1,625

Hi

If you use IN operator the check is considered as select-option variable/table, so declare a ranges table type and use this in your program and for the function module also as a table parameter. assign the selection-option to table parameter.

Read only

Former Member
0 Likes
1,626

Ho to pass select options as a parameters in function module.

Hi,

If you know that only one or limited entires are there from the select-option, then pass all the select-option-low ( & select-option -high if it has ) then pass it as either using import or changing parameter. If the values in select-option are keep on changing then u can go with the above reply