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

Regarding Select query

Former Member
0 Likes
1,086

Hi all,

Please give me the select query

I have to fetch MATNR EBELP WERKS LGORT BEDNR from EKPO table where EBELN is the Value in the selection screen and BUKRS should be 2001 or 2002 or 2003 or 9999.

Regards

Ajay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,037

Here is a simple version


TABLES: ekpo.


SELECT matnr ebelp werks lgort bednr FROM ekpo
  WHERE ebeln IN s_ebeln
    AND ( bukrs = '2001' OR
          bukrs = '2002' OR
          bukrs = '2003' OR
          bukrs = '9999' ).

* your process
ENDSELECT.

7 REPLIES 7
Read only

Former Member
0 Likes
1,038

Here is a simple version


TABLES: ekpo.


SELECT matnr ebelp werks lgort bednr FROM ekpo
  WHERE ebeln IN s_ebeln
    AND ( bukrs = '2001' OR
          bukrs = '2002' OR
          bukrs = '2003' OR
          bukrs = '9999' ).

* your process
ENDSELECT.

Read only

S0025444845
Active Participant
0 Likes
1,037

Hi,

do like this.

tables:ekpo.

types: begin of ty_ekpo,

matnr type ekpo-matnr,

ebeln type ekpo-ebeln,

ebelp type ekpo-ebelp,

werks type ekpo-werks,

lgort type ekpo-lgort,

bednr type ekpo-bednr,

end of ty_ekpo.

data: it_ekpo type standard table of ty_ekpo.

select-options: s_ebeln for ekpo-ebeln.

select matnr ebeln ebelp werks lgort bednr into table it_ekpo from ekpo where ebeln in s_ebeln and

(bukrs = '2001' OR

bukrs = '2002' OR

bukrs = '2003 ' OR

bukrs = '9999' ).

regards,

sudha

Edited by: sudha yadav on Apr 24, 2008 1:45 PM

Edited by: sudha yadav on Apr 24, 2008 1:46 PM

Edited by: sudha yadav on Apr 24, 2008 1:47 PM

Read only

abapdeveloper20
Contributor
0 Likes
1,037

DELCARE one internal table with all fields u mentioned...

and select options as

P_EBELN LIKE EKPO-EBELN.

now

SELECT SINGLE 
 MATNR 
 EBELP 
 WERKS 
 LGORT 
 BEDNR 
 INTO CORRESPONDING FIELDS OF TABLE ITAB 
 FROM EKPO
WHERE EBELN IN P_EBELN AND
             BUKRS IN ( '2001', '2002' ,'2003' , '9999').

Reward if useful

Read only

Former Member
0 Likes
1,037

This should be u r select query :

SELECT matnr ebelp werks lgort bednr FROM ekpo

WHERE ebeln IN s_ebeln

AND ( bukrs = '2001' OR

bukrs = '2002' OR

bukrs = '2003 ' OR

bukrs = '9999' ).

Read only

Former Member
0 Likes
1,037

Hi,

select MATNR

EBELP

WERKS

LGORT

BEDNR

from EKPO

into table itab

where EBELN = (selection screen value)

and (BUKRS = 2001

or BUKRS = 2002

or BUKRS = 2003

or BUKRS = 9999).

reward if helpful

raam

Read only

Former Member
0 Likes
1,037

Hi,

For selecting the data in selection screen which type of data type you are using

I mean Select-options or Paramters.

if you are using select-options for Ebeln and Bukrs use IN operator where codition

if you are using Parameters for ebeln and bukrs use EQ operator.

see below eg:

here ebeln is using select-options so I have given in operator and bukrs hard coded.

select ebelp

matnr

werks

lgort

bendr from ekpo

into table <itab>

where ebeln in s_ebeln

and bukrs = '2001' or

bukrs = '2002' or

bukrs = '2003' or

bukrs = '9999'.

Actually what is your requirement bukrs value it should be one in that above values or is it a range. I mean is it select-options or parameters 1st let me clear.

Thaks

Ganesh

Read only

Former Member
0 Likes
1,037

Hi

Try like this.

Select MATNR

EBELP

WERKS

LGORT

BEDNR

from ekpo

into table i_ekpo

where ebeln in s_ebeln

and bukrs in ('2001', '2002', '2003', '9999').

Regards

Haritha.