‎2008 May 02 3:38 PM
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.
‎2008 May 02 3:39 PM
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.
‎2008 May 02 3:41 PM
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.
‎2008 May 02 3:43 PM
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
‎2008 May 02 3:45 PM
Please check tcode - abapdocu, will provide all abap statement example report.
For Select-option please report -
DEMO_SEL_SCREEN_SELECT_OPTIONS.
‎2008 May 02 3:45 PM
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