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

About SY-DATUM

Hi,

I am Using System Variable sy-datum.

data xyz type d.

xyz = sy-datum.

sy-datum is in the format YYYYMMDD

but i need to assign xyz as DDMMYYYY.

How to change the format through Programming.

Points will be awarded.

Regards,

jayasimha jangam

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

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

    hi,

    U can use,

    CONVERT_DATE_TO_EXTERNAL : Converts date from system storage format to users specified display format .

    Also,

    http://www.sapdevelopment.co.uk/fmodules/fmssap.htm

    might help you.

    regards,

    pavan.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 07:24 AM

    Hi,

    Use FM:CONVERT_DATE_TO_EXTERNAL.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 07:25 AM

    Hi,

    Use FM to convert the format

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    date_internal = lv_newdate

    IMPORTING

    date_external = lv_newdate1

    EXCEPTIONS

    date_internal_is_invalid = 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,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi,

    Try,

    xyz0(2) = sy-datum6(2).

    xyz2(2) = sy-datum4(2).

    xyz4(4) = sy-datum0(4).

    Regards,

    Vani

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi

    jayasimha

    how ever u assign the system internalyy takes it as yyyymmdd

    it is the only format tht system will treat internally

    if in the o/p u want u r format to be printed go to SYSTEM in the menu

    in tht user profile in tht own data goto defaults page and change the format u required

    plzzzz reward if usefulll

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi,

    if in the o/p u want u r format to be printed go to SYSTEM in the menu

    in tht user profile in tht own data goto defaults page and change the format u required

    Reward points if it is useful plzzzz.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 08:40 AM

    Hi Jayasimha,

    You can use offset method for this.

    xyz4(4) = sy-datum0(4).

    xyz2(2) = sy-datum4(2).

    xyz0(2) = sy-datum6(2).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 09:06 AM

    Try this

    Data: abc(10).

    Concatenate sy-datum6(2) sy-datum4(2) sy-datum(4) into abc.

    Write : / abc.

    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.