Application Development and Automation 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: 
Read only

Negative values to a SAP-SCRIPT variable??

Former Member
0 Likes
775

Hi.

How do we assign a negative sign to a SAP-SCRIPT variable??

say &vbdkr-zamount&...how shall we make this variable negative in coding?

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
726

Do like this in your print program

vbdkr-zamount = 0 - vbdkr-zamount.

or

vbdkr-zamount = -1 * vbdkr-zamount.

Regards,

ravi

Read only

Former Member
0 Likes
726

hi subhash,

yes u can try with

SET SIGN (Position of +/- sign)

hope this helps,

priya.

Read only

Former Member
0 Likes
726

HI

GOOD

GO THROUGH THIS LINK

http://www.sappoint.com/abap/sssymbl.pdf

THANKS

MRUTYUN

Read only

Former Member
0 Likes
726

Hey Subhas,

you can assign a negative sign to a script variable by simply multiplying it by -1 in your print program.

However , while looking at the print preview, the sign will be printed to the right of the number as ,say , 45 -.

So you can include this logic so as to get a result in print preview as '-45' .

<b>* Sample Code :</b>

data : amt type i .

amt = 45.

amt = -1 * amt.

data : a type str ,

b type str,

c type str.

a = amt.

split a at '-' into b c.

condense b.

concatenate '-' b into a .

Now into your Script, you can include the program symbol a at the required position.

The output in the print preview will be -45.

Regards,

Kunal.