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

string value to be displayed in number format

Hi All,

I am facing one problem when i am displaying a negative number in output.I have a number 123,567,90.89-.They want the sign should be on left-side.I did that shifting the sign to left by passing that value into one string type variable.But when i copied the value into string symbol ',' is ommiting and the value is getting stored as '12356790.89-',But i have to display the value in such a way that sign should be in left-side and it should be in number format.i.e,

-123,567,90.89.

Please give me a solution to resolve this problem..

With Regards,

R.P.Sastry

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2007 at 11:48 AM

    try this...

    DATA: amount(16) TYPE P DECIMALS 3 VALUE '345435455.45-',

    c_amount(16).

    WRITE amount TO c_amount NO-SIGN.

    IF amount < 0.

    CONCATENATE '-'

    c_amount

    INTO c_amount.

    CONDENSE c_amount NO-GAPS.

    ENDIF.

    WRITE c_amount.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2007 at 11:38 AM

    after moving the data into string you need to put the ',' manually into the string

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2007 at 11:54 AM

    Hello,

    You can try:

    G_NUM_TEMP TYPE P DECIMALS 2

    G_S_IMP_MOM TYPE /GEX/255 --> CHAR of 255

    G_NUM_TEMP contains: 123,567,90.89-

    WRITE G_NUM_TEMP TO G_S_IMP_MOM LEFT-JUSTIFIED.

    "LEFT-JUSTIFIED is for respecting the final - and doing the write correctly.

    "NO GROUPING is used to avoid the separation for thousands, so here it is no used.

    In G_S_IMP_MOM string you should have the value separated correctly, then do the process to have the - sign at the beginning of the string.

    I hope it will help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 21, 2007 at 12:52 PM

    Hi Parayya,

    Check this function module. It gives u some help.

    CLOI_PUT_SIGN_IN_FRONT

    Regards

    Manoj Kumar

    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.