cancel
Showing results for 
Search instead for 
Did you mean: 

Put negative sign to the left GLOBALLY in Sapscript and Smartforms

Former Member
0 Kudos

Dear experts,

Do anyone know is there a profile parameter or some other solution in SAP to set to display the negative sign in front of the symbols left by default system-wide?

We have a huge number of Sapscripts and Smartforms and we would like to display the - sign by default on the left.

SET SIGN LEFT

and

(<)

command is not a solution for us, because it would need large amount of work.

I think there is exist a profile parameter, or I should change the standard code somewhere...

Why is that SAP displays the - sign on the right?

Please advise!

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

I don't believe you can change the default globally. I'm guessing having it on the right is the standard in Europe (or at least Germany) and it has some advantages for formatting as it put the sign in a consistent location when printing columns of numbers.

Regards,

Michael

Former Member
0 Kudos

Hi Gabor,

I have implemented the subroutine to align sign in amount field. This subroutine will check if the amount contains any negative sign, if yes then w_sign variable will contain '-' and TOT_AMT will contain amount. if the amount is positive then w_sign is blank.

now display amount field and w_sign as needed. Please fine below sample code.

In subroutine, write below code :-

FORM f_get_sign TABLES ta_input STRUCTURE itcsy

ta_output STRUCTURE itcsy.

FIELD-SYMBOLS: <fs_input> TYPE itcsy,

<fs_output> TYPE itcsy.

DATA : w_amount TYPE char20,

w_amount1 TYPE bsid-dmbtr,

w_sign TYPE char1.

CLEAR: w_sign,

w_amount,

w_amount1.

UNASSIGN <fs_input>.

LOOP AT ta_input

ASSIGNING <fs_input>.

MOVE <fs_input>-value TO w_amount.

ENDLOOP.

IF w_amount CS c_minus.

MOVE c_minus TO w_sign.

ENDIF.

UNASSIGN <fs_output>.

LOOP AT ta_output

ASSIGNING <fs_output>.

CASE <fs_output>-name.

WHEN c_sign.

MOVE w_sign TO <fs_output>-value.

WHEN OTHERS.

REPLACE ALL OCCURRENCES OF c_minus IN w_amount WITH space.

MOVE w_amount TO <fs_output>-value.

ENDCASE.

ENDLOOP.

ENDFORM.

In script add below code :-

/: DEFINE &TOT_AMT& = <Amount>

/: DEFINE &W_SIGN& = ''

/* ***************** Perform to align sign in amount field ****************

/: PERFORM F_GET_SIGN IN PROGRAM Z_SUBROUTINE_NAME

/: USING &TOT_AMT&

/: CHANGING &W_SIGN&

/: CHANGING &TOT_AMT&

/: ENDPERFORM

Then display as below :-

&W_SIGN&,,&TOT_AMT&