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: 

Changing the date formats

Amey-Mogare
Contributor
0 Kudos

Dear All,

I am getting two types of dates from a query to table CRMD_ORDERADM_H. One is of type DATS and other is of type DEC with char length 15.

Now I am exporting these two dates to a excel file where i want to display it into dd.mm.yyyy format.

How can I achieve this?

Regards,

Amey Mogare

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Use the command WRITE like follows:

... DD/MM/YY | MM/DD/YY

| DD/MM/YYYY | MM/DD/YYYY

| DDMMYY | MMDDYY

| YYMMDD

Effect: These additions influence the output of data objects of the data type d. In all other data types, the addition is ignored.

The content of a data object of type d is interpreted as a valid date in the format YYYYMMDD and is output as follows for the individual additions:

DD/MM/YY and MM/DD/YY:

Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.

DD/MM/YYYY und MM/DD/YYYY:

Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.

DDMMYY und MMDDYY:

Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.

YYMMDD:

This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.

If the output length is defined implicitly or specified using len, this is used. If it is too short, the edited output is cut off to the right. If the output length is specified using * or **, it is set to the length of the specified edit mask (6, 8, or 10).

Note

The behavior for abbreviation differs from the output of a data in accordance with the user master record, where the separator is removed first and then cut off.

Example

The output of the WRITE statement is, for example, "230402".

WRITE sy-datum TO lv_variable YYMMDD.

Regards.

3 REPLIES 3

former_member181995
Active Contributor
0 Kudos

use offset of these fields with concatenate into other field .

Amit.

Former Member
0 Kudos

Hello,

Use the command WRITE like follows:

... DD/MM/YY | MM/DD/YY

| DD/MM/YYYY | MM/DD/YYYY

| DDMMYY | MMDDYY

| YYMMDD

Effect: These additions influence the output of data objects of the data type d. In all other data types, the addition is ignored.

The content of a data object of type d is interpreted as a valid date in the format YYYYMMDD and is output as follows for the individual additions:

DD/MM/YY and MM/DD/YY:

Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.

DD/MM/YYYY und MM/DD/YYYY:

Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.

DDMMYY und MMDDYY:

Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.

YYMMDD:

This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.

If the output length is defined implicitly or specified using len, this is used. If it is too short, the edited output is cut off to the right. If the output length is specified using * or **, it is set to the length of the specified edit mask (6, 8, or 10).

Note

The behavior for abbreviation differs from the output of a data in accordance with the user master record, where the separator is removed first and then cut off.

Example

The output of the WRITE statement is, for example, "230402".

WRITE sy-datum TO lv_variable YYMMDD.

Regards.

0 Kudos

Hi,

thank u for the prompt response.

following are the two date types tat i m receiving as a result of select query into internal table it_crmd_orderadm_h

it_crmd_orderadm_h-posting_date of type DATS with length 8

and

it_crmd_orderadm_h-changed_at of type DEC with length 15.

Now if i want to express them in dd.mm.yyyy and assign them to fields of a other internal table say it_final.

So what should be the data type of these two fields in it_final?

and how do i convert it_crmd_orderadm_h-posting_date and it_crmd_orderadm_h-changed_at into dd.mm.yyyy format??

regards,

Amey Mogare

Edited by: Amey Mogare on Sep 2, 2008 1:22 PM

Edited by: Amey Mogare on Sep 2, 2008 1:23 PM