2011 Mar 18 7:15 PM
Hi,
How to convert the AUSP-ATFLV into designated format resides in CABN-ATFOR?
I have AUSP-ATFLV = 9.856000000000000E+01 with CABN-ATFOR = NUM (5.2 format)
how can get the value 98.56?
I want the output with the same format from CABN table.
Giri
2011 Mar 18 7:24 PM
Declare a type p....like:
data: lv_p(15) type p decimals (? however many you need),
lv_atfor type atfor. (this is a char4 by the way!)
lv_p = 0 + AUSP-ATFLV.
lv_atfor = lv_p.
2011 Mar 18 7:27 PM
Thanks breakpoint.
here the case no: of decimals and integers in P type vary by characteristic, i do not want to create so many variable for each charcteristic.
is there any dynamic way to assign using CABN table?
Giri
2011 Mar 18 7:31 PM
I might try something like LV_P(15) type p decimals 6.
then when putting into another field, adjust the number of decimals retained in the 2nd variable....via definition of the type. Actually ATFOR just tells us what the format is, right?
Edited by: BreakPoint on Mar 18, 2011 8:31 PM
2011 Mar 19 8:02 PM
Hi Giri,
CABN has all the information you need. Length of the data object in CABN-ANZST and number of decimals in CABN-ANZDZ.
Do like this:
DATA:
lr_any TYPE REF TO DATA.
FIELD-SYMBOLS:
<ANY> TYPE any.
IF CABN-ATFOR = NUM.
CREATE DATA lr_numdata TYPE P LENGTH CABN-ANZST DECIMALS CABN-ANZDZ.
ASSIGN lr_numdata->* TO <any>.
<any> = AUSP-ATFLV.
WRITE: / <any>.
ENDIF.
This creates a data object dynamically with the required length and number of decimals.
Regards,
Clemens
2015 Apr 24 7:29 AM
Hi,
You can use FM QSS0_FLTP_TO_CHAR_CONVERSION to convert. decimal place should be 2, FLTP value is exponential value and execute, this gives the result you expected.
Thanks
Santhosh
2016 Jan 19 3:36 PM