<?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: How to store data in a variable in select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657835#M1287079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you are fetching 3 fields in the select clause and SLOC can only accept one filed , so either you can declare 2 more variable and then use them in the INTO clause or else use internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jun 2009 06:41:08 GMT</pubDate>
    <dc:creator>Sandeep_Panghal</dc:creator>
    <dc:date>2009-06-05T06:41:08Z</dc:date>
    <item>
      <title>How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657830#M1287074</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;Below is the select query in which i want to store the data in variable but i am getting runtime error as the fields are more as compared to variable,the declaration is necessary for it due to the reteriving for data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide me guidelines how to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: BEGIN OF ITSC01 OCCURS 0,
      PRUEFLOS LIKE QALS-PRUEFLOS,
      MBLNR LIKE QAMB-MBLNR,
      LGORT LIKE MSEG-LGORT,
      END OF ITSC01.
IF STIT-MGEIG GE 0.

LOOP AT STIT." WHERE PRUEFLOS EQ STIT-PRUEFLOS.

    SELECT A~PRUEFLOS B~MBLNR C~LGORT FROM QALS AS A
           INNER JOIN QAMB AS B ON B~PRUEFLOS = A~PRUEFLOS
           INNER JOIN MSEG AS C ON C~MBLNR = B~MBLNR AND C~MJAHR = B~MJAHR
           INTO SLOC WHERE A~PRUEFLOS EQ STIT-PRUEFLOS.
*           INTO TABLE ITSC01 WHERE A~PRUEFLOS EQ STIT-PRUEFLOS AND A~MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.

    SORT ITSC01 BY PRUEFLOS.
     READ TABLE ITSC01 WITH KEY PRUEFLOS = ITSC01-PRUEFLOS.
      IF ITSC01-LGORT EQ 'SC03'.
      STIT-MGEIG = 0.
      ENDIF.
 MODIFY STIT.
 ENDLOOP.
ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:23:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657830#M1287074</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T06:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657831#M1287075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY STIT transporting MGEIG.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:30:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657831#M1287075</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2009-06-05T06:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657832#M1287076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How you have declared variable SLOC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;PRUEFLOS B&lt;/SUB&gt;MBLNR C~LGORT FROM QALS AS A&lt;/P&gt;&lt;P&gt;           INNER JOIN QAMB AS B ON B&lt;SUB&gt;PRUEFLOS = A&lt;/SUB&gt;PRUEFLOS&lt;/P&gt;&lt;P&gt;           INNER JOIN MSEG AS C ON C&lt;SUB&gt;MBLNR = B&lt;/SUB&gt;MBLNR AND C&lt;SUB&gt;MJAHR = B&lt;/SUB&gt;MJAHR&lt;/P&gt;&lt;P&gt;           INTO SLOC WHERE A~PRUEFLOS EQ STIT-PRUEFLOS. &lt;STRONG&gt;==&amp;gt; Check structure of SLOC&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          INTO TABLE ITSC01 WHERE A&lt;SUB&gt;PRUEFLOS EQ STIT-PRUEFLOS AND A&lt;/SUB&gt;MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:32:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657832#M1287076</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-05T06:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657833#M1287077</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;Is the select query written in correct way ? instead storing of data in itab i am truing to store the value of LGORT in variable called SLOC,please provide me guidelines for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the runtime error that :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In a SELECT or FETCH command, the field string or internal table&lt;/P&gt;&lt;P&gt; specified in the INTO clause has 1 fields. It must have&lt;/P&gt;&lt;P&gt; at least as many fields as in the SELECT clause,&lt;/P&gt;&lt;P&gt; 3 fields in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how do i solve this problem?&lt;/P&gt;&lt;P&gt;yes,i had declared like this:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: SLOC LIKE MSEG-LGORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even i tried to decalre in the ITSC01 but still it is giving the runtime error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ricx .s on Jun 5, 2009 8:36 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:35:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657833#M1287077</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T06:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657834#M1287078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,,&lt;/P&gt;&lt;P&gt;     you haven't declared the internal table with exact fields i think..&lt;/P&gt;&lt;P&gt;declare an internal table with the exact fields &amp;amp; check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kishore Babu on Jun 5, 2009 8:39 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:39:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657834#M1287078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T06:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657835#M1287079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you are fetching 3 fields in the select clause and SLOC can only accept one filed , so either you can declare 2 more variable and then use them in the INTO clause or else use internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:41:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657835#M1287079</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-05T06:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657836#M1287080</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 had tried by declaring it but it is still giving the run time error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:41:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657836#M1287080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T06:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657837#M1287081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmm..&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_PRUEFLOS LIKE QALS-PRUEFLOS,&lt;/P&gt;&lt;P&gt;          l_MBLNR LIKE QAMB-MBLNR,&lt;/P&gt;&lt;P&gt;         l_LGORT LIKE MSEG-LGORT,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF STIT-MGEIG GE 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT STIT." WHERE PRUEFLOS EQ STIT-PRUEFLOS.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    SELECT A&lt;SUB&gt;PRUEFLOS B&lt;/SUB&gt;MBLNR C~LGORT FROM QALS AS A&lt;/P&gt;&lt;P&gt;           INNER JOIN QAMB AS B ON B&lt;SUB&gt;PRUEFLOS = A&lt;/SUB&gt;PRUEFLOS&lt;/P&gt;&lt;P&gt;           INNER JOIN MSEG AS C ON C&lt;SUB&gt;MBLNR = B&lt;/SUB&gt;MBLNR AND C&lt;SUB&gt;MJAHR = B&lt;/SUB&gt;MJAHR&lt;/P&gt;&lt;P&gt;           INTO ( l_PRUEFLOS , l_MBLNR, l_LGORT )&lt;/P&gt;&lt;P&gt;      WHERE A~PRUEFLOS EQ STIT-PRUEFLOS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          INTO TABLE ITSC01 WHERE A&lt;SUB&gt;PRUEFLOS EQ STIT-PRUEFLOS AND A&lt;/SUB&gt;MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    SORT ITSC01 BY PRUEFLOS.&lt;/P&gt;&lt;P&gt;     READ TABLE ITSC01 WITH KEY PRUEFLOS = ITSC01-PRUEFLOS.&lt;/P&gt;&lt;P&gt;      IF ITSC01-LGORT EQ 'SC03'.&lt;/P&gt;&lt;P&gt;      STIT-MGEIG = 0.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt; MODIFY STIT.&lt;/P&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:44:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657837#M1287081</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-05T06:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657838#M1287082</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 am trying what you has said but i have to use select endselect statement but while debugging there is no data present in the &lt;STRONG&gt;ITSC01&lt;/STRONG&gt; and should i use endselect word in the query ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ricx .s on Jun 5, 2009 9:04 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 06:52:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657838#M1287082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T06:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657839#M1287083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are using the code in my post , the table ITSC01 will be intial and the data will be stored in the varaibles.&lt;/P&gt;&lt;P&gt;So you have to use the varaibles now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 07:29:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657839#M1287083</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-05T07:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657840#M1287084</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;yes i am using your logic but in that it is not fillling ITSC01 as in that select query it is just passing the values .. tell me if i am getting wrong. There is no data for the stored in ITSC01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide  me guidelines to solve this problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 09:11:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657840#M1287084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T09:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657841#M1287085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will not fill ITSC01.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;PRUEFLOS B&lt;/SUB&gt;MBLNR C~LGORT FROM QALS AS A&lt;/P&gt;&lt;P&gt;INNER JOIN QAMB AS B ON B&lt;SUB&gt;PRUEFLOS = A&lt;/SUB&gt;PRUEFLOS&lt;/P&gt;&lt;P&gt;INNER JOIN MSEG AS C ON C&lt;SUB&gt;MBLNR = B&lt;/SUB&gt;MBLNR AND C&lt;SUB&gt;MJAHR = B&lt;/SUB&gt;MJAHR&lt;/P&gt;&lt;P&gt; INTO TABLE ITSC01 WHERE A&lt;SUB&gt;PRUEFLOS EQ STIT-PRUEFLOS AND A&lt;/SUB&gt;MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 09:15:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657841#M1287085</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2009-06-05T09:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to store data in a variable in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657842#M1287086</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;but what about the variable for Storage Location? should i store seperately then value of it ?&lt;/P&gt;&lt;P&gt;Please provide  me guidelines for solving this probelm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ricx .s on Jun 5, 2009 11:38 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 09:18:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-store-data-in-a-variable-in-select-query/m-p/5657842#M1287086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-05T09:18:22Z</dc:date>
    </item>
  </channel>
</rss>

