Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

latest posting date from table MKPF

hi all,

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.

if not it_mard[] is initial.

select amblnr amjahr amatnr awerks algort bbudat

into table it_mseg_mkpf

from mseg as a mkpf as b

on amblnr = bmblnr

and amjahr = bmjahr

for all entries in it_mard

where a~matnr = it_mard-matnr

and a~werks = it_mard-werks

and a~lgort = it_mard-lgort.

if sy-subrc eq 0.

sort it_mseg_mkpg decending by matnr werks lgort budat.


loop at it_mard.

clear it_mkpf_mseg.

read table it_mseg_mkpf with key matnr = it_mard-matnr

werks = it_mard=werks

lgort = it_mard-lgort

binary search.

if sy-subrc eq 0.

it_final-budat = it_mseg_mkpf-budat.



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.

please hhelp i this.



Former Member
Not what you were looking for? View more on this topic or Ask a question