<?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: please explain me the code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636238#M606541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;***&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This part will create a range variable. The  range variable acts like Select-Options and &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;contains of the fields:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sign&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;options&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;low&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;high&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;RANGES : r_matnr FOR mara-matnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The internal table has perhaps more fields and in an different order than just &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;lifnr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;matnr.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;using CORRESPONDING FIELDS will do a name mapping. That means, this&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table has to have at least fields with the same name.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;SELECT lifnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE t_data&lt;/P&gt;&lt;P&gt;FROM zdata&lt;/P&gt;&lt;P&gt;WHERE lifnr = p_lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Now the report will loop over the just filled table and fill the range &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;object with the material number into the LOW field.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;LOOP AT t_data .&lt;/P&gt;&lt;P&gt;r_matnr-sign = 'I' .&lt;/P&gt;&lt;P&gt;r_matnr-option = 'EQ' .&lt;/P&gt;&lt;P&gt;r_matnr-low = t_data-matnr .&lt;/P&gt;&lt;P&gt;APPEND r_matnr .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the next step, the code performs another select on an SAP table. This time&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;it uses the ranges variable and another table with the FOR ALL ENTRIES in &amp;lt;itab&amp;gt; to &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get the values (mblnr, matnr, menge).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;well... there are some limitations on the ranges table within an SQL where condition.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mblnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;menge&lt;/P&gt;&lt;P&gt;INTO TABLE lt_menge&lt;/P&gt;&lt;P&gt;FROM mseg&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_itab&lt;/P&gt;&lt;P&gt;WHERE mblnr = lt_itab-mblnr&lt;/P&gt;&lt;P&gt;AND matnr IN r_matnr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2007 19:42:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-24T19:42:09Z</dc:date>
    <item>
      <title>please explain me the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636237#M606540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RANGES : r_matnr FOR mara-matnr . &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT lifnr&lt;/P&gt;&lt;P&gt;         matnr&lt;/P&gt;&lt;P&gt;            INTO CORRESPONDING FIELDS OF TABLE t_data&lt;/P&gt;&lt;P&gt;    FROM zdata&lt;/P&gt;&lt;P&gt;   WHERE lifnr = p_lifnr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT t_data .&lt;/P&gt;&lt;P&gt;    r_matnr-sign   = 'I' .&lt;/P&gt;&lt;P&gt;    r_matnr-option = 'EQ' .&lt;/P&gt;&lt;P&gt;    r_matnr-low    = t_data-matnr .&lt;/P&gt;&lt;P&gt;    APPEND r_matnr .&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mblnr&lt;/P&gt;&lt;P&gt;         matnr&lt;/P&gt;&lt;P&gt;            menge&lt;/P&gt;&lt;P&gt;    INTO TABLE lt_menge&lt;/P&gt;&lt;P&gt;    FROM mseg&lt;/P&gt;&lt;P&gt;     FOR ALL ENTRIES IN lt_itab&lt;/P&gt;&lt;P&gt;   WHERE mblnr = lt_itab-mblnr&lt;/P&gt;&lt;P&gt;     AND matnr IN r_matnr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 17:10:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636237#M606540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T17:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: please explain me the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636238#M606541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;***&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This part will create a range variable. The  range variable acts like Select-Options and &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;contains of the fields:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sign&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;options&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;low&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;high&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;RANGES : r_matnr FOR mara-matnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The internal table has perhaps more fields and in an different order than just &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;lifnr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;matnr.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;using CORRESPONDING FIELDS will do a name mapping. That means, this&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table has to have at least fields with the same name.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;SELECT lifnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE t_data&lt;/P&gt;&lt;P&gt;FROM zdata&lt;/P&gt;&lt;P&gt;WHERE lifnr = p_lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Now the report will loop over the just filled table and fill the range &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;object with the material number into the LOW field.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;LOOP AT t_data .&lt;/P&gt;&lt;P&gt;r_matnr-sign = 'I' .&lt;/P&gt;&lt;P&gt;r_matnr-option = 'EQ' .&lt;/P&gt;&lt;P&gt;r_matnr-low = t_data-matnr .&lt;/P&gt;&lt;P&gt;APPEND r_matnr .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the next step, the code performs another select on an SAP table. This time&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;it uses the ranges variable and another table with the FOR ALL ENTRIES in &amp;lt;itab&amp;gt; to &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get the values (mblnr, matnr, menge).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;well... there are some limitations on the ranges table within an SQL where condition.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mblnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;menge&lt;/P&gt;&lt;P&gt;INTO TABLE lt_menge&lt;/P&gt;&lt;P&gt;FROM mseg&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_itab&lt;/P&gt;&lt;P&gt;WHERE mblnr = lt_itab-mblnr&lt;/P&gt;&lt;P&gt;AND matnr IN r_matnr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 19:42:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636238#M606541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T19:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: please explain me the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636239#M606542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello madan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RANGES : r_matnr FOR mara-matnr . &lt;/P&gt;&lt;P&gt;"""range is being declared for material number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************&lt;/P&gt;&lt;P&gt; SELECT lifnr                         "Account Number of Vendor or Creditor&lt;/P&gt;&lt;P&gt;              matnr                      "Material number&lt;/P&gt;&lt;P&gt; INTO CORRESPONDING FIELDS OF &lt;/P&gt;&lt;P&gt;             TABLE t_data          "respective fields of internal table&lt;/P&gt;&lt;P&gt;              FROM zdata           "Source table&lt;/P&gt;&lt;P&gt;  WHERE &lt;/P&gt;&lt;P&gt;            lifnr = p_lifnr."p_lifnr is used  as selection criterion&lt;/P&gt;&lt;P&gt;"From the naming convention P_lifnr looks like a parameter entered by user &lt;/P&gt;&lt;P&gt;"So all material numbers and A/C numbers for a particular account number are being selected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************&lt;/P&gt;&lt;P&gt;"The following process is defining a range.r_matnr will contain all Material numbers&lt;/P&gt;&lt;P&gt;which are available for the account number P_lifnr &lt;/P&gt;&lt;P&gt;eg:imagine that you have 1,2,3  matnr having LIFNR '001' from ZDATA&lt;/P&gt;&lt;P&gt;then:::::after this loop r_matnr eill contain 1,2,3&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT t_data .&lt;/P&gt;&lt;P&gt;r_matnr-sign = 'I' .&lt;/P&gt;&lt;P&gt;r_matnr-option = 'EQ' .&lt;/P&gt;&lt;P&gt;r_matnr-low = t_data-matnr .&lt;/P&gt;&lt;P&gt;APPEND r_matnr .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"select X from Y where matnr IN r_matnr" means&lt;/P&gt;&lt;P&gt;it will select field X from table Y &lt;/P&gt;&lt;P&gt;where material number = '1' or '2' or '3'...(based on matrn in the t_data)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are selecting from MSEG some fields which have material numbers in ZDATA for a particular &lt;/P&gt;&lt;P&gt;account number and which have mblnr values in lt_itab...ie records which have mblnr from lt_itab&lt;/P&gt;&lt;P&gt;and material number from ZDATA for the account number from the database table  mseg&lt;/P&gt;&lt;P&gt;SELECT mblnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;menge&lt;/P&gt;&lt;P&gt;INTO TABLE lt_menge&lt;/P&gt;&lt;P&gt;FROM mseg&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_itab&lt;/P&gt;&lt;P&gt;WHERE mblnr = lt_itab-mblnr&lt;/P&gt;&lt;P&gt;AND matnr IN r_matnr &lt;/P&gt;&lt;P&gt;***********************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 09:46:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636239#M606542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T09:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: please explain me the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636240#M606543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Madan, it is good you have found the performance &amp;amp; tuning forum. Here you can ask any beginner question you like, as the name indicates the forum is not restricted to performance or tuning related issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RANGES is a way of saying you miss the free-ranging shepherd life of previous generations. A very poetic statement to start your program, and a fine way to say that city life is not always a dance on roses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT denotes exclusivity. Not everyone, just the selected will be eligable for what comes next. Sort of like many religions where you are doomed unless you are a believer. As there are many different religions, we are either doomed in any case (all religions correct) or not doomed at all (all religions mistaken).&lt;/P&gt;&lt;P&gt;As you can see the selected few will be guided INTO a sheltered space and remembered by the program. In order to be among the eligable your life number (lifnr) must be one that has been picked by the gods (p_lifnr).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP should be pretty self-explanatory for a programmer. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND is a mis-spelling. It should be ATTEND. It is important to attend to the ceremonies of your religion if you want to be among the select few.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally the polyteistic nature of our world is referenced towards the end of the program, where the materialism of our society is hinted at.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please don't hesitate to ask for interpretations of the next program you write. We are all here to help you with the basics and don't expect you to spend too much time learning the elementary things on your own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;&amp;lt;b&amp;gt;Remember:&amp;lt;/b&amp;gt; Please reward all helpful contributions.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2007 09:08:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636240#M606543</guid>
      <dc:creator>KjetilKilhavn</dc:creator>
      <dc:date>2007-07-30T09:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: please explain me the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636241#M606544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kjetil, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10 points for your poetic answer. Made my day. &lt;/P&gt;&lt;P&gt;Will be happy for the rest of the morning. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1 point if I could give to Madan for such a lazy question. Grrr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best, Mark.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 15:50:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-me-the-code/m-p/2636241#M606544</guid>
      <dc:creator>former_member374</dc:creator>
      <dc:date>2007-08-02T15:50:26Z</dc:date>
    </item>
  </channel>
</rss>

