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: 

FLTP conversion - AUSP-ATFLV

Former Member
0 Kudos
11,166

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

6 REPLIES 6

Former Member
0 Kudos
1,949

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.

0 Kudos
1,949

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

0 Kudos
1,949

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

Clemenss
Active Contributor
0 Kudos
1,949

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

former_member183790
Participant
1,949

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

Former Member
1,949

You can also use function module MC_FLTP_CHAR.