Skip to Content

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

Select Query using AND operation

Hello,

I am developing RFC which will retrieve some records from SAP HR module table.

Input will be one structure (INPUT_TABLE) containing 4 fields. User may enter values for any fields, and my requirement is to perform a AND operation on those entered fields only. Currently i am writing query as follows :

-


SELECT DISTINCT apernr aVORNA aNACHN acname a~gbdat FROM

PA0002 as a INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE

WHERE apernr = INPUT_TABLE-pernr AND aVNAMC = INPUT_TABLE-VORNA AND aNCHMC = INPUT_TABLE-NACHN AND agbdat = INPUT_TABLE-GBDAT .

-


If only 2 values are entered by user out of 4 , it will perform AND operation by taking other values as blank or 000000. I want to skip these AND operation on fields which are not entered by user.

Please help for writing query.

Thanks in advance,

Prashant

Tags:
Former Member
Former Member replied

Hi,

You have entered select query like this right...

SELECT DISTINCT pernr VORNA NACHN cname gbdat FROM

PA0002 INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE

WHERE (lv_condition) .

other wise can you paste your code here

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question