Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

date formats

Former Member
0 Likes
2,075

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?

11 REPLIES 11
Read only

Former Member
0 Likes
1,724

Hi Poonam,

use table LFA1 and take field ERDAT for created date.

Regards.

Vijay

Read only

0 Likes
1,724

yes i got it.

but my question was.

select lifnr erdat from lfa1 where erdat = ?????

Read only

0 Likes
1,724

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

Read only

0 Likes
1,724

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

Read only

Former Member
0 Likes
1,724

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

Read only

0 Likes
1,724

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)??

Read only

0 Likes
1,724

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

Read only

0 Likes
1,724

Hi,

Even the format of the sy-datum is YYYYMMDD.

Read only

Former Member
0 Likes
1,724

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

Read only

Former Member
0 Likes
1,724

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.

Read only

Former Member
0 Likes
1,724

This message was moderated.