Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Select ... Endselect

Hi,

I wrote a code in start of selection. it is taking lot of time for getting output & finally going to dump. can anyone tell me how to correct my logic. don't say do like that or like this. if i change da code with out select & endselect it is not giving result. i am attaching code of which i used in my report.

START-OF-SELECTION.

SELECT * FROM A503 WHERE KAPPL = 'V'

AND VKORG IN S_SORG

AND MATNR IN S_MATNR

AND KSCHL = 'PR00'

AND DATBI GT SY-DATUM.

SELECT SINGLE * FROM MARA WHERE MATNR = A503-MATNR

AND MATKL IN S_MATGRP.

IF SY-SUBRC EQ 0.

SELECT SINGLE ARKTX INTO ITAB1-ARKTX

FROM VBAP WHERE MATNR = A503-MATNR

AND MATKL IN S_MATGRP

AND WERKS IN S_PLANT.

SELECT SINGLE * FROM KONP WHERE KNUMH = A503-KNUMH.

ITAB1-MATNR = A503-MATNR.

ITAB1-VKORG = A503-VKORG.

ITAB1-NETPR = KONP-KBETR.

ITAB1-UOM = KONP-KMEIN.

ITAB1-WAERS = KONP-KONWS.

SELECT * FROM MBEW WHERE MATNR = ITAB1-MATNR AND BWKEY IN S_PLANT.

IF MBEW-VPRSV = 'V'.

ITAB1-COSTPR = MBEW-VERPR * MBEW-PEINH .

ELSE.

ITAB1-COSTPR = MBEW-STPRS * MBEW-PEINH .

ENDIF.

ITAB1-MARGIN = ITAB1-NETPR - ITAB1-COSTPR.

ITAB1-WERKS = MBEW-BWKEY.

APPEND ITAB1.

ENDSELECT.

CLEAR ITAB1.

ENDIF.

ENDSELECT.

SELECT SINGLE ARKTX INTO ITAB1-ARKTX

FROM VBAP WHERE MATNR = A503-MATNR

AND MATKL IN S_MATGRP

AND WERKS IN S_PLANT.

SORT ITAB1 BY MATNR WERKS.

DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING MATNR WERKS.

DELETE ITAB1 WHERE MATNR EQ SPACE.

PERFORM DISPLAY_DATA.

END-OF-SELECTION.

regards,

Ram

Former Member
Not what you were looking for? View more on this topic or Ask a question