<?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: multiple condition prob in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507934#M234471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am bit confused about your requirement as vbeln is the key for table VBAK..so if you have a parameter for vbeln it would fetch only a single record from VBAK and not many records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, you want to read the material information  and store it in itab for all lines for the particular order. Also, to check if itab has only one line than compare the posnr paramter with itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The complete check can be done using the below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;vbeln b&lt;/SUB&gt;posnr b~matnr&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from vbak as a inner join vbap as b on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbap&lt;/P&gt;&lt;P&gt;where a~vbeln = p_vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table itab lines lrec.&lt;/P&gt;&lt;P&gt;If lrec = 1.&lt;/P&gt;&lt;P&gt;   read table itab index 1.&lt;/P&gt;&lt;P&gt;   if p_posnr &amp;lt;&amp;gt; itab-posnr.&lt;/P&gt;&lt;P&gt;      Error Message.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Aug 2006 13:54:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-31T13:54:45Z</dc:date>
    <item>
      <title>multiple condition prob</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507931#M234468</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 one query regarding different condition. Suppose i have to one internal table itab. &lt;/P&gt;&lt;P&gt;Now i read the data from vbak &amp;amp; vbap table. My parameters r p_vbeln, p_posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_vbeln  LIKE  vbak-vbeln,&lt;/P&gt;&lt;P&gt;	    p_posnr  LIKE  vbak-posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to select all records from table vbak for parameter p_vbeln. &lt;/P&gt;&lt;P&gt;after it for each entry on table vbak select single on table vbap for the material. &amp;amp; store&lt;/P&gt;&lt;P&gt;it into internal table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if only one entry exists on table itab check the entry matches the input parameters p_vbeln,&lt;/P&gt;&lt;P&gt;p_posnr. If no match then generate error. If match then proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anybody will tell me how to write the logic for the above condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 13:34:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507931#M234468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T13:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: multiple condition prob</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507932#M234469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to add a condition again. because&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select * into corresponding fields of table itab
  from vbap 
  where vbeln in (
            select vbeln from vbak where vbeln eq p_vbeln )
    and matnr eq p_matnr
    and posnr eq p_posnr.

if not sy-subrc is initial.
  "not match.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab already has conditioned value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ibrahim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok i have changed the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ibrahim UGUR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 13:38:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507932#M234469</guid>
      <dc:creator>ibrahim_u</dc:creator>
      <dc:date>2006-08-31T13:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: multiple condition prob</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507933#M234470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Ibrahim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think ur not fully read my query. I have to use first select statement &amp;amp; after that select statement i have to use select single * for vbak table. after it lot of conditions are there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 13:41:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507933#M234470</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T13:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: multiple condition prob</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507934#M234471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am bit confused about your requirement as vbeln is the key for table VBAK..so if you have a parameter for vbeln it would fetch only a single record from VBAK and not many records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, you want to read the material information  and store it in itab for all lines for the particular order. Also, to check if itab has only one line than compare the posnr paramter with itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The complete check can be done using the below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;vbeln b&lt;/SUB&gt;posnr b~matnr&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from vbak as a inner join vbap as b on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbap&lt;/P&gt;&lt;P&gt;where a~vbeln = p_vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table itab lines lrec.&lt;/P&gt;&lt;P&gt;If lrec = 1.&lt;/P&gt;&lt;P&gt;   read table itab index 1.&lt;/P&gt;&lt;P&gt;   if p_posnr &amp;lt;&amp;gt; itab-posnr.&lt;/P&gt;&lt;P&gt;      Error Message.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 13:54:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507934#M234471</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T13:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: multiple condition prob</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507935#M234472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Salil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with Anurag regarding one key field from VBAK and you will get one record only. But here is what i understood from your requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: vbak, vbap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from vbak where vbeln = p_vbeln.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;select single * from vbap where vbeln = vbak-vbeln.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;move-corresponding vbap to itab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table itab lines index.&lt;/P&gt;&lt;P&gt;check index eq 1.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;if itab-vbeln eq p_vbeln and itab-posnr eq p_posnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do other stuff.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;message e000 with 'record not matches'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 14:00:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-condition-prob/m-p/1507935#M234472</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-31T14:00:11Z</dc:date>
    </item>
  </channel>
</rss>

