<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Select Query using AND operation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414702#M1048883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Sep 2008 06:03:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-16T06:03:09Z</dc:date>
    <item>
      <title>Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414695#M1048876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am developing RFC which will retrieve some records from SAP HR module table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT a&lt;SUB&gt;pernr a&lt;/SUB&gt;VORNA a&lt;SUB&gt;NACHN a&lt;/SUB&gt;cname a~gbdat FROM&lt;/P&gt;&lt;P&gt;              PA0002 as a INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE&lt;/P&gt;&lt;P&gt;                                            WHERE a&lt;SUB&gt;pernr = INPUT_TABLE-pernr AND a&lt;/SUB&gt;VNAMC = INPUT_TABLE-VORNA AND a&lt;SUB&gt;NCHMC = INPUT_TABLE-NACHN AND a&lt;/SUB&gt;gbdat = INPUT_TABLE-GBDAT .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help for writing query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 04:02:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414695#M1048876</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T04:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414696#M1048877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use RANGES in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RANGES: r_test for sy-datum,&lt;/P&gt;&lt;P&gt;                r_test2 for sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear r_test.&lt;/P&gt;&lt;P&gt;if not datum is initial.&lt;/P&gt;&lt;P&gt;r_test = 'IEQ.&lt;/P&gt;&lt;P&gt;r_test-low = datum.&lt;/P&gt;&lt;P&gt;append r_test.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear r_test2.&lt;/P&gt;&lt;P&gt;if not addat is initial.&lt;/P&gt;&lt;P&gt;r_test2 = 'IEQ.&lt;/P&gt;&lt;P&gt;r_test2-low = addat.&lt;/P&gt;&lt;P&gt;append r_test2.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM testdb where datum in r_test.&lt;/P&gt;&lt;P&gt;                                        and addat in r_test2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 04:22:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414696#M1048877</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T04:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414697#M1048878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create dynamic where condition based upon user input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-pernr IS INITIAL.&lt;/P&gt;&lt;P&gt;      CLEAR : lv_pernr_condition.&lt;/P&gt;&lt;P&gt;      CONCATENATE 'PERNR' ' = ' '''' INPUT_TABLE-pernr ''''  INTO&lt;/P&gt;&lt;P&gt;      lv_pernr_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-vnamc IS INITIAL.&lt;/P&gt;&lt;P&gt;      CLEAR : lv_vnamc_condition.&lt;/P&gt;&lt;P&gt;      CONCATENATE 'VNAMC' ' = ' '''' INPUT_TABLE-vnamc ''''  INTO&lt;/P&gt;&lt;P&gt;      lv_vnamc_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-vorna IS INITIAL.&lt;/P&gt;&lt;P&gt;      CLEAR : lv_vorna_condition.&lt;/P&gt;&lt;P&gt;      CONCATENATE 'VORNA' ' = ' '''' INPUT_TABLE-vorna ''''  INTO&lt;/P&gt;&lt;P&gt;      lv_vorna_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-nchmc IS INITIAL.&lt;/P&gt;&lt;P&gt;      CLEAR : lv_nchmc_condition.&lt;/P&gt;&lt;P&gt;      CONCATENATE 'NCHMC' ' = ' '''' INPUT_TABLE-nchmc ''''  INTO&lt;/P&gt;&lt;P&gt;      lv_nchmc_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-gbdat IS INITIAL.&lt;/P&gt;&lt;P&gt;      CLEAR : lv_gbdat_condition.&lt;/P&gt;&lt;P&gt;      CONCATENATE 'GBDAT' ' = ' '''' INPUT_TABLE-gbdat ''''  INTO&lt;/P&gt;&lt;P&gt;      lv_gbdat_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_pernr_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;      CONCATENATE lv_pernr_condition lv_condition&lt;/P&gt;&lt;P&gt;      INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_vnamc_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;      IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_vnamc_condition lv_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_condition 'AND' lv_vnamc_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_vorna_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;      IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_vorna_condition lv_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_condition 'AND' lv_vorna_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_nchmc_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;      IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_nchmc_condition lv_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_condition 'AND' lv_nchmc_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_gbdat_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;      IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_gbdat_condition lv_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CONCATENATE lv_condition 'AND' lv_gbdat_condition&lt;/P&gt;&lt;P&gt;            INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT pernr VORNA NACHN cname gbdat FROM&lt;/P&gt;&lt;P&gt;PA0002 INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE&lt;/P&gt;&lt;P&gt;WHERE lv_condition .   " Dynamic where condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 04:29:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414697#M1048878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T04:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414698#M1048879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gowri Sankar Dinakaran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your immediate reply. I will try to implement the same using your solution and let you know if i face any difficulty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 04:45:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414698#M1048879</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T04:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414699#M1048880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gowri Sankar Dinakaran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have given exact solution for my problem. thanks for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I got one more error in select query which is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Incorrect expression "lv_condition" in logical condition.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 05:49:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414699#M1048880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T05:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414700#M1048881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have entered select query like this right...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT pernr VORNA NACHN cname gbdat FROM&lt;/P&gt;&lt;P&gt;PA0002 INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE&lt;/P&gt;&lt;P&gt;WHERE (lv_condition) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;other wise can you paste your code here&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 05:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414700#M1048881</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T05:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414701#M1048882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solved error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Used following query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT pernr VORNA NACHN cname gbdat FROM PA0002 INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE&lt;/P&gt;&lt;P&gt;WHERE (lv_condition) . " Dynamic where condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(PS : - Points are awarded)&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prashant Jagdale (Genius) on Sep 16, 2008 11:30 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 05:58:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414701#M1048882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T05:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414702#M1048883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 06:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414702#M1048883</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T06:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414703#M1048884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got one more issue. I need to add one more field named 'telnr' in the comparison. So INPUT_TABLE contain TELNR field also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this field is from table PA0006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any help on queries containing join???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prashant Jagdale (Genius) on Sep 16, 2008 12:01 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 06:30:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414703#M1048884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T06:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414704#M1048885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-pernr IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_pernr_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'a~PERNR' ' = ' '''' INPUT_TABLE-pernr '''' INTO&lt;/P&gt;&lt;P&gt;lv_pernr_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-vnamc IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_vnamc_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'a~VNAMC' ' = ' '''' INPUT_TABLE-vnamc '''' INTO&lt;/P&gt;&lt;P&gt;lv_vnamc_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-vorna IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_vorna_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'a~VORNA' ' = ' '''' INPUT_TABLE-vorna '''' INTO&lt;/P&gt;&lt;P&gt;lv_vorna_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-nchmc IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_nchmc_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'a~NCHMC' ' = ' '''' INPUT_TABLE-nchmc '''' INTO&lt;/P&gt;&lt;P&gt;lv_nchmc_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-gbdat IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_gbdat_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'a~GBDAT' ' = ' '''' INPUT_TABLE-gbdat '''' INTO&lt;/P&gt;&lt;P&gt;lv_gbdat_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT INPUT_TABLE-telnr IS INITIAL.&lt;/P&gt;&lt;P&gt;CLEAR : lv_telnr_condition.&lt;/P&gt;&lt;P&gt;CONCATENATE 'b~telnr' ' = ' '''' INPUT_TABLE-telnr '''' INTO&lt;/P&gt;&lt;P&gt;lv_telnr_condition.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_pernr_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_pernr_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_vnamc_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_vnamc_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_condition 'AND' lv_vnamc_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_vorna_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_vorna_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_condition 'AND' lv_vorna_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_nchmc_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_nchmc_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_condition 'AND' lv_nchmc_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_gbdat_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_gbdat_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_condition 'AND' lv_gbdat_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lv_telnr_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;IF lv_condition IS INITIAL.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_telnr_condition lv_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CONCATENATE lv_condition 'AND' lv_telnr_condition&lt;/P&gt;&lt;P&gt;INTO lv_condition SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT a&lt;SUB&gt;pernr a&lt;/SUB&gt;VORNA a&lt;SUB&gt;NACHN a&lt;/SUB&gt;cname a&lt;SUB&gt;gbdat b&lt;/SUB&gt;telnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE from pa002 as a&lt;/P&gt;&lt;P&gt;join pa006 as b on a&lt;SUB&gt;pernr = b&lt;/SUB&gt;pernr &lt;/P&gt;&lt;P&gt;WHERE lv_condition . " Dynamic where condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it is helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2008 07:06:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414704#M1048885</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-16T07:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414705#M1048886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again i have to add one more field "DATJO"from another table "PA0502". So i have build the dynamic condition string for the same and written query as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SELECT DISTINCT a&lt;SUB&gt;pernr a&lt;/SUB&gt;VORNA a&lt;SUB&gt;NACHN a&lt;/SUB&gt;cname a&lt;SUB&gt;gbdat b&lt;/SUB&gt;telnr c~DatJo&lt;/P&gt;&lt;P&gt;              INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE from pa0002 as a&lt;/P&gt;&lt;P&gt;               JOIN pa0006 as b on a&lt;SUB&gt;pernr = b&lt;/SUB&gt;pernr JOIN PA0502 as c on b&lt;SUB&gt;pernr = c&lt;/SUB&gt;pernr&lt;/P&gt;&lt;P&gt;                  WHERE (lv_condition). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i m geeting zero records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any wrong in query??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 12:30:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414705#M1048886</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T12:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414706#M1048887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT DISTINCT a~pernr a~VORNA a~NACHN a~cname a~gbdat b~telnr c~DatJo
INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE from pa0002 as a
JOIN pa0006 as b on a~pernr = b~pernr JOIN PA0502 as c on a~pernr = c~pernr
WHERE (lv_condition). 

*OR*

SELECT DISTINCT a~pernr a~VORNA a~NACHN a~cname a~gbdat b~telnr c~DatJo
INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE from ( pa0002 as a
INNER JOIN pa0006 as b on a~pernr = b~pernr 
INNER JOIN PA0502 as c on a~pernr = c~pernr )
WHERE (lv_condition). 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope it will helps&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 12:38:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414706#M1048887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T12:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query using AND operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414707#M1048888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your solution my query is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But just now i have checked the values of the table PA0502. It contains zero records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So join of this table with any tables is zero records. Right??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Correct me if i am wrong??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 12:45:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-using-and-operation/m-p/4414707#M1048888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T12:45:18Z</dc:date>
    </item>
  </channel>
</rss>

