2015 Jan 19 5:04 PM
Hi,
I have a small query. I use the changeddocument_read to fetch the changes on SORT field on LFA1.
I get all the values in internal table.Could you please tell me how to fetch the last changed record ?
When i use SORT itab by date descending time descending , it works like date ascending and time descending.
I need to fetch the last changed using UDATE and UTIME latest value.
Can you help.
Thanks
AS
2015 Jan 20 3:01 AM
Hi AS
It`s weird, SORT itab BY udate DESCENDING utime DESCENDING. should works fine.
Please past your code here, then we can further check.
regards,
Archer
2015 Jan 20 6:08 AM
DATA : lt_lfa1 TYPE STANDARD TABLE OF lfa1,
wa_lfa1 TYPE lfa1.
SELECT * FROM lfa1 UP TO 30 ROWS INTO TABLE lt_lfa1.
IF NOT lt_lfa1[] IS INITIAL.
SORT lt_lfa1 by UPDAT DESCENDING UPTIM DESCENDING.
LOOP AT lt_lfa1 INTO wa_lfa1.
WRITE: / wa_lfa1-LIFNR, wa_lfa1-UPDAT, wa_lfa1-uptim.
ENDLOOP.
ENDIF.
2015 Jan 20 7:14 AM
Hi Swarna,
If you are trying to fetch latest record (last changed, can be newly added Vendor) from LFA1 irrespective to LIFNR, you can use following select statement:
SELECT SINGLE LIFNR MAX( UPDAT ) MAX( UPTIM ) FROM LFA1 INTO LS_LFA1
WHERE LIFNR = P_LIFNR
GROUP BY LIFNR UPDAT UPTIM.
Otherwise, if you are looking for the latest change in a log of particular vendor, you should fetch data from tables like CDHDR CDPOS.
To get the log,
Pass OBJCETCLASS as 'KRED', OBJECTID as <LIFNR> (with leading zeros) and TCODE as 'XK02'.
To get the log details,
Get the CHANGENR field from above statement and pass that to CDPOS. You will get detailed log.
Regards,
Vijay
2015 Jan 20 9:26 AM
Hi ,
Try to use Sort syntax as SORT itab by date descending and time descending.
Regards,
Vinodkumar.