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

Help Required on Select

Former Member
0 Likes
662

Hi,

Need some help for the belwo select statement.

I need to pick some records based on the condition...

select EQUNR and EQTYP from EQUI into itab

where equnr = '1234' and

eqtyp = 'A' or 'D' or 'G' or 'H' or 'I' or 'J'

or 'K' or 'L'.

endselect.

Is this statement correct. How to make the condition for EQTYP.

Regards,

Rajesh

5 REPLIES 5
Read only

Former Member
0 Likes
614

SELECT EQUNR EQTYP into table itab

from equi

where equnr = '1234' and

eqtyp in ('A','D','G','H','I','J','K','L').

<b>U can even use RANGE for the above..

Ranges : r_type for equi-eqtyp.

r_type-sign = 'I'.

r_type-option = 'EQ'.

r_type-low = 'A'.

append r_type.

r_type-low = 'D'.

append r_type.

r_type-option = 'BT'.

r_type-low = 'G'.

r_type-high = 'K'.

append r_type.

SELECT EQUNR EQTYP into table itab

from equi

where equnr = '1234' and

eqtyp in r_type.</b>

<b><u><i>Please award points for all helpful answers</i></u></b>

Message was edited by: Anurag Bankley

Read only

0 Likes
614

You can try this

SELECT EQUNR EQTYP into table itab

from EQUI

where EQNR eq '1234' and

EQTYP = 'A' or

EQTYP = 'D' or

EQTYP = 'G' or

EQTYP = 'H' or

EQTYP = 'I' or

EQTYP = 'J' or

EQTYP = 'K' or

EQTYP = 'L'

.

Read only

Former Member
0 Likes
614

select EQUNR EQTYP from EQUI into table itab

where equnr = '1234' and

eqtyp in ('A','D','G','H','I','J','K','L').

Prakash.

Read only

Former Member
0 Likes
614

ranges : r_eqtyp like equi-eqtyp.

r_eqtyp-low = 'A'.

r_eqtyp-option = 'EQ'.

append r_eqtyp.

r_eqtyp-low = 'D'.

append r_eqtyp.

r_eqtyp-low = 'G'.

append r_eqtyp.

select equnr

eqtyp

from equi

where equnr = '1234'

and eqtyp in r_eqtyp.

-Anu

Read only

Former Member
0 Likes
614

hi,

As you are passing the primary key to the table EQUI, you can use SELECT SINGLE instead of SELECT and ENDSELECT.

SELECT <b>SINGLE</b> EQUNR

EQTYP

from EQUI

into<b> (itab-equnr,

itab-eqtyp )</b>

where equnr = '1234' and

eqtyp IN ( 'A','D','G','H','I','J'

,'K','L').

<b>*endselect. <--This is NOT Required.

APPEND ITAB. <--Required,to update the body of ITAB

</b>

if you are giving individual fields in SELECT ,you have to give the fields in INTO clause. check the above code.

Regards

Srikanth

<b></b>

and one more info to you.

if you are sending value as '1234' to this SELECT it will not fetch you the values because its using conversion routine.so first call that conversion routine and then send that value to this SELECT.then only you will get the records.

I guess you wont get values with that SELECT statement.

if i am correc,you can use the conversion exit,

CONVERSION_EXIT_ALPHA_INPUT

so what you can do is,

DATA : V_EQUNR TYPE EQUI-EQUNR.
V_EQUNR = '1234'.
   <b>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
         EXPORTING
              INPUT  = V_EQUNR
         IMPORTING
              OUTPUT = V_EQUNR.</b>Here you will get value to V_EQUNR with leading zeros.
like '000000000000001234'.
then pass this V_EQUNR field to the SELECT.

SELECT <b>SINGLE</b> EQUNR 
              EQTYP
              from EQUI 
              into<b> (itab-equnr,
                    itab-eqtyp )</b> 
             where equnr = '1234' and
                    eqtyp IN ( 'A','D','G','H','I','J'
,'K','L').

Regards

Srikanth

Message was edited by: Srikanth Kidambi