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: 

Date Conversion

former_member184495
Active Contributor
0 Kudos

hi,

i have to create a report which uploads a flat file with a date field, this date field would vary according to country (in the flat file),

now when i upload this file it fires me an error saying that it should be of format '__:__:____' is this because my end settings are of this format,

please suggest on how to cope this problem.

is there a function module which would handle this...

cheers,

Aditya.

1 ACCEPTED SOLUTION

vinod_gunaware2
Active Contributor
0 Kudos

Country-specific and User-specific Output Formats

The output formats of number and date fields are defined in the user master record of the individual program user. You can change these settings from within your program, using this statement:

Syntax

is SPACE, the system does not read table T005X but uses the settings in the user master record. In this case, SY-SUBRC is always zero.

Maintaining table T005X is part of Customizing. However, you can use System ® Services ® Table maintenance to display or change entries.

REPORT demo_list_set_country LINE-SIZE 40.

DATA: num TYPE p DECIMALS 3 VALUE '123456.789'.

ULINE.

WRITE: / 'INITIAL:'.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'US'.

WRITE: / 'US, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'GB'.

WRITE: / 'GB, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'DE'.

WRITE: / 'DE, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'XYZ'.

WRITE: / 'XYZ, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY space.

WRITE: / 'SPACE, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum

regards

vinod

4 REPLIES 4

vinod_gunaware2
Active Contributor
0 Kudos

Use write statement.

use f1 or goto pattarn -> WRITE -> FIELD(specify name)->

Multiple selection(yellow arrow button button)-> for date fields (Chck box and radio button)

WRITE - Formatting options

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

U can use into another variable.

and then use that particular variable.

The Time zone is defined in table TTZCU(refer to note: 91667) for System wide and Client wide.

If you want it for individual user, go to SU01 under the default Personal Time zone sections.

Settings for individual users is done when you have global users in different time zone.

For Local users only, go to SM30 and change the table TTZCU. e.g. UTC+8

This is done when your Spool time is incorrect.

<b>OY01</b> - Country Global Parameters -> Double click on the country code

<b>SU01</b> - Maintain users -> Click Defaultsbutton

regards

vinod

vinod_gunaware2
Active Contributor
0 Kudos

Country-specific and User-specific Output Formats

The output formats of number and date fields are defined in the user master record of the individual program user. You can change these settings from within your program, using this statement:

Syntax

is SPACE, the system does not read table T005X but uses the settings in the user master record. In this case, SY-SUBRC is always zero.

Maintaining table T005X is part of Customizing. However, you can use System ® Services ® Table maintenance to display or change entries.

REPORT demo_list_set_country LINE-SIZE 40.

DATA: num TYPE p DECIMALS 3 VALUE '123456.789'.

ULINE.

WRITE: / 'INITIAL:'.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'US'.

WRITE: / 'US, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'GB'.

WRITE: / 'GB, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'DE'.

WRITE: / 'DE, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY 'XYZ'.

WRITE: / 'XYZ, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum.

ULINE.

SET COUNTRY space.

WRITE: / 'SPACE, SY-SUBRC:', sy-subrc.

WRITE: / num, sy-datum

regards

vinod

Former Member
0 Kudos

Hi Aditya,

To write sy-datum in char(10) in user/system format.

You can wirte it by using "EDIT MASK" by using it in "WRITE TO" statement.

WRITE SY-DATUM TO TEMP USING EDIT MASK "__:__:____"

You can mention ur format in the double codes.

Regards,

Anjali

Former Member
0 Kudos

Hai Aditya

Check the following Date Conversions

Option

... DD/MM/YY

Option

... MM/DD/YY

Effect

If f is a date field (type D ), the date is output with a 2-character year as specified in the user's master record. Both of these formatting options have the same value.

Option

... DD/MM/YYYY

Option

... MM/DD/YYYY

Effect

If f is a date field (type D ), the date is output with a 4-character year as specified in the user's master record. Both of these formatting options have the same value.

Option

... DDMMYY

Option

... MMDDYY

Effect

Date formatting like the additions ... DD/MM/YY and ... MM/DD/YY , but without separators.

Option

... YYMMDD

Effect

If f is a date field (type D ), the date is output in the format YYMMDD (YY = year, MM = month, DD = Day).

Thanks & Regards

Sreenivasulu P