Skip to Content
0
Former Member
May 26, 2007 at 10:59 AM

Reg : Select statement

37 Views

Hi, I have a piece of code in which select Statements has to be changed due to performance reasons.

the problem is :: in between SELECT and END SELECT -


there is SELECT SINGLE and other 2 SELECT STMT'S are used.

can anyone help me in changing the code.

this is my code ::

SELECT MATNR INFNR LIFNR IDNLF WGLIF

meins umren umrez urzla regio

INTO (EINA-MATNR, EINA-INFNR, EINA-LIFNR, EINA-IDNLF, EINA-WGLIF,

eina-meins, eina-umren, eina-umrez,

eina-urzla, eina-regio)

from eina

WHERE MATNR in S_MATNR AND

LIFNR EQ P_LIFNR.

SELECT SINGLE EKORG WERKS WAERS NETPR esokz ekgrp aplfz bstae mwskz kzabs

peinh bprme bpumn bpumz

INTO (EINE-EKORG, EINE-WERKS, EINE-WAERS, EINE-NETPR,

eine-esokz, eine-ekgrp, eine-aplfz, eine-bstae,

eine-mwskz, eine-kzabs, eine-peinh, eine-bprme,

eine-bpumn, eine-bpumz)

FROM EINE

WHERE INFNR EQ EINA-INFNR

AND EKORG EQ P_EKORG

AND ESOKZ EQ P_ESOKZ

AND WERKS IN P_WERKS.

CHECK SY-SUBRC = 0.

IF RB_NETPR EQ 'X'.

CHECK EINE-NETPR NE 0.

ENDIF.

clear a017.

select datab datbi

from a017

into (a017-datab, a017-datbi)

where kappl eq 'M'

and kschl eq 'PB00'

and lifnr eq eina-lifnr

and matnr eq eina-matnr

and ekorg eq eine-ekorg

and werks eq eine-werks

and esokz eq eine-esokz

and datab le sy-datum

and datbi ge sy-datum.

exit.

endselect.

clear eord.

select flifn

from eord

into eord-flifn

where matnr eq eina-matnr

and werks eq eine-werks

and vdatu LE sy-datum

and bdatu GE sy-datum

and flifn eq 'X'.

endselect.

MOVE: EINA-MATNR TO WA_EXTRACT-MATNR,

EINA-INFNR TO WA_EXTRACT-INFNR,

EINA-LIFNR TO WA_EXTRACT-LIFNR,

EINE-EKORG TO WA_EXTRACT-EKORG,

EINE-WERKS TO WA_EXTRACT-WERKS,

EINA-IDNLF TO WA_EXTRACT-IDNLF,

EINA-WGLIF TO WA_EXTRACT-WGLIF,

EINE-NETPR TO WA_EXTRACT-NETPR,

EINE-WAERS TO WA_EXTRACT-WAERS,

'G' to wa_extract-type,

eina-meins to wa_extract-meins,

eina-umren to wa_extract-umren,

eina-umrez to wa_extract-umrez,

eina-urzla to wa_extract-urzla,

eina-regio to wa_extract-regio,

eine-esokz to wa_extract-esokz,

eine-ekgrp to wa_extract-ekgrp,

eine-aplfz to wa_extract-aplfz,

eine-bstae to wa_extract-bstae,

eine-mwskz to wa_extract-mwskz,

eine-kzabs to wa_extract-kzabs,

eine-peinh to wa_extract-peinh,

eine-bprme to wa_extract-bprme,

eine-bpumn to wa_extract-bpumn,

eine-bpumz to wa_extract-bpumz,

a017-datab to wa_extract-datab,

a017-datbi to wa_extract-datbi,

eord-flifn to wa_extract-flifn,

w_info_text to wa_extract-info_text.

APPEND WA_EXTRACT TO IEXTRACT.

ENDSELECT.