<?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 parameters &amp; nested ifs in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919365#M58656</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 have a problem with nested if conditions. I have to take in a field A as a parameter which has two values say 10 and 11 and value the should be selected depends on another field value say B which again has two values 1 and 2 and say this is how 10 and 11 are related to each other:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if A=10 &amp;amp; B=1 then write 10 else if A=11 and B-2 write 11. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the user can enter either 10 or 11 in the selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so right now the if condition that I have which is not working is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If A = 10.&lt;/P&gt;&lt;P&gt;   If B = 1.&lt;/P&gt;&lt;P&gt;       A = 10.&lt;/P&gt;&lt;P&gt;   elseif B = 2.&lt;/P&gt;&lt;P&gt;       A = 11.&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;    A = 11.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;WHat is happening is that it only writes out correct value for the first condition when a =10 but writes nothing when a = 11. So can somebody correct the condition and tell me what to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;UU&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jun 2005 22:14:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-06-10T22:14:50Z</dc:date>
    <item>
      <title>parameters &amp; nested ifs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919365#M58656</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 have a problem with nested if conditions. I have to take in a field A as a parameter which has two values say 10 and 11 and value the should be selected depends on another field value say B which again has two values 1 and 2 and say this is how 10 and 11 are related to each other:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if A=10 &amp;amp; B=1 then write 10 else if A=11 and B-2 write 11. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the user can enter either 10 or 11 in the selection screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so right now the if condition that I have which is not working is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If A = 10.&lt;/P&gt;&lt;P&gt;   If B = 1.&lt;/P&gt;&lt;P&gt;       A = 10.&lt;/P&gt;&lt;P&gt;   elseif B = 2.&lt;/P&gt;&lt;P&gt;       A = 11.&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;    A = 11.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;WHat is happening is that it only writes out correct value for the first condition when a =10 but writes nothing when a = 11. So can somebody correct the condition and tell me what to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;UU&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 22:14:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919365#M58656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-10T22:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: parameters &amp; nested ifs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919366#M58657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this as a fix for your solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if A = 10.&lt;/P&gt;&lt;P&gt;If B = 1.&lt;/P&gt;&lt;P&gt;A = 10.&lt;/P&gt;&lt;P&gt;elseif B = 2.&lt;/P&gt;&lt;P&gt;A = 11.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;A = 11.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if A = 10 and B = 1.&lt;/P&gt;&lt;P&gt;A = 10.&lt;/P&gt;&lt;P&gt;elseif A = 11 and B = 2.&lt;/P&gt;&lt;P&gt;A = 11.&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;rishi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 23:47:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919366#M58657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-10T23:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: parameters &amp; nested ifs</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919367#M58658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a nutty one for a Saturday morning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is exactly your requirement: &amp;lt;i&amp;gt;if A=10 &amp;amp; B=1 then write 10 else if A=11 and B-2 write 11&amp;lt;/i&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then only Rishi's second attempt gets this result:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if A = 10 and B = 1.
  A = 10.
elseif A = 11 and B = 2.
  A = 11.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you want to achieve this using nested ifs then you can do it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if A = 10.
  if B = 1.
    A = 10.
  endif.
elseif A = 11.
  if B = 2.
    A = 11.
  endif.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, setting A = 10, or A = 11 is meaningless in this context as if A = 10 then it will always be 10, regardless of the value of B, and the same if it is 11, it will always be 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, better to set a third variable C, like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if A = 10 and B = 1.
  C = 10.
elseif A = 11 and B = 2.
  C = 11.
endif.
WRITE: / C.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2005 08:28:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-nested-ifs/m-p/919367#M58658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-11T08:28:41Z</dc:date>
    </item>
  </channel>
</rss>

