Skip to Content
author's profile photo Former Member
Former Member

i need date that is three months prior to current date or sy-datum

Hi All,

Please help me in this issue.

In the selection screen the lower limit of the select option should be last three months and on high it should be the sy-datum for ex

30.06.2007 30.09.2007

thanks in advance

thanks & regards

Kreddy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

14 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:05 AM

    Hi,

    you got the date

    now subtract 3 from the month

    and use this fm this will give the last day of the particular month

    for eg

    current month required

    3 12 and -1 for year

    4 1

    5 2

    like this

    for

    2 11 -1 for year

    1 10 and -1 for year

    then use it

    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

    EXPORTING

    DAY_IN = R_FDATE-HIGH

    IMPORTING

    LAST_DAY_OF_MONTH = G_LTDT

    EXCEPTIONS

    DAY_IN_NO_DATE = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    regards,

    Venkatesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:05 AM

    Use the Function module 'CCM_GO_BACK_MONTHS' ...

    when u execute this function module give the Date (which date u need) and the number of months you need to go back as input parameter.... it will give u that previous date..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:05 AM

    Hi,

    chk out this link:

    table maintenance

    Hope its helpful.

    <b>CCM_GO_BACK_MONTHS</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:10 AM

    hi reddy,

    1. use the FM

    HR_JP_ADD_MONTH_TO_DATE

    2. Pass -3

    in the parameter IV_MONTHCOUNT

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:11 AM

    Hi

    Subtract 3 in month and validate if it is less than 1 then move it to 12 like this

    Regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:12 AM

    Hi Reddy,

    The below code should guide you to get your work done

    ____________________________________________________________________

    gv_to_date = sy-datum.

    gv_from_date = sy-datum - 90.

    SELECT-OPTIONS s_date FOR sy-datum DEFAULT gv_from_date TO gv_to_date.

    ____________________________________________________________________

    Pl. rewards points for useful answer.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 11, 2007 at 10:13 AM

    Hi,

    take the help from this code :

    data : date type sy-datum, out_date type sy-datum.

    date = sy-datum.

    CALL FUNCTION 'J_1H_CAL_DATE_IN_INTERVAL'

    EXPORTING

    date = date

    days = '00'

    months = '03'

    SIGNUM = '-'

    years = '00'

    IMPORTING

    CALC_DATE = out_date.

    write :/ out_date.

    I hope, it can help you,

    Reward Points, if Helpful,

    Sandeep Kaushik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:15 AM

    Hi,

    Check this FM:

    HR_ECM_ADD_PERIOD_TO_DATE

    Import parameters - Value

    ORIG_DATE - 11.09.2007

    NUM_DAYS - 00

    NUM_MONTHS - 03

    NUM_YEARS - 00

    SIGNUM - -

    Export parameters Value

    RESULT_DATE - 11.06.2007

    IS_OK - X

    best regards,

    Thangesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:16 AM

    HI,

    In INITIALIZATION

    set sy-datum to high.

    use function module <b>RE_ADD_MONTH_TO_DATE</b>

    passing date as sy-datum and months as -3

    and put the result of this FM to low.

    Enjoy SAP.

    Pankaj Singh.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:17 AM

    hi,

    Use the Function module <b>'CCM_GO_BACK_MONTHS'</b> ...

    With Rgds,

    S.Barani

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.