<?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 select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486417#M226987</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I'm a beginner.&lt;/P&gt;&lt;P&gt;Can you please tell me what is wrong with the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: mara,&lt;/P&gt;&lt;P&gt;        mch1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants: c_mat type mara-matnr value '107901',&lt;/P&gt;&lt;P&gt;           c_pla type marc-werks value 'XXX',&lt;/P&gt;&lt;P&gt;           c_bat type mch1-charg value '0000066584'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;      l_charg type mch1-charg,&lt;/P&gt;&lt;P&gt;      l_mtart type mara-mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select mtart into l_mtart from mara&lt;/P&gt;&lt;P&gt;             where matnr = c_mat.&lt;/P&gt;&lt;P&gt;      endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if l_mtart = 'FERT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select matnr into l_matnr from mch1&lt;/P&gt;&lt;P&gt;               where charg = c_bat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         write: / l_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         endselect.&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;thnx a ton.&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Aug 2006 21:02:28 GMT</pubDate>
    <dc:creator>VenuAnumayam</dc:creator>
    <dc:date>2006-08-11T21:02:28Z</dc:date>
    <item>
      <title>select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486417#M226987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I'm a beginner.&lt;/P&gt;&lt;P&gt;Can you please tell me what is wrong with the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: mara,&lt;/P&gt;&lt;P&gt;        mch1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants: c_mat type mara-matnr value '107901',&lt;/P&gt;&lt;P&gt;           c_pla type marc-werks value 'XXX',&lt;/P&gt;&lt;P&gt;           c_bat type mch1-charg value '0000066584'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;      l_charg type mch1-charg,&lt;/P&gt;&lt;P&gt;      l_mtart type mara-mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select mtart into l_mtart from mara&lt;/P&gt;&lt;P&gt;             where matnr = c_mat.&lt;/P&gt;&lt;P&gt;      endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if l_mtart = 'FERT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        select matnr into l_matnr from mch1&lt;/P&gt;&lt;P&gt;               where charg = c_bat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         write: / l_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         endselect.&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;thnx a ton.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486417#M226987</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486418#M226988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure that your material number has the internal format with leading zeros.&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;PRE&gt;&lt;CODE&gt;



&amp;lt;b&amp;gt;constants: c_mat type mara-matnr value '000000000000107901',&amp;lt;/b&amp;gt;
c_pla type marc-werks value 'XXX',
c_bat type mch1-charg value '0000066584'.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:05:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486418#M226988</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T21:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486419#M226989</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 I remember correct mara-matnr is char of 10 .&lt;/P&gt;&lt;P&gt;So you need to pad the text with correct number of zero's to make the value as 10 digit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also,&lt;/P&gt;&lt;P&gt;You are using select endselect. I donno if this is by choice  but checking l_mtart in the end of this will actually have the last read data so if you have 10 data for the same it will have value for the 10th data when your program progresses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also,&lt;/P&gt;&lt;P&gt;please try to get data in internal table and use that instead of using the select-endselect ( especially if it's avoidable) as this select-endselect decreases the performance in general.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nishant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:10:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486419#M226989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T21:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486420#M226990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thnx rich.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but its not yielding anything.&lt;/P&gt;&lt;P&gt;i ran it in debug mode. nothing shows up in MARA table, while there are so many records exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whatz wrong with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx.&lt;/P&gt;&lt;P&gt;ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:10:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486420#M226990</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486421#M226991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is your requirement and why do you think there is an error in this code? You can simply combine the two into a join as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT a~matnr INTO l_matnr
               FROM mch1 AS a
         INNER JOIN mara AS b
                 ON a~matnr = b~matnr
              WHERE b~mtart = 'FERT'
                AND b~matnr = c_mat
                AND a~charg = c_bat.
  WRITE:/ l_matnr.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also change it to single selects as you have the primary keys of both the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT SINGLE mtart INTO l_mtart 
                    FROM mara AS b
                   WHERE matnr = c_mat.
CHECK sy-subrc = 0 AND
      l_mtart  = 'FERT'.
SELECT SINGLE matnr INTO l_matnr
                    FROM mch1
                   WHERE matnr = c_mat
                     AND charg = c_bat.
CHECK sy-subrc = 0.
WRITE:/ l_matnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:11:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486421#M226991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T21:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486422#M226992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; thnx rich.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; but its not yielding anything.&lt;/P&gt;&lt;P&gt;&amp;gt; i ran it in debug mode. nothing shows up in MARA&lt;/P&gt;&lt;P&gt;&amp;gt; table, while there are so many records exist.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; whatz wrong with this.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; thnx.&lt;/P&gt;&lt;P&gt;&amp;gt; ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is probably because the material you chose is not a FERT material type. Instead of hardcoding the material number, try with a select option as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_matnr FOR l_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now change the MARA SELECT as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... FROM MARA WHERE MATNR IN S_MATNR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:13:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486422#M226992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T21:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486423#M226993</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'm wriring this piece of code in a METHOD of CLASS which is in a BADI. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm afraid i can't use internal tables in OOABAP, if i'm correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:15:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486423#M226993</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486424#M226994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srinivas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hve checked that material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is a FERT type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:20:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486424#M226994</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486425#M226995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nishant,&lt;/P&gt;&lt;P&gt;how can avoid this select - endselect without using the internal table. can u plz give me an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:22:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486425#M226995</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486426#M226996</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 can use internal tables in OOABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, just try using a variable in place of constant and try to change the value @ runtime. And yes please insert leading zero's while changing field content @ runtime and check if in one select you are able to get some result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nishant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:27:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486426#M226996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T21:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486427#M226997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i meant to say that we can't use internal tables in 'methods' of a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:44:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486427#M226997</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T21:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486428#M226998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can, you just can't use header lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example,  when declaring internal tables in a class/method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: imara type table of mara.
data: wmara like line of imara.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 21:53:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486428#M226998</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T21:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486429#M226999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cant use "Loop - Endloop" in that context, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: ravi kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:07:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486429#M226999</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T22:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486430#M227000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can.  Take the example declaration in my previous post.  You have an internal table imara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at imara into wmara.
 write:/ wmara-matnr.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:14:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486430#M227000</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T22:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486431#M227001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please advise me an approach for my requirement.&lt;/P&gt;&lt;P&gt;I'll post the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:15:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486431#M227001</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T22:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486432#M227002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to know exactly what your requirement is, then I can give you the exact code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:24:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486432#M227002</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T22:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486433#M227003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirement is:&lt;/P&gt;&lt;P&gt;For transaction MSC2N, i'm implementing a BADI. &lt;/P&gt;&lt;P&gt;The details:&lt;/P&gt;&lt;P&gt;METHOD: IF_EX_BATCH_MASTER~CHECK_DATA_BEFORE_SAVE&lt;/P&gt;&lt;P&gt;BADI Implementation: ZM_BATCH_MASTER&lt;/P&gt;&lt;P&gt;BADI Definition: BATCH_MASTER&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Enhancements for Batch Master Transactions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that method, i'm writing the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now for the values entered in transaction MSC2N,&lt;/P&gt;&lt;P&gt;(For eg:   MATNR = 107901&lt;/P&gt;&lt;P&gt;           CHARG = 665847&lt;/P&gt;&lt;P&gt;           WERKS = USA)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. First I hve to check the entered material type is 'FERT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If it is 'FERT'(finished good) material type,  then for the entered batch, i need to get all the material numbers tied to that batch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Now Check for any 'HALB'(bulk goods) material type materials exist in that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. For this 'HALB', I need to get the batch number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this functionality, i did the coding like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error i'm getting is 'you cant use internal tables with header line in OO context' . if i declare the internal table without header line - it's giving error : 'internal table does not have header'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data: l_matnr type mara-matnr,       "material number&lt;/P&gt;&lt;P&gt;      l_charg type mch1-charg,       "batch number&lt;/P&gt;&lt;P&gt;      l_mtart type mara-mtart,       "material type&lt;/P&gt;&lt;P&gt;      l_bumat type mara-matnr.       "bulk material&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: i_data type table of mcha.&lt;/P&gt;&lt;P&gt;data: w_data like line of i_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Select the material type&lt;/P&gt;&lt;P&gt;   select MTART into l_mtart from MARA&lt;/P&gt;&lt;P&gt;          where matnr = i_batch_data_database-matnr.&lt;/P&gt;&lt;P&gt;   endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Check if entered material number is a finished good&lt;/P&gt;&lt;P&gt;if l_mtart = 'FERT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Get all material numbers associate with the batch&lt;/P&gt;&lt;P&gt;    select MATNR into i_data-matnr from MCH1&lt;/P&gt;&lt;P&gt;           where charg = i_batch_data_database-charg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Find the BULK material number&lt;/P&gt;&lt;P&gt;    loop at i_data.&lt;/P&gt;&lt;P&gt;      select MATNR into l_bumat from MARA&lt;/P&gt;&lt;P&gt;                    and mtart = 'HALB'.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Get the BULK batch number&lt;/P&gt;&lt;P&gt;   select CHARG into l_charg from MCH1&lt;/P&gt;&lt;P&gt;          where matnr = l_bumat.&lt;/P&gt;&lt;P&gt;   endselect.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: ravi kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:38:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486433#M227003</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T22:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486434#M227004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only concern i have with your requirement is about the checking the materials for a HALB.  Do you want to only get the first one that is a HALB, or do you need all of them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the modified code,  I didn't want to change too much here, I hope you are awhere that there may be a better way to select your data using inner joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: l_matnr type mara-matnr, "material number
l_charg type mch1-charg, "batch number
l_mtart type mara-mtart, "material type
l_bumat type mara-matnr. "bulk material

data: i_data type table of mcha.
data: w_data like line of i_data.

*-- Select the material type
select &amp;lt;b&amp;gt;Single&amp;lt;/b&amp;gt; MTART into l_mtart from MARA
where matnr = i_batch_data_database-matnr.
&amp;lt;b&amp;gt;*endselect.&amp;lt;/b&amp;gt;

*-- Check if entered material number is a finished good
&amp;lt;b&amp;gt;if sy-subrc = 0 and&amp;lt;/b&amp;gt; l_mtart = 'FERT'.

*-- Get all material numbers associate with the batch
select * into table i_data
*   MATNR into i_data-matnr 
       from MCH1
          where charg = i_batch_data_database-charg.

*-- Find the BULK material number
&amp;lt;b&amp;gt;loop at i_data into w_data.&amp;lt;/b&amp;gt;
select Single MATNR into l_bumat from MARA
&amp;lt;b&amp;gt;          where matnr = w_data-matnr&amp;lt;/b&amp;gt;
            and mtart = 'HALB'.
* If you get a hit for a material, get
* out of the loop.  I'm assuming that you want
* to get the first material that is a HALB.
If sy-subrc = 0.
exit.
endif.
endloop.

*-- Get the BULK batch number
select &amp;lt;b&amp;gt;Single&amp;lt;/b&amp;gt;  CHARG into l_charg from MCH1
        where matnr = l_bumat.
&amp;lt;b&amp;gt;*endselect.&amp;lt;/b&amp;gt; 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I forgot about the itab/wa&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 22:50:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486434#M227004</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T22:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486435#M227005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich,&lt;/P&gt;&lt;P&gt;I hve tried your code.&lt;/P&gt;&lt;P&gt;No errors found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much. I'll test it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: ravi kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 23:10:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486435#M227005</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2006-08-11T23:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486436#M227006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cool, let me know.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please make sure to award points for helpful answers and mark your post as solved when solved completely. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 23:33:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select/m-p/1486436#M227006</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T23:33:54Z</dc:date>
    </item>
  </channel>
</rss>

