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 Statement

Former Member
0 Likes
859

Hi Experts,

I need to select the PO's from table EKPO of specific number ranges.

The table EKPO has the PO's with different number ranges.

For eg: 4500001

4500002

4500003

4500004

4500005

.............

.............

.............

4600001

4600002

............

............

HDP001

HDP002

HDP003

............

............

MAC001

MAC002

............

............

MRPN01

MRPN02

.............

.............

STR0001

STR0002

.............

.............

Currently the program selects only the '<b>45xxxxx</b>' number range. Now I have to modify the select statement to select the '<b>MRPNxx</b>' series also.

The current form of select statement is:

<b>select ebeln ebelp matnr

from EKPO

into table itab

where matnr = itab2-matnr

and werks = p_werks

and ebeln >= '4500000'

and ebeln < '4600000'.</b>

Please help.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
819

HI,

Take a look at the following eg.

select ebeln ebelp matnr
from EKPO
into table itab
where matnr = itab2-matnr
and werks = p_werks
and ebeln >= '4500000'
and ebeln < '4600000'
or ebeln like 'MRPN%' .

<b>OR</b>


select ebeln ebelp matnr
from EKPO
into table itab
where matnr = itab2-matnr
and werks = p_werks
and ebeln like '45%'
 or ebeln like 'MRPN%' .

Regards,

erwan

7 REPLIES 7
Read only

Former Member
0 Likes
820

HI,

Take a look at the following eg.

select ebeln ebelp matnr
from EKPO
into table itab
where matnr = itab2-matnr
and werks = p_werks
and ebeln >= '4500000'
and ebeln < '4600000'
or ebeln like 'MRPN%' .

<b>OR</b>


select ebeln ebelp matnr
from EKPO
into table itab
where matnr = itab2-matnr
and werks = p_werks
and ebeln like '45%'
 or ebeln like 'MRPN%' .

Regards,

erwan

Read only

Former Member
0 Likes
819

create a range to replace your ebeln where-clauses:

ranges: lv_ebeln for ekpo-ebeln.

then fill it with your ranges:

sign = I

option = BT

low = '450000'

high = '460000'

and one more entry

sign = I

option = BT

low = 'MRPN00'

high = 'MRPN99'

Instead of BT, you could also use the CP additon....

sign = I

option = CP

low = 'MRPN*'

plz award points to useful answers!

Read only

Former Member
0 Likes
819

Hi Sey,

use:

select-opstions: s_ebeln for ekpo-ebeln.

*

select ebeln ebelp matnr

from EKPO

into table itab

where matnr = itab2-matnr

and werks = p_werks

*and ebeln >= '4500000'

*and ebeln < '4600000'.

and ebeln in s_ebeln.

in the Input-screen you can insert a lot of ranges.

Regards, Dieter

Read only

Former Member
0 Likes
819
data : v_string(6).  

ranges: s_numbers for v_string.

s_numbers-sign = 'I'.
s_numbers-option = 'CP'.   " contains pattern
s_numbers-low = 'MRPN*'.
s_numbers-high = ''.
append s_numbers.



select ebeln ebelp matnr
from EKPO
into table itab
where matnr = itab2-matnr
and werks = p_werks
and ebeln in s_numbers.
Read only

rahulkavuri
Active Contributor
0 Likes
819

select fld1 fld2 from <dbtab>

into table itab

where ( field like '45%' or

field2 like 'MAC%' or

field2 like 'MRPN%' or

field3 like 'STR%').

award points if found helpful

Read only

Former Member
0 Likes
819

select <fields> from <database>

into table <internal table>

where ( <field> like '45%'

or <field2> like 'MAC%' ).

Read only

0 Likes
819

Thanks all for your answers and help.