Skip to Content

Minus Sign in front

Hello all,

I have a requirement where in I need to bring the minus sign in front for the amount field in ALV Grid Display.

I used the FM CLOI_PUT_SIGN_IN_FRONT, but after I pass back the values, the sign gets set at the end. Moreover, I cannot create a character filed because the business might want to do sum on it.

Please advice.

Regards,

Salil

P.S. the below piece of code

DATA : gv_bill_rev  TYPE string,
         gv_balance   TYPE string.

  LOOP AT gt_master INTO gs_master.

    gv_bill_rev = gs_master-bill_rev.
    gv_balance  = gs_master-balance.

    CLEAR : gs_master-bill_rev,gs_master-balance.

    CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
      CHANGING
        value = gv_bill_rev.

    CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
      CHANGING
        value = gv_balance.

    MOVE : gv_bill_rev TO gs_master-bill_rev,
           gv_balance  TO gs_master-balance.

    MODIFY gt_master FROM gs_master INDEX sy-tabix
                                    TRANSPORTING bill_rev balance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 28, 2009 at 01:08 AM

    You can directly specify an edit mask for output.

    Field EDIT_MASK in the field catalog is a 60 character field in which you can specify an edit mask.

    fieldcat-edit_mask = 'V___.__'

    The V at the left indicates that you want the sign to appear at the left. The _ will be replaced by the values of the number. Put as many underscores as required. You may also want to specify commas (,), if desired, for thousand's separators and a period (.) for the decimal point, if needed.

    Alterntively, if an appropriate conversion exit exists to put the sign in front, you can assign the conversion exit in the field catalog table.

    Field CONVEXIT in the field catalog can be used to specify the name of the conversion exit.

    Brian

    Edited by: Brian Sammond on Jan 27, 2009 8:08 PM

    Simplfy example edit mask because forum was displaying it funny

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 27, 2009 at 10:15 PM

    Hi,

    I can not see types of your fields but if you want to have minus sign in front of the amount you need to use character type fields. Then you can use your FM to move sign.

    Cheers

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 28, 2009 at 07:16 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded