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

Check selection-options value

Former Member
0 Likes
1,201

I would like to check the selection criteria whether equal to some value or not. i use

if s_bukrs in ('1234', '2222') it has error. Thanks!

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,148

if ( '1234' in s_bukrs or '2222' in s_bukrs ).

error

endif.

9 REPLIES 9
Read only

Former Member
0 Likes
1,148

s_bukrs in ('1234', '2222') It will give error be..

S_BUKRS have 4 options.

Low High Sign & Option

values are in LOW and HIGH

so comapare as S_BUKRS-LOW = '1234'

Or S_BUKRS-HIGH = '2222'.

Depends on your requiremnts

S_BUKRS-LOW and S_BUKRS-HIGH contain value

S_BUKRS-SIGN contains sigh as I or E

S_BUKRS-OPTION contains 'BT' or 'EQ'

While in debugg mode put break point on S_BUKRS and double ckick on that you will get all above options

Read only

0 Likes
1,148

But the users can input mulit value in the selection-option, How can i solve the problem. thanks!

Read only

0 Likes
1,148

did u try my post

Read only

Former Member
0 Likes
1,148

hi..

For Select-options there are fields internally associated with it.. -option

-sign

-high

-low..

If u r going in debugger window u'l get it.. check for ur sel-option(s_burks) like s_burks-low = '1111' then do..

any queries post a mail

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,149

if ( '1234' in s_bukrs or '2222' in s_bukrs ).

error

endif.

Read only

Former Member
0 Likes
1,148

Hi

Check the below code..

It will be helpful...

1. First Prepare Range Based on Selection Screen.

2. Select Data Into Table..

3. Then Validate..

FORM validate_purchasing_group.

DATA: BEGIN OF l_t_ekgrp OCCURS 0,

ekgrp LIKE t024-ekgrp,

END OF l_t_ekgrp.

RANGES: ra_ekgrp FOR t024-ekgrp.

IF NOT so_ekgrp[] IS INITIAL.

LOOP AT so_ekgrp.

IF NOT so_ekgrp-low IS INITIAL.

ra_ekgrp-sign = 'I'.

ra_ekgrp-option = 'EQ'.

ra_ekgrp-low = so_ekgrp-low.

APPEND ra_ekgrp.

CLEAR: ra_ekgrp.

ENDIF.

IF NOT so_ekgrp-high IS INITIAL.

ra_ekgrp-sign = 'I'.

ra_ekgrp-option = 'EQ'.

ra_ekgrp-low = so_ekgrp-high.

APPEND ra_ekgrp.

CLEAR: ra_ekgrp.

ENDIF.

ENDLOOP.

SELECT ekgrp INTO TABLE l_t_ekgrp

FROM t024

WHERE ekgrp IN ra_ekgrp.

LOOP AT so_ekgrp.

IF so_ekgrp-low <> space.

READ TABLE l_t_ekgrp WITH KEY ekgrp = so_ekgrp-low.

IF sy-subrc <> 0.

SET CURSOR FIELD 'SO_EKGRP-LOW'.

MESSAGE e755(me) WITH so_ekgrp-low.

ENDIF.

ENDIF.

IF so_ekgrp-high <> space.

READ TABLE l_t_ekgrp WITH KEY ekgrp = so_ekgrp-high.

IF sy-subrc <> 0.

SET CURSOR FIELD 'SO_EKGRP-HIGH'.

MESSAGE e755(me) WITH so_ekgrp-high.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. " validate_purchasing_group

Hope this helps.

Praveen

Read only

Former Member
0 Likes
1,148

Hi,

It shows u a syntax error bcoz

IF dobj IN sel_tab. "sel_tab must be a selection table/range
endif. 

in ('1234', '2222') this can be used in where cond only

WHERE-IN

tables mara.
select single * from mara where matnr in (' ','10').

Cheers,

jose.

Read only

Former Member
0 Likes
1,148

Hi,

This will solve your problem.

AT SELECTIO-SCREEN .

IF '1234' in s_bukrs OR

'2222' in s_bukrs.

Your logic here.

ENDIF.

When you use IN s_bukrs It will check the all values of bukrs.Try first.

Reward if useful...

Read only

Former Member
0 Likes
1,148

Hi,

In the select query itself u can include this check,

SELECT * FROM xxx
               INTO TABLE xxxx
               WHERE bukrs IN ( '1234', '2222' ).

Or you can use a range table,

RANGES: r_bukrs FOR t001-bukrs.

r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = '1234'.
APPEND r_bukrs.
CLEAR r_bukrs.

r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = '2222'.
APPEND r_bukrs.
CLEAR r_bukrs.

Do a check with the s_bukrs....