<?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: latest posting date from table MKPF in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426204#M1050983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done so:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort it_mseg_mkpg by matnr werks lgort budat.
loop at it_mard.
  loop at it_mseg_mkpf where matnr = it_mard-matnr
    and werks = it_mard=werks
    and lgort = it_mard-lgort.
    at end of budat.
      it_final-budat = it_mseg_mkpf-budat.
    endat.
  endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Sep 2008 04:38:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-09T04:38:21Z</dc:date>
    <item>
      <title>latest posting date from table MKPF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426203#M1050982</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 want to retrive the latest posting date from table MKPF. Here I am using the MARD,MSEG,MKPF tables to get the latest posting date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_mard[] is initial.&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;mblnr a&lt;/SUB&gt;mjahr a&lt;SUB&gt;matnr a&lt;/SUB&gt;werks a&lt;SUB&gt;lgort b&lt;/SUB&gt;budat&lt;/P&gt;&lt;P&gt;  into table it_mseg_mkpf&lt;/P&gt;&lt;P&gt;   from mseg as a mkpf as b&lt;/P&gt;&lt;P&gt;   on a&lt;SUB&gt;mblnr = b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;  and a&lt;SUB&gt;mjahr = b&lt;/SUB&gt;mjahr&lt;/P&gt;&lt;P&gt;  for all entries in it_mard&lt;/P&gt;&lt;P&gt;  where a~matnr = it_mard-matnr&lt;/P&gt;&lt;P&gt;  and    a~werks = it_mard-werks&lt;/P&gt;&lt;P&gt;  and   a~lgort   = it_mard-lgort.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;sort it_mseg_mkpg decending by matnr werks lgort budat.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;loop at it_mard.&lt;/P&gt;&lt;P&gt;clear it_mkpf_mseg.&lt;/P&gt;&lt;P&gt;read table it_mseg_mkpf with key matnr = it_mard-matnr&lt;/P&gt;&lt;P&gt;                                                  werks  = it_mard=werks&lt;/P&gt;&lt;P&gt;                                                  lgort    = it_mard-lgort&lt;/P&gt;&lt;P&gt;                                                  binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;     it_final-budat = it_mseg_mkpf-budat.&lt;/P&gt;&lt;P&gt;     endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from the above code  i need to rereive the latest posting date    , but when I am reading from internal table it is giving the sy-subrc is 4.  i know when we use binary search , the standard table should be ascedning order. but here I need to use descedning order.&lt;/P&gt;&lt;P&gt;please hhelp i this.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 04:16:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426203#M1050982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T04:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: latest posting date from table MKPF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426204#M1050983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done so:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort it_mseg_mkpg by matnr werks lgort budat.
loop at it_mard.
  loop at it_mseg_mkpf where matnr = it_mard-matnr
    and werks = it_mard=werks
    and lgort = it_mard-lgort.
    at end of budat.
      it_final-budat = it_mseg_mkpf-budat.
    endat.
  endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 04:38:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426204#M1050983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T04:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: latest posting date from table MKPF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426205#M1050984</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;1. Check Storage location (&lt;STRONG&gt;LGORT&lt;/STRONG&gt;) value available in the internal &lt;/P&gt;&lt;P&gt;    table &lt;STRONG&gt;it_mseg_mkpf&lt;/STRONG&gt;. Some case no value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Remove the &lt;STRONG&gt;binary search&lt;/STRONG&gt; after u try again. Like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_mard.&lt;/P&gt;&lt;P&gt;clear it_mkpf_mseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;read table it_mseg_mkpf with key matnr = it_mard-matnr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                                                  &lt;STRONG&gt;werks = it_mard=werks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                                                   &lt;STRONG&gt;lgort  = it_mard-lgort.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;it_final-budat = it_mseg_mkpf-budat.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. sort it_mseg_mkpg DESCENDING BY budat matnr werks lgort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. For all material (it_mard) may be or may not be there in the MSEG table.&lt;/P&gt;&lt;P&gt;    So for some case SY-SUBRC = 4  will give.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Durai.V&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Durai V on Sep 9, 2008 6:50 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2008 04:47:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/latest-posting-date-from-table-mkpf/m-p/4426205#M1050984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-09T04:47:17Z</dc:date>
    </item>
  </channel>
</rss>

