Skip to Content
author's profile photo Former Member
Former Member

Convert fltp to char


There is a variable A of type QTOLUN(FLTP 16) and another variable B of type QSOLLWERTC( CHAR 16).

I want to convert fltp to char in such a way that

if it is 1.26 i get 1.26,

if it is 1 i get 1,

if it is 1.2 i get 1.2.

Using FMs like 'FLTP_CHAR_CONVERSION' is not solving the purpose.

As it takes fixed number of decimal digits as input( DECIM ) and always return with that number of digits.

Like if DECIM is 2 then 1.245 will return 1.24 and 1 will return 1.00

This is not desirable.

Please let me know the way irrespective of number of decimal digits.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Mar 06, 2014 at 01:07 PM

    Hi,

    Assuming that you doing QM application report.


    You can use FLTP_CHAR_CONVERSION and use as parametes (for example):

    qamv-stellen
    qamv-tolunni

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 06, 2014 at 03:33 PM

    If string templates are supported by your ABAP release you can try it this way -

    1. DATA:
    2. x TYPE f VALUE '12.000',
    3. y TYPE c LENGTH 16.
    4. y = |{ x }| .
    5. WRITE: x, / y.

    The key formatting option you should check is STYLE.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2014 at 01:17 PM

    Hi Krishnapriya,

    Use the Function Module

    FLTP_CHAR_CONVERSION


    and give only INPUT field and fetch the output of the function module 'FLSTR' which is Char .dont pass any other data.


    CALL FUNCTION 'FLTP_CHAR_CONVERSION'

    EXPORTING

    INPUT = INPUT

    IMPORTING

    FLSTR = OUTPUT

    .


    hope ur issue is solved .


    Regards

    Rounak 😊



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2014 at 02:02 PM

    You can use SHIFT RIGHT statement to delete trailing zeroes and dot.

    Something like this:

    1. DATA a TYPE f.
    2. DATA b TYPE c LENGTH 16.
    3. a = '1.234'.
    4. CALL FUNCTION 'FLTP_CHAR_CONVERSION'
    5. EXPORTING
    6. input = a
    7. IMPORTING
    8. flstr = b.
    9. WRITE:/ a.
    10. WRITE:/ b.
    11. SHIFT b RIGHT DELETING TRAILING '0'.
    12. SHIFT b RIGHT DELETING TRAILING '.'.
    13. WRITE:/ b.

    /.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.