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
910

HI

CAN ANY ONE GUIDE ME HOW TO MAKE THESE TWO SELECT STATEMENTS WORK EFFECTIVELY

SELECT EKKOEBELN EKKOAEDAT EKKOEKGRP EKKOEKORG EKKOLIFNR EKPOMATNR EKET~EINDT INTO corresponding fields of TABLE it_ekko

FROM ekko INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN

INNER JOIN EKET ON EKKOEBELN = EKETEBELN

where EKKO~lifnr in p_lifnr

and EKKO~ebeln in p_ebeln

and EKKO~ekgrp in p_ekgrp

and EKKO~aedat in p_aedat

and EKKO~ernam in p_ernam

AND EKPO~EBELN IN P_MATNR

AND EKET~EINDT IN P_EINDT.

SELECT EKKOEBELN EKKOAEDAT EKKOEKGRP EKKOEKORG EKKO~LIFNR

EKPOEBELP EKPOMENGE EKPOMEINS EKPOMATNR MARDLGORT EKPOIDNLF EKPO~TXZ01

MARDLGPBE T001LLGOBE EKESMENGE eketwemng into

corresponding fields of table it_ekko from

ekpo INNER JOIN EKKO ON EKPOEBELN = EKKOEBELN

inner join eket on

ekpoebeln = eketebeln and

ekpoebelp = eketebelp

INNER JOIN T001L ON EKPOWERKS = T001LWERKS inner join mard on

ekpomatnr = mardmatnr and ekpowerks = mardwerks

INNER JOIN EKES ON EKPOEBELN = EKESEBELN

FOR ALL ENTRIES IN it_ekko where ekpo~ebelN = it_ekko-ebelN.

SIRI

6 REPLIES 6
Read only

Former Member
0 Likes
823

<b>1)----


></b>

SELECT EKKOEBELN EKKOAEDAT EKKOEKGRP EKKOEKORG EKKOLIFNR EKPOMATNR EKET~EINDT INTO corresponding fields of TABLE it_ekko

FROM ekko INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN

INNER JOIN EKET ON EKKOEBELN = EKETEBELN

where EKKO~lifnr eq p_lifnr

and EKKO~ebeln eq p_ebeln

and EKKO~ekgrp eq p_ekgrp

and EKKO~aedat eq p_aedat

and EKKO~ernam eq p_ernam

AND EKPOmatnr eq P_MATNR <----


( EKKOMATNR )

AND EKET~EINDT eq P_EINDT.

<b> ( i hope all the p_ 's are parameters thats y u need to use 'EQ' , if those are select options then 'IN' is correct )...</b>

<b>and dont use into corresponding tables...

define the structure of it_ekko as...</b>

data :

begin of it_ekko occurs 0,

ebeln type EKKO-EBELN,

aedat type EKKO-AEDAT,

ekgrp type EKKO-EKGRP,

ekorg type EKKO-EKORG,

lifnr type EKKO-LIFNR,

matnr type EKPO-MATNR,

eindt type EKET-EINDT,

end fo it_ekko.

<b>and remove into corresponding fields ... this improves the performs greatly... </b>

Read only

0 Likes
823

Ramesh

all those p's r select opitions...

Is anything important to be changed..

anyone guide me plz

Read only

0 Likes
823

if p_ are select options change all EQ to IN.

Regards,

Amit

Read only

Former Member
0 Likes
823

hi

SELECT ekkoebeln ekkoaedat

ekkoekgrp ekkoekorg

ekkolifnr ekpomatnr

eket~eindt

INTO CORRESPONDING FIELDS OF TABLE it_ekko

FROM ( ( ekko

INNER JOIN ekpo

ON ekkoebeln = ekpoebeln )

INNER JOIN eket ON ekkoebeln = eketebeln )

WHERE ekko~lifnr IN p_lifnr

AND ekko~ebeln IN p_ebeln

AND ekko~ekgrp IN p_ekgrp

AND ekko~aedat IN p_aedat

AND ekko~ernam IN p_ernam

AND ekpo~ebeln IN p_matnr

AND eket~eindt IN p_eindt.

Read only

Former Member
0 Likes
823

hi,

SELECT PEBELN PAEDAT PEKGRP PEKORG PLIFNR PMATNR Q~EINDT INTO corresponding fields of TABLE it_ekko

FROM ekko as p INNER JOIN EKET as Q ON QEBELN = PEBELN

where p~lifnr in p_lifnr

and p~ebeln in p_ebeln

and p~ekgrp in p_ekgrp

and p~aedat in p_aedat

and p~ernam in p_ernam

AND p~EBELN IN P_MATNR

AND q~EINDT IN P_EINDT.

try this,

kc

Read only

Former Member
0 Likes
823

remove 'into corresponding' and maintain the order of fields same as in internal table.

it may a bit to the performance.

Regards,

Sujatha.