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

How can i use select-option in function

Former Member
0 Likes
766

Hi guys .
i need to use select option in function.
anyone can give me an example?

Thank you.

Cagri.

1 ACCEPTED SOLUTION
Read only

paul_bakker2
Active Contributor
0 Likes
732

Hi,

  What you need to do is create an input (table) parameter that has a structure containing the fields

SIGN, OPTION, LOW, HIGH.

For example, look at structure LAND_RNG in SE11, which allows you to specify a range of countries.

You might be able to find a standard SAP structure for your requirements, or you may have to build your own.

Once passed in, this range table can be used in SELECT statement just like a select-option.

cheers

Paul

Hi guys .
i need to use select option in function.
anyone can give me an example?

Thank you.

Cagri.

4 REPLIES 4
Read only

Former Member
0 Likes
732

Hi Cagri,

You have 2 options

1)Give 2 fields low & high in import parameters and u can write select in program.

     In where u can write field in between low & high.

2)In tables u can create entries with low high or multiple values and write select on them

    using for all entries.

check http://scn.sap.com/thread/1469311

Read only

Former Member
0 Likes
732

Hi Cagri,

You need to declare an internal table of the same type you created in your program and then append the entries of the select option to this table.Now pass this internal table to your FM.

Thanks,

Namrata

Read only

paul_bakker2
Active Contributor
0 Likes
733

Hi,

  What you need to do is create an input (table) parameter that has a structure containing the fields

SIGN, OPTION, LOW, HIGH.

For example, look at structure LAND_RNG in SE11, which allows you to specify a range of countries.

You might be able to find a standard SAP structure for your requirements, or you may have to build your own.

Once passed in, this range table can be used in SELECT statement just like a select-option.

cheers

Paul

Read only

0 Likes
732

Oh yeah, you asked for an example:

   FUNCTION SD_ROUTE_ALL_NODES.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  TABLES
*"      O_TVROKN STRUCTURE  TVROKN
*"      I_TVRO_RNG STRUCTURE  TVRO_RNG OPTIONAL
*"      I_LAND_RNG STRUCTURE  LAND_RNG OPTIONAL

(...)

    SELECT * FROM TVRAB INTO TABLE XTVRAB            

           WHERE ROUTE IN I_TVRO_RNG ORDER BY ROUTE ANFRF.