<?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 write SQL based on these conditions ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302797#M1990404</link>
    <description>&lt;P&gt;Forget this idea. Just make a selection with the Year &amp;amp; Month GE to the select-option. Make a Sort,  and take the first entry. &lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 09:06:13 GMT</pubDate>
    <dc:creator>FredericGirod</dc:creator>
    <dc:date>2021-01-06T09:06:13Z</dc:date>
    <item>
      <title>How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302793#M1990400</link>
      <description>&lt;P&gt;The conditions for selecting stock valuation data are as blew:&lt;/P&gt;
  &lt;P&gt;&amp;lt;Table&amp;gt;&lt;/P&gt;
  &lt;P&gt; MBEWH&lt;/P&gt;
  &lt;P&gt; MBEW&lt;/P&gt;
  &lt;P&gt;&amp;lt;Condition&amp;gt;&lt;/P&gt;
  &lt;P&gt; MBEWH-WEKEY = [Valuation Area] selected from 1.2 (T001W-BEKEY)&lt;/P&gt;
  &lt;P&gt; MBEWH-MATNR = [Material Number] selected from 3.2 (MARC-MATNR and MARC-MATNR)&lt;/P&gt;
  &lt;P&gt; MBEWH-LFGJA + MBEWH-LFMON &amp;gt;= [PERIOD](LDF_PERIOD gotten from function 'G_PERIOD_GET') + [YEAR](LDF_YEAR) -1&lt;/P&gt;
  &lt;P&gt; MBEW-WEKEY = [Valuation Area] selected from 1. 2&lt;/P&gt;
  &lt;P&gt; MBEW-MATNR = [Material Number] selected from 3. 2&lt;/P&gt;
  &lt;P&gt;&amp;lt;Field&amp;gt;&lt;/P&gt;
  &lt;P&gt; MBEW-LBKUM&lt;/P&gt;
  &lt;P&gt; MBEWH-LBKUM&lt;/P&gt;
  &lt;P&gt; MBEW-SALK3&lt;/P&gt;
  &lt;P&gt; MBEWH-SALK3&lt;/P&gt;
  &lt;P&gt;The details about &amp;lt;MBEWH-LFGJA + MBEWH-LFMON &amp;gt;= [PERIOD](LDF_PERIOD gotten from function 'G_PERIOD_GET') + [YEAR](LDF_YEAR) -1&amp;gt; would be like:&lt;/P&gt;
  &lt;P&gt; MBEWH~LFGJA + MBEWH~LFMON = Low~(Year+Period)-1&lt;/P&gt;
  &lt;P&gt;If there is no entry in MBEWH, copy the existed value from MBEWH where MBEWH~LFGJA + MBEWH~LFMON = Low~(Year+Period) + n(n&amp;gt;=0)&lt;/P&gt;
  &lt;P&gt;If there are no entries in MBEWH for all months, copy the existed value(LBKUM) from MBEW.&lt;/P&gt;
  &lt;P&gt;omg What should I do?&lt;/P&gt;
  &lt;P&gt;anyone here, expecting for your kind help.&lt;/P&gt;
  &lt;P&gt;Thank you all&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 08:40:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302793#M1990400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-01-06T08:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302794#M1990401</link>
      <description>&lt;P&gt;Your functional colleague should stop trying to write pseudo code and give you the expected result. &lt;/P&gt;&lt;P&gt;MBEWH is the history of the MBEW table. It contains the previous value by period of the MBEW. But, not all the period are recorded, just when there is a change. &lt;/P&gt;&lt;P&gt;I think your colleague tries to ask you to get the previous value of the Price valuation of the materials&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 08:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302794#M1990401</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-01-06T08:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302795#M1990402</link>
      <description>&lt;P&gt;How to write the code of  this:&lt;/P&gt;&lt;P&gt;MBEWH~LFGJA + MBEWH~LFMON = Low~(Year+Period)-1&lt;/P&gt;&lt;P&gt;If there is no entry in MBEWH, copy the existed value from MBEWH where MBEWH~LFGJA + MBEWH~LFMON = Low~(Year+Period) + n(n&amp;gt;=0)&lt;/P&gt;&lt;P&gt;If there are no entries in MBEWH for all months, copy the existed value(LBKUM) from MBEW.&lt;/P&gt;&lt;P&gt;Really confused... &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 08:55:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302795#M1990402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-01-06T08:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302796#M1990403</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;miyuriowo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Consider the note &lt;A href="https://launchpad.support.sap.com/#/notes/0000193554" target="_blank"&gt;193554 - Stock/valuation data of previous periods&lt;/A&gt; for detailed explanation of stock history tables logic.&lt;/P&gt;&lt;P&gt;If you are already on S/4HANA see the note &lt;A href="https://launchpad.support.sap.com/#/notes/2600024" target="_blank"&gt;2600024 - Create a Material, updates History Tables, MCHBH, MARCH and MARDH, with past Years (LFGJA) and Periods (LFMON) entries&lt;/A&gt; that explains:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;In ERP the history tables contain only an entry if there was a change within the related period. In S/4HANA the history tables contain an entry for each period (independent on whether there was a change or not).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Dominik Tylczynski&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 09:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302796#M1990403</guid>
      <dc:creator>Dominik_Tylczynski</dc:creator>
      <dc:date>2021-01-06T09:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302797#M1990404</link>
      <description>&lt;P&gt;Forget this idea. Just make a selection with the Year &amp;amp; Month GE to the select-option. Make a Sort,  and take the first entry. &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 09:06:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302797#M1990404</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-01-06T09:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to write SQL based on these conditions ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302798#M1990405</link>
      <description>&lt;P&gt;ok. try as you suggested. &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 09:19:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-sql-based-on-these-conditions/m-p/12302798#M1990405</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-01-06T09:19:36Z</dc:date>
    </item>
  </channel>
</rss>

