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-OPTIONS initialization

Former Member
0 Likes
5,397

HI FRIENDS.

i am working on a SELECT-OPTIONS and in which i need to initialize the same as follows:

10-20 but need to be exclude 11,

20-40 need to exclude 33.

how to initialize the select-option plz provide me the sample code and how to code above logic.

plz help me.

mahesh'

1 ACCEPTED SOLUTION
Read only

pole_li
Active Participant
0 Likes
2,360

Hi,

Try:

suppose s_sel is the select-option

Initialization

s_sel-sign = 'I'.

s_sel-optipn = 'BT'

s_sel-low = '10'.

s_sel-high = '20'.

append s_sel.

s_sel-sign = 'E'.

s_sel-optipn = 'EQ'

s_sel-low = '11'.

append s_sel.

20-40 exclude 33 is the same logic.

Regards,

Pole

Edited by: Pole li on Aug 7, 2008 9:08 AM

9 REPLIES 9
Read only

uwe_schieferstein
Active Contributor
0 Likes
2,360

Hello Mahesh

You can do the initialization as following:



" Define a switch variable
DATA: gd_init   TYPE abap_bool.

AT SELECTION-SCREEN OUTPUT.

" Assures that the initialization happens only once
  IF ( gd_init = abap_false ).
    gd_init = abap_true.

    o_selopt-sign = 'I'.  " include
    o_selopt-option = 'BT'.  " between
    o_selopt-low     = 10.
    o_selopt-high    = 20.
    append o_selopt.

    clear: o_selopt.  " just the header line
    o_selopt-sign = 'E'.  " exclude
    o_selopt-option = 'EQ'.  " equal
    o_selopt-low     = 11.
    append o_selopt.    
  ENDIF.

Regards

Uwe

Read only

pole_li
Active Participant
0 Likes
2,361

Hi,

Try:

suppose s_sel is the select-option

Initialization

s_sel-sign = 'I'.

s_sel-optipn = 'BT'

s_sel-low = '10'.

s_sel-high = '20'.

append s_sel.

s_sel-sign = 'E'.

s_sel-optipn = 'EQ'

s_sel-low = '11'.

append s_sel.

20-40 exclude 33 is the same logic.

Regards,

Pole

Edited by: Pole li on Aug 7, 2008 9:08 AM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,360

Hello,


DATA: L_V_SEL TYPE CHAR2.

SELECT-OPTIONS: S_SEL FOR L_V_SEL.


INITIALIZATION.

  S_SEL-SIGN   = 'I'.
  S_SEL-OPTION = 'BT'.
  S_SEL-LOW    = '10'.
  S_SEL-HIGH   = '20'.
  APPEND S_SEL.

  S_SEL-SIGN   = 'I'.
  S_SEL-OPTION = 'BT'.
  S_SEL-LOW    = '20'.
  S_SEL-HIGH   = '40'.
  APPEND S_SEL.

  S_SEL-SIGN   = 'E'.
  S_SEL-OPTION = 'EQ'.
  S_SEL-LOW    = '11'.
  APPEND S_SEL.

  S_SEL-SIGN   = 'E'.
  S_SEL-OPTION = 'EQ'.
  S_SEL-LOW    = '33'.
  APPEND S_SEL.

Read only

Former Member
0 Likes
2,360

Hi,

select-options: s_matnr for mara-matnr.

initialization.

s_matnr-sign = 'I'.

s_matnr-optipn = 'BT'

s_matnr-low = '10'.

s_matnr-high = '20'.

append s_matnr.

clear s_matnr.

s_matnr-sign = 'E'. " Its for EXCLUDE "

s_matnr-optipn = 'EQ'

s_matnr-low = '11'.

append s_matnr.

same logic can be applied for 20 to 40.

hope this helps.

thanx,

dhanashri.

Read only

Former Member
0 Likes
2,360

Hi Plz follow below.

SELECT-OPTIONS: SNO FOR L_V_SEL.

INITIALIZATION.

SNO-SIGN = 'I'.

SNO-OPTION = 'BT'.

SNO-LOW = '10'.

SNO-HIGH = '20'.

APPEND SNO.

CLEAR SNO.

SNO-SIGN = 'I'. "INCLUDE

SNO-OPTION = 'BT'.

SNO-LOW = '20'.

SNO-HIGH = '40'.

APPEND SNO.

CLEAR SNO.

SNO-SIGN = 'E'. "EXCLUDE

SNO-OPTION = 'EQ'.

SNO-LOW = '11'.

APPEND SNO.

CLEAR SNO.

SNO-SIGN = 'E'.

SNO-OPTION = 'EQ'.

SNO-LOW = '33'.

APPEND SNO.

CLEAR SNO.

rgds

rajesh

Read only

Former Member
0 Likes
2,360

Hi, Mahesh

You could try the code as follow:


DATA : i TYPE i.

SELECT-OPTIONS n1 FOR i.
SELECT-OPTIONS n2 FOR i.

INITIALIZATION.

  n1-sign = 'I'.
  n1-option = 'BT'.
  n1-low = 10.
  n1-high = 20.
  APPEND n1.
  CLEAR n1.

  n1-sign = 'E'.
  n1-option = 'EQ'.
  n1-low = 11.
  APPEND n1.
  CLEAR n1.

  n2-sign = 'I'.
  n2-option = 'BT'.
  n2-low = 20.
  n2-high = 40.
  APPEND n2.
  CLEAR n2.

  n2-sign = 'E'.
  n2-option = 'EQ'.
  n2-low = 33.
  APPEND n2.
  CLEAR n2.

And check the website as follow: http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/content.htm, it will help you to understand it much more better.

Hope it will help.

Best Regards,

Stephanie

Read only

Former Member
0 Likes
2,360

hi ,

Thank you all of you. i understood the same.

its been very helpful to me..

again thanking all of who replied me

take care.

mahesh

Read only

Former Member
0 Likes
2,360

hi mahes ....see this..

s_field-low = 11.

s_field-option = 'EQ'.

s_field-sign = 'E'.

append s_feld.

s_field-low = 33.

append s_feld.

clear s_field.

s_field-low = 1.

s_field-option = 'BT'.

s_field-sign = 'I'.

s_field-high = 40.

append s_feld.

Read only

Former Member
0 Likes
2,360

Thanks all for helping me