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 Format(4.6c)

Former Member
0 Kudos

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

former_member181995
Active Contributor
0 Kudos

>

> 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.

7 REPLIES 7

Former Member
0 Kudos

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 .

Former Member
0 Kudos

Hi,

Hi,

Function module is there to handle this.

SLS_MISC_CONVERT_TO_DATE

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

HRGPBS_HESA_DATE_FORMAT

CONVERT_DATE_TO_INTERN_FORMAT

Use the above FMs.

Regards,

Harish

former_member705122
Active Contributor
0 Kudos

Hi,

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

w_date = w_string.
WRITE: w_date.

Regards

Adil

former_member181995
Active Contributor
0 Kudos

>

> 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.