<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974880#M949375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont want to put in the table. I am already in the looping. So I will have one at a time.  Can you please tell me the select statment in the format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara where SATNR = matnr and color = wa_datatab-col2 and size1 = wa_datatab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I have this input possiblilities like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         030               100&lt;/P&gt;&lt;P&gt;10000120         030               101&lt;/P&gt;&lt;P&gt;10000120         020               100&lt;/P&gt;&lt;P&gt;10000120         020               101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         030               Null&lt;/P&gt;&lt;P&gt;10000120         020               Null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         Null                 Null         &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in all the cases I would like to have my output as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10000120         030               100&lt;/P&gt;&lt;P&gt;10000120         030               101&lt;/P&gt;&lt;P&gt;10000120         020               100&lt;/P&gt;&lt;P&gt;10000120         020               101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me please know if you guys want to know anything from my end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2008 22:51:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-20T22:51:17Z</dc:date>
    <item>
      <title>Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974877#M949372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have three columns matnr, color and size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data may come as:   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10000120, 030, 100 (or)&lt;/P&gt;&lt;P&gt;10000120, 030, null (or)&lt;/P&gt;&lt;P&gt;10000120.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this scenario I have to get all the possible values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) I am currently doing  select * from mara where SATNR = matnr and color = wa_datatab-col2 (initially I got the requirement with two columns only). Now here my requirement is changed with another column size = wa_datatab-col3. How do I write the query for the three columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) I think if we add the third value to the query i will get all the values which has the three conditions. Apart from that if I have only matnr and if i dont have color and size, then it should retreive all the articles associated with that matnr color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c) Also if I have matnr and color it should only retrieve the corresponding sizes, not all the sizes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks one and all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 21:17:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974877#M949372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T21:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974878#M949373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cheng Wan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A) &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT *
FROM MARA
INTO TABLE IT_MARA
WHERE MATNR = smatnr
  AND COLOR = wa_datatab-col2 
  AND SIZE  = wa_datatab-size.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this SELECT Query u get the records which statisfies the condition given in WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:

MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B)  If u have only MATNR in WHERE clause and if u dont have COLOR and SIZE then it retrieves all the articles associated to MATNR only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:

MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100
10000120         030               NULL
10000120         020               100
10000120         020               NULL&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C)  If u have only MATNR and COLOR then it retrieves articles associated to MATERIAL and COLOR. It retrives articles of all SIZES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:

MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100
10000120         030               NULL&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 21:38:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974878#M949373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T21:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974879#M949374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you have MATNR, just pass MATNR to the query. It will retreive all the possible records that matches MATNR, irrespective of the other two columns.&lt;/P&gt;&lt;P&gt;[ OR] if you really want to pass all the values, then convert the other two columns to ranges and pass it in the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can loop or read the table and do your further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Subramanian PL on Jun 20, 2008 3:28 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 22:28:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974879#M949374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T22:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974880#M949375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont want to put in the table. I am already in the looping. So I will have one at a time.  Can you please tell me the select statment in the format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara where SATNR = matnr and color = wa_datatab-col2 and size1 = wa_datatab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I have this input possiblilities like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         030               100&lt;/P&gt;&lt;P&gt;10000120         030               101&lt;/P&gt;&lt;P&gt;10000120         020               100&lt;/P&gt;&lt;P&gt;10000120         020               101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         030               Null&lt;/P&gt;&lt;P&gt;10000120         020               Null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MATNR           COLOR              SIZE1&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;10000120         Null                 Null         &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in all the cases I would like to have my output as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10000120         030               100&lt;/P&gt;&lt;P&gt;10000120         030               101&lt;/P&gt;&lt;P&gt;10000120         020               100&lt;/P&gt;&lt;P&gt;10000120         020               101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me please know if you guys want to know anything from my end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 22:51:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974880#M949375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T22:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974881#M949376</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;ranges: r_col2 like wa_datatab-col2,&lt;/P&gt;&lt;P&gt;            r_col3 like wa_datatab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   r_col2-sign = 'I'.&lt;/P&gt;&lt;P&gt;   r_col2-option = 'EQ'.&lt;/P&gt;&lt;P&gt;   r_col2-low = wa_datatab-col2 .&lt;/P&gt;&lt;P&gt;  append r_col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   r_col3-sign = 'I'.&lt;/P&gt;&lt;P&gt;   r_col3-option = 'EQ'.&lt;/P&gt;&lt;P&gt;   r_col3-low = wa_datatab-col3 .&lt;/P&gt;&lt;P&gt;  append r_col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara where SATNR = matnr  &lt;/P&gt;&lt;P&gt;               and  color in r_col2&lt;/P&gt;&lt;P&gt;               and size1 in r_col3.&lt;/P&gt;&lt;P&gt;This should fetch you all combinations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 22:59:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974881#M949376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T22:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974882#M949377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cheng Wan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT SINGLE *
FROM MARA
INTO WA_MARA
WHERE SATNR = matnr
  AND COLOR = wa_datatab-col2 
  AND SIZE  = wa_datatab-col3.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this SELECT Query u get the records which statisfies the condition given in WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:
 
MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100
10000120         030               101
10000120         020               100
10000120         020               101&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B) If u have only MATNR in WHERE clause and if u dont have COLOR and SIZE then it retrieves all the articles associated to MATNR only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:
 
MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100
10000120         030               101
10000120         020               100
10000120         020               101&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C) If u have only MATNR and COLOR then it retrieves articles associated to MATERIAL and COLOR. It retrives articles of all SIZES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Output:
 
MATNR           COLOR              SIZE
----------------------------------------
10000120         030               100
10000120         030               101
10000120         020               100
10000120         020               101&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 01:48:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3974882#M949377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-21T01:48:24Z</dc:date>
    </item>
  </channel>
</rss>

