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

Former Member
0 Likes
2,971

Hi,

Can anyone please tell me how should we use the select--options in the selection screen.

1. How to put it in the slection screen

2. How should I get the values from the select option in the program to process it.

Thanks..

Swetha.

5 REPLIES 5
Read only

Former Member
0 Likes
2,691

Hi Swetha,

SELECT-OPTIONS are used for the range selection from selection screen.

SYNTAX:

Select-options: s_vbeln for vbak-vbeln no-extension no intervals.

The Field Declared with SELECT-OPTIONS is an Internal TABLE having 4 Fields:

1. LOW - Low Value

2. HIGH - High Value

3. SIGN - Sign is always I (for Include) or E (for Exclude)

4. OPTION - EQ (Equal)

BT (Between))

CP (Contain Pattern)

Eg:

If we want to get Flight Details from Table SFLIGHT having a particular CARRID, then we go for PARAMETERS.

and If we want Details of More then 1 Flight, then we can use SELECT-OPTIONS.

Refer Below Code:

TABLES:
  SLFIGHT.

DATA:
  t_sflight TYPEE TABLE OF SFLIGHT.

SELECT-OPTIONS:
  s_carrid FOR sflight-carrid.

SELECT *
  FROM SFLIGHT
  INTO TABLE t_sflight
 WHERE carrid IN s_carrid.

LOOP AT t_sflight INTO sflight.
  write:
    / sflight-carrid.
ENDLOOP.

Regards,

Sunil.

Read only

Former Member
0 Likes
2,691

You just have to declare the select option.

SELECT-OPTIONS : s_invprg FOR impr-prnam.

then use it in your selects.

SELECT prnam

gjahr

post1

INTO TABLE i_imtt

FROM imtt

WHERE spras EQ sy-langu

AND prnam IN s_invprg

AND gjahr IN s_fiscal.

Read only

Former Member
0 Likes
2,691

You can use select options in the following way :


Select-Options s_kunnr for kna1-kunnr.

or 

Select-Options s_kunnr for kna1-kunnr Obligatory.
*This will make the field to mandatory.

Reward If found helpful

Read only

Former Member
0 Likes
2,691

Please check tcode - abapdocu, will provide all abap statement example report.

For Select-option please report -

DEMO_SEL_SCREEN_SELECT_OPTIONS.

Read only

Former Member
0 Likes
2,691

A simple example...

TABLES: SKB1

SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_saknr FOR skb1-saknr MEMORY ID sak.
SELECTION-SCREEN END OF BLOCK block2.


START-OF-SELECTION.

IF NOT S_SAKNR[] IS INITIAL. 
SELECT BUKRS SAKNR
	INTO TABLE GT_SAKNR
	FROM SKB1
	WHERE BUKRS EQ P_BUKRS
	AND SAKNR IN S_SAKNR.
IF SY-SUBRC EQ 0.
*------------------Process the data here
ENDIF.

ENDIF.

Thanks,

SKJ