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

SAP ABAP Select Statement/ Queries

Former Member
0 Likes
456

Hi.

select * from mver where matnr= itab-matnr

and werks = itab-bwkey

and perkz = 'P'

and gjahr = gjahr1.

there are option like 'P' and 'M' i need to select both of them like 'P/M'.

how can u do tht.

both "m" and "P" period buckets shd be populated with data and need to be added together to pull the zm001127.

3 REPLIES 3
Read only

Former Member
0 Likes
427

RANGES: r_perkz FOR mver-perkz.

r_perkz-option = 'EQ'.

r_perkz-sign = 'I'.

r_perkz-low = 'P'.

append r_perkz.

r_perkz-low = 'M'.

append r_perkz.

select * from mver where matnr= itab-matnr

and werks = itab-bwkey

and perkz IN r_perkz

and gjahr = gjahr1.

Read only

Former Member
0 Likes
427

Hi,

Create a range and then append both the value 'P' and 'M' to the internal table and use the range in the where clause.

data: r_range type range of mver-perkz with header line.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'P'.

APPEND R_RANGE.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'M'.

APPEND R_RANGE.

select * from mver where matnr= itab-matnr

and werks = itab-bwkey

and perkz IN R_RANGE

and gjahr = gjahr1.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
427

You can do this to get both values.





where matnr= itab-matnr
  and werks = itab-bwkey
<b>  and perkz in ('P', 'M')</b>
  and gjahr = gjahr1.


Regards,

Rich Heilman