Skip to Content
0
Former Member
Mar 06, 2007 at 07:46 PM

select only if input parameters is not initial

1751 Views

Hi,

What i want to do in the code below is to select pernr into wa_pernr but it is not sure that the input fields (I_BUKRS. I_YYDEPT etc.) has a value. So I just want to do include them in the selection if they are not initial.

How do i do this?

SELECT PERNR INTO WA_PERNR
FROM PA0001

WHERE BUKRS EQ I_BUKRS
<i> AND YYDEPT EQ I_YYDEPT
 AND BEGDA GE I_BEGDA
 AND ENDDA LE I_ENDDA.</i>

APPEND WA_PERNR TO IT_PERNR.

SORT IT_PERNR BY PERNR.
DELETE ADJACENT DUPLICATES FROM IT_PERNR COMPARING PERNR.

ENDSELECT.

Best Regards

Claes