Skip to Content
0
Former Member
Oct 22, 2007 at 10:53 AM

Select Statement Performance issue ?

38 Views

Hi experts,

I getting the performance issue using select statements in such order for validations in selection screen. the code is given below.I wanna through the error message if any wrong entries been entered in the selection screen.The code is given below,

************************************************************

SELECT pernr FROM pa0001 INTO TABLE int_pernr

WHERE pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'No entries found for given personnel number'.

ENDIF.

ENDIF.

----


  • Internal tables for selection screen validations *

----


SELECT abkrs FROM pa0001 INTO TABLE int_abkrs

WHERE abkrs = p_abkrs.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid payroll area '.

ENDIF.

SELECT kostl FROM pa0001 INTO TABLE int_kostl

WHERE kostl IN s_kostl AND

pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid Cost Center'.

ENDIF.

SELECT orgeh FROM pa0001 INTO TABLE int_orgeh

WHERE orgeh IN s_orgeh AND

pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid Organization Unit'.

ENDIF.

SELECT persg FROM pa0001 INTO TABLE int_persg

WHERE persg IN s_persg AND

pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid Employee Group'.

ENDIF.

SELECT persk FROM pa0001 INTO TABLE int_persk

WHERE persk IN s_persk AND

persg = 3 AND

pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid Employee Sub-Group'.

ENDIF.

SELECT abkrs FROM pa0001 INTO TABLE int_abkrs

WHERE abkrs IN s_abkrs AND

pernr IN s_pernr.

IF sy-subrc <> 0.

MESSAGE e000(zsmp) WITH 'Invalid payroll area'.

ENDIF.

*****************************************************************************

I need to validate those fields using a single select statement else some other methods awaiting for ur suggestions.