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

FM to get the previous date

Hi

Pls tell me to get the previous date of the the date.

Thanx in advance,

Parvez.

Add comment
10|10000 characters needed characters exceeded

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2006 at 12:34 PM

    Hi Venu,

    Use this Function Module

    data: prev_date like (type of calc_date).

    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

    EXPORTING

    date = sy-datum

    days = 1

    months = 0

    signum = '-'

    years = 0

    IMPORTING

    calc_date = prev_date.

    This should surely work.

    Thanks and Regards,

    Prashanth

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2006 at 12:33 PM

    Simply subtract from today.

    data: yesterday type sy-datum.
    
    yesterday = sy-datum - 1.

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2006 at 12:31 PM

    data w_date type sy-datum.

    w_date = w_date - 1.

    write: / w_date. "yetserday

    ~Suresh

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2006 at 12:32 PM

    u can subtract 1 from present date

    previous_date = present_date - 1.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2006 at 12:32 PM

    hi,

    No need of any fm.

    Just subtract the no of the days from the days. It gives the previous date.

    Regards,

    Sailaja/.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2006 at 08:27 PM

    Hello Venu

    If you also need function modules dealing with <b>working days</b> you will find useful FMs in function group <b>FB00</b>.

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2006 at 08:32 PM

    Hi,

    Use the below logic,

    data lastdate like sy-datum.

    lastdate = sy-datum - 1.

    Cheers,

    Abdul Hakim

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2006 at 08:51 PM

    Hi Venu,

    Check,

    REPORT Z13708_TEST11 .

    data : s_date type sy-datum.

    data : s_table type table of CASDAYATTR with header line .

    start-of-selection.

    CALL FUNCTION 'DAY_ATTRIBUTES_GET'

    • EXPORTING

    • FACTORY_CALENDAR = ' '

    • HOLIDAY_CALENDAR = ' '

    • DATE_FROM = s_date

    • DATE_TO = SY-DATUM

    • LANGUAGE = SY-LANGU

    • IMPORTING

    • YEAR_OF_VALID_FROM =

    • YEAR_OF_VALID_TO =

    • RETURNCODE =

    TABLES

    DAY_ATTRIBUTES = s_table

    .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    s_date = s_table-date - 1.

    write : s_date.

    Regards,

    Azaz.

    Add comment
    10|10000 characters needed characters exceeded