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: 

display the negative sign in bracket in script

Former Member
0 Kudos

Hi experts,

             guide me how to print the value 710(-) in sap script.i want only for negative numbers and the sign should be in brackets.

Thankx in advance.

1 ACCEPTED SOLUTION

krishna_k19
Contributor
0 Kudos

Hi ,,

 

  suppose the value stored in (ex: menge) and for signs take one key field(like  shkzg: if shkzg = x means Positive else negative)

if shkzg = x.

     write menge.

else.

      concatenate menge '(-)' into menge1.

      write menge1.

endif.

7 REPLIES 7

krishna_k19
Contributor
0 Kudos

Hi ,,

 

  suppose the value stored in (ex: menge) and for signs take one key field(like  shkzg: if shkzg = x means Positive else negative)

if shkzg = x.

     write menge.

else.

      concatenate menge '(-)' into menge1.

      write menge1.

endif.

0 Kudos

Hi krishna,

    if i do like that, it willl create calculation problem.because -710 is not same as ( - )720

0 Kudos

Pavan,

   while printing that field you apply the logic.

sample code..

REPORT  YSIGN.

PARAMETERS var(10) TYPE c.

DATA var1(12) TYPE c.

START-OF-SELECTION.

IF var < 0.

   var = var * -1.

   CONCATENATE var '(-)' INTO var1.

ENDIF.

WRITE var.

WRITE var1.

0 Kudos

Thanks krishna,

            it works now, it prints like 720(-) but user wants in amount figure like 720.00(-).can you please asist more on this.

0 Kudos

hi,

first tel me how the value is storing into table/variable . means ex. if suppose value is storing 720.00 then above logic wil work if it not means then check what is the variable type maybe it is a character type then we have to add manually by using above code(concatenate menge '.00' '(-)' into menge1 ) like that but check properly whether the field is currency or what,if it is currency means hw the value is storing you have to consider.

Regards,

Krishna

0 Kudos

its cleared or not,if clears then close the message..

0 Kudos

Thanks krishna for ur valuable suggestions,

                  issue is resolved,