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

Related to dates

Hi Experts,

I want to ask a very basic question. If I need to add 90days to system date(sy-datum) or any particular date, Shall I need to convert the date to days or can I do it directly? It would be helpful if anybody can provide me examples of working with dates. Also, please explain the concept of offsets while working with dates with examples?

Thanks in advance,

Sangeeta.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:57 AM

    Hi Sangeeta,

    You can directly add 90 to sy-datum or any other date -- no need of any conversion.

    Reward points if helpful.

    Regards

    Renuka

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:37 AM

    Hello Sangeeta,

    I'm sending the code... It shows possible ways to add days to date.

    but it is not suggestable to add days directly to sy-datum... better copy date into some other field and add days...

    here is the code...

    REPORT zssr_date_add .

    DATA: date TYPE sy-datum.

    START-OF-SELECTION.

    date = sy-datum.

    WRITE: / date.

    date = date + 90.

    WRITE: / date.

    sy-datum = sy-datum + 90.

    WRITE: / sy-datum.

    <b>AWARD THE POINTS IF IT IS HELPFUL..</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 11, 2007 at 07:01 AM

    Hi,

    U can add directly....

    chaeck this code

    data: l_date type sy-datum.

    l_date = sy-datum.

    write: ' before: ', l_date.

    l_date = l_date + 90.

    write : / 'After + 90 :', l_date.

    ---Patil

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:03 AM

    Hi Sangeetha,

    There are so many Function Modules on the ABAP side for adding days to a partciuar date . You can use anyone of them like TV_GO_BACK_N_DAYS

    The date in ABAP is internally stored as YYYYMMDD. So if u want to know the month corresponding to a date , then u should use it as

    Date+4(2).

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:58 AM

    Hi

    No need

    simply add the no of days to date field

    it will add and give the correct date by itself

    new date1 = sy-datum + 30.

    Reward points for useful Answers

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:58 AM

    Hi

    You can directly add the required number of days. It will take care by itself. No need for any conversion to days.

    In SAP the default date format is YYYYMMDD. You use CONCATENATE statement based on the output form in which you need the date as.

    like YYMMDD, MM/DD/YY etc...for some standard formats, you do have FMs.

    Regards

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:02 AM

    hi check this,

    report z_sample.

    data: dat type dats,

    dat1 type dats.

    start-of-selection.

    dat = sy-datum.

    write : dat.

    dat1 = dat + 7.

    write :/ dat1.

    end-of-selection.

    u can add directly 90days to system date. that's not a problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:21 AM

    hi,

    can i get material stock register like this format ? examp-

    material- 1300

    description-diesel

    opening stock/ value receipt/value issue / value closing stock / value

    10 ltrs 20ltrs 5 ltrs 25 ltrs

    350 inr 700 inr

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 07:34 AM

    hi ,

    u can directly add.

    data: l_date type sy-datum.

    l_date = sy_datum + 90.

    regards,

    sudha

    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.