Application Development 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: 

About SY-DATUM

Former Member
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

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.

former_member188829
Active Contributor
0 Kudos

Hi,

Use FM:CONVERT_DATE_TO_EXTERNAL.

former_member386202
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

Try,

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

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

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

Regards,

Vani

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member1052991
Active Participant
0 Kudos

Hi Jayasimha,

You can use offset method for this.

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

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

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

Former Member
0 Kudos

Try this

Data: abc(10).

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

Write : / abc.