Application Development 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: 

Select * from ...

Former Member
0 Kudos
224

Hi,

i try to select all POs wich MATKL are not declared.

I use this code:

TABLES: T023.

TABLES: ekpo.

*

data: itab type table of t023.

*

select * from t023 into table itab.

*

SELECT * FROM ekpo where matkl not in TABLE T023.

or

SELECT * FROM ekpo where matkl not in TABLE ITAB.

but i get an systax error.

Wich Select-statement can i use?

Any idea?

Thanks.

Regards, Dieter

1 ACCEPTED SOLUTION

Former Member
0 Kudos
168

Hi Dieter ,

You will have to create a range to acheive the desired result.

Here is a sample code which does some thing similar.

Data : Begin of it_1 occurs 0 ,

MATKL type MATKL ,

End of it_1.

data : begin of it_2 occurs 0 ,

EBELN type EBELN ,

EBELP type EBELP,

End of it_2.

select MATKL

into table it_1

from T023.

data : r_MATKL type range of MATKL,

w_MATKL like line of r_MATKL.

loop at it_1.

<b>w_MATKL-sign = 'E'.

w_MATKL-option = 'EQ'.

w_MATKL-low = it_1-MATKL.

append w_MATKL to r_MATKL.</b>

endloop.

select EBELN EBELP

into table it_2

from EKPO

where MATKL in r_MATKL.

Hope this helps.

Reward point if reply is helpful.

Regards

Arun

Message was edited by:

Arun R

12 REPLIES 12

Former Member
0 Kudos
168

Hi

data: itab type table of t023 occurs 0 with header line,

itab1 like ekko occurs 0 with header line.

select * from t023 into table itab.

if not itab[] is initial.

SELECT * FROM ekko into table itab1

for all entries in itab

where matkl = itab-matkl.

endif.

Itab1 will have all PO no's with all Material groups of t023 table

<b>Reward points for useful Answers</b>

Regards

Anji

0 Kudos
168

Hi Anji,

the problem is, that i will see all POs wich have an MATKL

who is NOT in T023.

Any idea?

Regards, Dieter

0 Kudos
168

The resultant table will have all the entries matching with T023-MAKTl, r u getting the same result or u want some other way.

Former Member
0 Kudos
168

hi,

try this code,

select * from t023 into table itab.

SELECT * FROM ekpo where matkl ne itab-matkl.

reward points if helpful,

ragards,

seshu.

alex_m
Active Contributor
0 Kudos
168

Change the code like below.

Select * from t023 into table itab.

if not itab[] is initial.

SELECT * FROM ekko into table itab1

for all entries in itab

where matkl = itab-matkl.

endif.

Former Member
0 Kudos
168

Hello,

Change the code like this.


SELECT * FROM ekpo into it_ekpo for all entries in itab 
where matkl ne itab-matkl.

Vasanth

S0025444845
Active Participant
0 Kudos
168

Hi,

try this

TABLES: T023.

TABLES: ekpo.

*

data: itab type table of t023,

it_ekpo type table of ekpo .

*

select * from t023 into table itab.

*

SELECT * into table it_ekpo FROM ekpo where matkl not in ITAB-maktl.

regards,

sudha

0 Kudos
168

Hi sudha,

i get an syntax-error with yout code.

regards, Dieter

dev_parbutteea
Active Contributor
0 Kudos
168

hi,

try this:

select * from t023 into table itab.

SELECT * FROM ekpo into table it_ekpo.

sort itab by matkl.

sort it_ekpo by matkl.

delete adjacent dupilcates from itab comparing matkl.

select * from it_ekpo

into it_ekpo2

for all entries in itab

where matkl = itab-matkl.

delete it_ekpo2 from it_ekpo.

Regards,

Sooness

d

Former Member
0 Kudos
169

Hi Dieter ,

You will have to create a range to acheive the desired result.

Here is a sample code which does some thing similar.

Data : Begin of it_1 occurs 0 ,

MATKL type MATKL ,

End of it_1.

data : begin of it_2 occurs 0 ,

EBELN type EBELN ,

EBELP type EBELP,

End of it_2.

select MATKL

into table it_1

from T023.

data : r_MATKL type range of MATKL,

w_MATKL like line of r_MATKL.

loop at it_1.

<b>w_MATKL-sign = 'E'.

w_MATKL-option = 'EQ'.

w_MATKL-low = it_1-MATKL.

append w_MATKL to r_MATKL.</b>

endloop.

select EBELN EBELP

into table it_2

from EKPO

where MATKL in r_MATKL.

Hope this helps.

Reward point if reply is helpful.

Regards

Arun

Message was edited by:

Arun R

0 Kudos
168

Hi,

i make it in this way and works very good:

TABLES: T023.

TABLES: EKPO.

*

DATA: R_MATKL TYPE RANGE OF MATKL.

DATA: W_MATKL LIKE LINE OF R_MATKL.

*

W_MATKL-SIGN = 'E'.

W_MATKL-OPTION = 'EQ'.

*

SELECT * FROM T023.

W_MATKL-LOW = T023-MATKL.

APPEND W_MATKL TO R_MATKL.

ENDSELECT.

*

SELECT * FROM EKPO WHERE MATKL IN R_MATKL.

*

WRITE: / '##', EKPO-EBELN, EKPO-EBELP, EKPO-MATKL.

*

ENDSELECT.

thanks for your help.

surbjeet your answer works also very good.

thanks for your help.

Regards, Dieter

former_member378318
Contributor
0 Kudos
168

Hi,

The following will give you all entries from EKPO where MATKL does not exist in T023:

DATA: t_ekpo TYPE STANDARD TABLE OF ekpo.

SELECT *

INTO TABLE t_ekpo

FROM ekpo

WHERE NOT EXISTS ( SELECT *

FROM t023

WHERE matkl EQ ekpo~matkl ).

Hope it helps.