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 issue

Former Member
0 Likes
1,100

i have defined a vriable CREATED_TIME(

DATA CREATED_TIME(14) type c.

and i have another variable

xdate which is of the format (YYYYMMDDhhmmssmmmuuun)

i want to fetch first 14 chars in the created_time variable

i have written

CREATED_TIME = xdate.

the data which is coming

xdate =20080923050145.1600000

CREATED_TIME = *50145.1600000

where as in created_time i want 20080923050145. how to do that

9 REPLIES 9
Read only

Former Member
0 Likes
1,072

CREATED_TIME = xdate+0(14).

Read only

0 Likes
1,072

CREATED_TIME = xdate+0(14).

it is giving me error

saying field type "P" doesn't permit subfield access

Read only

0 Likes
1,072

Hi Vishal,

Move that type P into an character variable of the same length and use the offset.

it might work.

Regrds,

Phani.

Read only

0 Likes
1,072

Hi Vishal,

Move that type P into an character variable of the same length and use the offset.

it might work.

Regrds,

Phani.

Read only

Former Member
0 Likes
1,072

hi, try to do this.

change type of ur variable to String and use move instead of =.

Regards.

Read only

Former Member
0 Likes
1,072

Hi,

Try this way..

Data: l_string type char20.
DATA CREATED_TIME(14) type c.

l_string = xdate.
CREATED_TIME = l_string(14).

Read only

0 Likes
1,072

i can't change the data type of xdate it is being returned from standard bapi

what i did is i created

DATA CREATED_TIME1(21) type c.

CREATED_TIME1 = xdate.

CREATED_TIME = CREATED_TIME1+0(14).

but i got the following error

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_CONVERSION_NO_NUMBER', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

The program attempted to interpret the value "*080923050145." as a number, but

since the value contravenes the rules for correct number formats,

this was not possible.

There is probably an error in the program

"ZGET_WORKLIST_ALL_USERS".

Read only

0 Likes
1,072

Hi,

what is the type of xdate ?

Try this way,,

Data: l_string type char20.
DATA CREATED_TIME(14) type c.

   CALL FUNCTION 'HR_99S_COPY_STRUC1_STRUC2'
          EXPORTING
              P_STRUCT1       = xdate
         IMPORTING
             P_STRUCT2       = l_string .
 
l_string = xdate.
CREATED_TIME = l_string(14).

Edited by: Avinash Kodarapu on Feb 26, 2009 6:34 PM

Read only

Former Member
0 Likes
1,072

tahnsk phani u got it correctly