‎2009 Jul 01 1:05 PM
hi all,
i have a requirement where we need to fetch the vendors created in the last 6 months. how can we write the code for this?
‎2009 Jul 01 1:10 PM
Hi Poonam,
use table LFA1 and take field ERDAT for created date.
Regards.
Vijay
‎2009 Jul 01 1:14 PM
yes i got it.
but my question was.
select lifnr erdat from lfa1 where erdat = ?????
‎2009 Jul 01 1:15 PM
Either make a query in SQVI using Table LFA1 as per creation Date - ERDAT from LFA1.
Or through SE16 you can download the list.
Regds,
Anil
‎2009 Jul 01 1:20 PM
Hi poonam again,
select-options : s_erdat for lfa1-erdat.
at selection-screen output.
s_erdat-low = sy-datum.
s_erdat-high = sy-datum+4(2) - 6.
s_erdat-option = 'BT'.
s_erdat-sign = 'I'.
append s_erdat.
select lifnr erdat from lfa1 where erdat in s_erdat.
Try.
Regards,
Vijay
‎2009 Jul 01 1:16 PM
Hi,
Try the following.
data v_date type d.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = 6
IMPORTING
NEWDATE = v_date.
select lifnr from lfa1 into it_lfa1 where erdat >= v_date.
Now it_lfa1 will contain all vendors created in the last 6 months.
Hope this helps.
Regards,
Sachin
‎2009 Jul 01 1:31 PM
hi,
ERDAT format is yyyymmdd and sy-datum is mmddyy..
how ll i check this in the select statement??
i have similar question for year too... the question isto check any vendor from bsik table that has been paid in the last two years(AUGBL field)??
‎2009 Jul 02 5:24 AM
please check the FM FORMAT_DATE_4_OUTPUT... this will help you.
sy-datum is also in format yyyymmdd. please check again
Edited by: jeevitha krishnaraj on Jul 2, 2009 6:33 AM
‎2009 Jul 02 5:33 AM
‎2009 Jul 01 1:20 PM
Hi,
In the vendor master table LFA1.. there is a field ERDAT.. which gives the creation date of the record..
fetch all the records created for the last 6 months.
FM MONTHS_BETWEEN_TWO_DATES... will be helpful for getting the moths betweeen 2 dates
‎2009 Jul 02 6:20 AM
Hi Poonam,
One way of writing the code...
DATA : GT_LFA1 TYPE TABLE OF LFA1 WITH HEADER LINE.
DATA : GV_DATE TYPE SY-DATUM.
INITIALIZATION.
* GET THE 6 MONTHS BACK DATE FROM SY-DATUM.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
CURRDATE = SY-DATUM
BACKMONTHS = 6
IMPORTING
NEWDATE = GV_DATE.
START-OF-SELECTION.
SELECT * FROM LFA1 INTO TABLE GT_LFA1
WHERE ERDAT GE GV_DATE.
BREAK APARIMI.
Regards,
Kumar M.
‎2009 Jul 02 6:31 AM