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: 

select options in function module

Former Member
0 Kudos
322

i am using the functionality of select-options in function module

but unlike reports if i leave it blank rather than selecting all the data it comes blank.

how can i do that

my select query has 9 selection criteria and user may enter one two or three as per his need.

in that case the output comes out to be blank.

i checked even in forum but i could not get the answer

how this can be resolved

6 REPLIES 6

Former Member
0 Kudos
98

Hi,

You will have to define ranges in the function module corresponding to the select-options and use it in the select query in the function module.

Regards,

Vikranth

Former Member
0 Kudos
98

use range.

ranges : r1 for gs_itab-field1.

you can use this range in select statement,

you can also do this

r1-sign = 'I'.
r1-options = 'CP'.
r1-low= '*'.
append r1.

this way it will fetch all.

0 Kudos
98

As an addition: No longer use the RANGES statement in ABAP. It's obsolete and on top of that you can't use it in classes. So better get rid of it.

former_member404244
Active Contributor
0 Kudos
98

Hi,

first make the select options as optional in the import paramters of the function module.

i am giving an example

MATNR TYPE RSELOPTION. <IN THE IMPORT PARAMTER>

NOW in the source code write as

SELECT * FROM mara INTO TABLE itab WHERE matnr IN matnr.

it will work.

Regards,

Nagaraj

venkat_o
Active Contributor
0 Kudos
98

Hi , Try this way.


DATA:s_matnr TYPE RANGE OF mara-matnr.
TABLES mara.
SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.
Thanks Venkat.O

kesavadas_thekkillath
Active Contributor
0 Kudos
98

link:[http://www.sdn.sap.com/irj/scn/advancedsearch;jsessionid=(J2EE3417500)ID0784339150DB02204806096016329031End?query=functionmoduleselect+options]