Application Development and Automation 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: 
Read only

Date Format(4.6c)

Former Member
0 Likes
1,183

Hi,

I need to assign my date field in this format '09/09/2008'to a standard FM.But my current date format is '09092008'.

Note:My required date format has to be assigne to sy-datum which is of 8 char long.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,141

>

> Hi,

> I need to assign my date field in this format '09/09/2008'to a standard FM.But my current date format is '09092008'.

>

> Note:My required date format has to be assigne to sy-datum which is of 8 char long.

Since you already using type Sy-datum than no need of any conversion system would automatically convert.

Reason:Type SYDATS is the domain of Sy-datum and its length is char8 but output characteristics is length is 10.

Hi,

I need to assign my date field in this format '09/09/2008'to a standard FM.But my current date format is '09092008'.

Note:My required date format has to be assigne to sy-datum which is of 8 char long.

7 REPLIES 7
Read only

Former Member
0 Likes
1,141

Hi!!

you can try with using EDIT MASK to move the field into another variable .

eg: data : v_date like sy-datum.

data : v_date1(10).

v_date = sy-datum.

write v_date using EDIT MASK '__/__/____' to v_date1.

and pass v_date1 to ur FM .

Hope this would help you .

Read only

Former Member
0 Likes
1,141

Hi,

Hi,

Function module is there to handle this.

SLS_MISC_CONVERT_TO_DATE

Read only

Former Member
0 Likes
1,141

hii

use following code

Data : wa_date type dats value '09092008',
          wa_date1(10).
data : val(1) type c value '/'.

wa_date1 = wa_date.

concatenate wa_date+0(2) wa_date+2(2) wa_date+4(4) into wa_date1
separated by val.

Write : / wa_date1.

regards

twinkal

Read only

Former Member
0 Likes
1,141

Hi,

Please try the below code

ld_curr_date = '09092008'.

concatenate ld_curr_date0(2) '/' ld_curr_date2(2) '/' ld_curr_date+4(4) into ld_date.

Now you can use this ld_date in ur FM.

say u get the output from ur FM in variable ld_date1 with format '09/09/2008'

convert it to sy-datum.

concatenate ld_date16(4) ld_date13(2) ld_date1+0(2) into ld_date2.

now ld_date is of char 8 length.

Note: ld_date and ld_date1 would be of length 10.

Regards,

Surinder

Read only

Former Member
0 Likes
1,141

Hi,

HRGPBS_HESA_DATE_FORMAT

CONVERT_DATE_TO_INTERN_FORMAT

Use the above FMs.

Regards,

Harish

Read only

Former Member
0 Likes
1,141

Hi,

DATA :
 w_date      TYPE sy-datum,
 w_string(8) VALUE '20080909'.

w_date = w_string.
WRITE: w_date.

Regards

Adil

Read only

Former Member
0 Likes
1,142

>

> Hi,

> I need to assign my date field in this format '09/09/2008'to a standard FM.But my current date format is '09092008'.

>

> Note:My required date format has to be assigne to sy-datum which is of 8 char long.

Since you already using type Sy-datum than no need of any conversion system would automatically convert.

Reason:Type SYDATS is the domain of Sy-datum and its length is char8 but output characteristics is length is 10.