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

float values are not showing correctly.

Former Member
0 Likes
1,052

I have my QA Trend Analysis Report in which I have field "mittelwert" whose data type is FLTP of length 16.

my internal table it_inspection contains...

mittelwert LIKE qamr-mittelwert.

and selecting from my select query below:

SELECT * FROM qamv AS qamv

JOIN qals AS qals

ON qamvprueflos = qalsprueflos

JOIN qamr AS qamr

ON qamrprueflos = qamvprueflos

AND qamrmerknr = qamvmerknr

AND qamrvorglfnr = qamvvorglfnr

INTO CORRESPONDING FIELDS OF TABLE it_inspection

WHERE qals~matnr IN s_matnr

AND qals~stat35 = p_ud

AND qals~pastrterm IN r_date.

I am getting values as below in my report ALV output:

6.000000000E+00

5.600000000E+00

6.100000000E+00

When I go and see in the tcode : qe01, by giving the Inspection lot values..

I have values as below which is of character type of length 16.

6.00

5.60

6.10

Here the probelm is how can I show the values above in the report output ?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
747

Hi take your internal table field like packed type . use the fallowing code to modify the content of internal table. See example below...

DATA: float TYPE f,

pack TYPE p DECIMALS 2.

float = 73050 * '0.0727'. " result: 5.3107349999999997E+03

pack = float.

WRITE pack. " result: 5310.73

Thanks

Deepanker Dwivedi

3 REPLIES 3
Read only

Former Member
0 Likes
747

Use FM 'FLTP_CHAR_CONVERSION'

CALL FUNCTION 'FLTP_CHAR_CONVERSION'
  EXPORTING
    DECIM = L_CONVERT_DIGITS            "Decimals
    EXPON = 0
    INPUT = L_FLOAT                             " Input >>> Floating number
    IVALU = L_CONVERT_NOT_INITIAL
  IMPORTING
    FLSTR = L_CONVERT_CHARACTER. " Output 

Hope this helps...

Read only

Former Member
0 Likes
748

Hi take your internal table field like packed type . use the fallowing code to modify the content of internal table. See example below...

DATA: float TYPE f,

pack TYPE p DECIMALS 2.

float = 73050 * '0.0727'. " result: 5.3107349999999997E+03

pack = float.

WRITE pack. " result: 5310.73

Thanks

Deepanker Dwivedi

Read only

Former Member
0 Likes
747

Hi Sam,

Use the output from variable STRING in your ALV

This is similar to how it is done for the screen fields in your standard transaction

DATA
    : MITTELWERT LIKE QAMR-MITTELWERT VALUE '6.000000000E+00',
      STRING     TYPE CHAR20.

CALL FUNCTION 'QSS4_FSTRING_AUSGEBEN'
     EXPORTING
          I_NOTINI    = 'X'
          I_FLOAT     = MITTELWERT
          I_DECIMALS  = '2'         "No of decimals you require in the standard it is 2
     IMPORTING
          E_STRING    = STRING
*       TABLES
*            T_OPTIPOS   = OPTIPOS
          .

WRITE STRING.

Regards