‎2019 Nov 25 1:18 PM
Hey guys
I'd like to convert 3,0000000000000000E+04 (type CHAR 12) to its value 30000 (i.e. 3 * 10^4). I'm having trouble dealing with the comma and I'm not sure how to convert this. Can anyone help me?
‎2019 Nov 25 1:28 PM
Do you simply try
data lv_my_data type i.
lv_my_data = lv_my_exp.
‎2019 Nov 25 1:58 PM
‎2019 Nov 25 2:02 PM
‎2019 Nov 25 2:18 PM
What target type do you expect for 30000 ? Let's suppose decfloat16...
Basic implicit type conversion stuff handled natively by ABAP (cf ABAP documentation ? Conversion Rules for Elementary Data Objects ? Character-Like Source Fields ? S... : "The source field must contain a number in mathematical, SCIENTIFIC, or commercial notation"):
DATA(string) = |3,0000000000000000E+04|.
REPLACE ALL OCCURRENCES OF ',' IN string WITH '.'.
DATA(number) = CONV decfloat16( string ).NB: I don't understand how 3,0000000000000000E+04 (22 characters) can be stored in only 12 characters, or is it a typographic error?
‎2019 Nov 25 2:25 PM
Is it not the packet type ? 1/2 byte to store a the value so 12 bytes represents 24 values
‎2019 Nov 25 2:33 PM
The OP says "type CHAR 12", I don't see "P" or "PACKED" in the question.