<?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: If condition doubt in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719305#M630877</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;PARAMETERS : A TYPE I,&lt;/P&gt;&lt;P&gt;                          B TYPE I ,&lt;/P&gt;&lt;P&gt;                          C TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND NOT B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,B.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND NOT B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,B.C&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND NOT B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : B&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND NOT B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : B,C.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : C.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,C&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS IS THE CODE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD IF USEFUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Aug 2007 08:15:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-24T08:15:30Z</dc:date>
    <item>
      <title>If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719299#M630871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have three inputs in my selection screen, I need to get all the possible condtitions and run the select querry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex :  a , b , c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if a&lt;/P&gt;&lt;P&gt;if a and b&lt;/P&gt;&lt;P&gt;if a and b and c&lt;/P&gt;&lt;P&gt;if b&lt;/P&gt;&lt;P&gt;if b and c&lt;/P&gt;&lt;P&gt;if c&lt;/P&gt;&lt;P&gt;if c and a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me how to write the if condition on this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 07:59:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719299#M630871</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T07:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719300#M630872</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;Use dynamic WHERE clause as follows.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: str type string.

IF a is not initial. " Check if A is not initial
concatenate 'FLDA = ' a into str.
ENDIF.

if b is not initial. " check if B is not inital
if str is initial. " Check if str (Where clause is initial)
concatenate 'FLDB = ' b into str.
else.
concatenate str ' AND FLDB = ' b into str.
endif.
ENDIF.

if c is not initial. " check if C is not inital
if str is initial. " Check if str (Where clause is initial)
concatenate 'FLDC = ' c into str.
else.
concatenate str ' AND FLDC = ' c into str.
endif.
endif.

if str is not initial. "(Check if WHERE clause is not initial)
SELECT *  FROM table INTO itab WHERE (str).
else.
SELECT *  FROM table INTO itab.
endif
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:03:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719300#M630872</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-08-24T08:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719301#M630873</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;Can you please elaborate your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:05:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719301#M630873</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719302#M630874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Line,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to mention that all the (a,b,c) fields are from one table or differnet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it belongs to one table you can write in where condition. else you have to find the link between the table and you can fetch the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:06:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719302#M630874</guid>
      <dc:creator>kishorepallapothula</dc:creator>
      <dc:date>2007-08-24T08:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719303#M630875</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;Since you want to build your WHERE condition based on if A B C are supplied or only some of them are supplied or if none of them are supplied then you can ignore WHERE clause for select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my code is actually creating a Dynamic WHERE clause so that you will get WHERE clause as per the data in A B and C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:08:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719303#M630875</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-08-24T08:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719304#M630876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes all the values are from one table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719304#M630876</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719305#M630877</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;PARAMETERS : A TYPE I,&lt;/P&gt;&lt;P&gt;                          B TYPE I ,&lt;/P&gt;&lt;P&gt;                          C TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND NOT B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,B.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND NOT B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,B.C&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND NOT B IS INITIAL AND C IS INITIAL &lt;/P&gt;&lt;P&gt;WRITE : B&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND NOT B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : B,C.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF A IS INITIAL AND B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : C.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF NOT A IS INITIAL AND B IS INITIAL AND C IS NOT INITIAL &lt;/P&gt;&lt;P&gt;WRITE : A,C&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS IS THE CODE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD IF USEFUL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719305#M630877</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719306#M630878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code is good I am trying to figure out how it executes, Thanx for helping, I would appreciate if you can send me any sample code for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:16:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719306#M630878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719307#M630879</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;I tried but cannot workout,  I have my fields like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. (no-low) and (no-high)&lt;/P&gt;&lt;P&gt;2. (date-low) and (date-high)&lt;/P&gt;&lt;P&gt;3. user&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one please help me with the above mentioned field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:32:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719307#M630879</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: If condition doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719308#M630880</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;Check out the help for SELECT using Dynamic WHERE clauses under Keyword documentation of SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There you can find some sample code for dynamic WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you could not then here is the sample code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: column TYPE c LENGTH 8, 
            value  TYPE c LENGTH 30. 

DATA spfli_wa TYPE spfli. 

DATA cond_syntax TYPE string. 

CONCATENATE column '= value' 
            INTO cond_syntax SEPARATED BY space. 

TRY. 
    SELECT SINGLE * 
           FROM spfli 
           INTO spfli_wa 
           WHERE (cond_syntax). " HERE cond_syntx is a string containing the WHERE clauses fields and values)
  CATCH cx_sy_dynamic_osql_error. 
    MESSAGE `Wrong WHERE condition!` TYPE 'I'. 
ENDTRY. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in your case you need to check the values of A B and C and accordingly build the WHERE clause string as I have done in my code of first reply.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:36:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/if-condition-doubt/m-p/2719308#M630880</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-08-24T08:36:05Z</dc:date>
    </item>
  </channel>
</rss>

