cancel
Showing results for 
Search instead for 
Did you mean: 

Getting negative sign in beginning while printing in smartform

Former Member
0 Kudos

Hi,

I am defining following is defined in global definitions in smartform.

DATA: gv_discount type kwert,

gv_disscount_ch TYPE CHAR18,

Inside code node in smartform I using following,

Data: lv_waerk type vbap-waerk.

gv_discount = gv_discount + gv_item_disc_total.

write gv_discount to gv_discount_ch currency lv_waerk

right justified.

Now I am using gv_discount_ch to write in text node in smartform using following:

&gv_discount_ch(c)&

It giving 250-

But I want -250. So I used &gv_discount_ch(<)&

But it still gives me 250-

I want to get the negative sign in beginning at the same time I want to use (C) also. How do I do it ?

Please help me out.

Thanks.

Regards,

Tushar.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

use this

IF SIGN( V_FLDVAL ) EQ '1-'.

SPLIT V_FLDVAL AT '-' INTO ACT MINUS.

SHIFT ACT LEFT DELETING LEADING SPACE.

CONCATENATE '-' ACT INTO V_FLDVAL.

ENDIF.

Regards,

BIkash

cant u get ur value into another variable say var(10) and then try out....

Message was edited by: Bikash Agarwal

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can use both at the same time.

&gv_discount_ch<b>(<C)&</b>

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

But it seems (<C) will not work in this case because the field I am using i.e gv_discount_ch is defined as CHAR18.

Is there some other way out ?

Thanks..

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Any possibility to make your field as a decimal field.

Regards,

Rich Heilman

Former Member
0 Kudos

Nop. I can't do that.

Is there a way by which I can do either of following:

Note: gv_discount_ch is defined as char18.

1) Convert the value 500- to -500. (I mean I want to truncate the last character since it is always going to be negative and add a - character at the beginning )

Former Member
0 Kudos

check if you can use the fm

CLOI_PUT_SIGN_IN_FRONT

Former Member
0 Kudos

Hi Tushar,

Use ABS statement..

In your case use

gv_discount_ch = ABS( gv_discount_ch ).

concatenate '-' gv_discount_ch to gv_discount_ch .

condense gv_discount_ch.

For example...

data: test(18).

test = 100 * -15.

test = abs( test ).

write:/ test.