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: 

Minus Sign in front

former_member188001
Active Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

mvoros
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

faisal_altaf2
Active Contributor
0 Kudos

This message was moderated.