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: 

DEC to STRING conversion

Former Member
0 Kudos
243

I can't seem to convert a DEC to a string. This is a field defined in the dictionary by type TZNTSTMPS (DEC 15). I tried the following to do the conversions:

d_string = d_dec.
write d_dec to d_string.
CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
  EXPORTING
    betrg                         = d_dec
*   WAERS                         = ' '
*   NEW_DECIMAL_SEPARATOR         =
*   NEW_THOUSANDS_SEPARATOR       =
 IMPORTING
   STRING                        = d_string.

They all give me the same result which is an 8 character result with * being the first charcter. Ultimately, what I need is to grab the first 8 characters as that is a date.

Regards,

Aaron

1 ACCEPTED SOLUTION

Former Member
0 Kudos
166

Hi,

If this is timestamp then there are FM to convert timestamps to date use them.

Regards,

Atish

3 REPLIES 3

Former Member
0 Kudos
167

Hi,

If this is timestamp then there are FM to convert timestamps to date use them.

Regards,

Atish

0 Kudos
166

Thanks for the idea. ABI_TIMESTAMP_CONVERT_FROM works.

Sorry, I thought it did. It throws a run-time error telling me:

Error analysis

At the statment

"WRITE src TO dest"

only character-type data objects are supported at the argument position

"dest", but no strings are supported (data types STRING and XSTRING).

In this particular case, the operand "dest" has the

type "g".

It sounds like it doesn't like the DEC data type as an input but that is all I have to work with.

Any ideas?

Aaron

Edited by: Aaron Shover on May 12, 2008 10:54 PM

Sorry, it looks like LXHME_TIMESTAMP_CONVERT_FROM will work for me.

Regards,

Aaron

Edited by: Aaron Shover on May 12, 2008 10:58 PM

0 Kudos
166

hi aaron,

try transferring your data into a char variable before executing the FM.

write <decimal_variable> to <character_variable>.

call function ABI_TIMESTAMP_CONVERT_FROM

regards,

Peter