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: 

How to move negative sign to the front?

Former Member
0 Kudos

Hi,

I have a string ' 23.45-'. It is a negative value. How do i present it in '-23.45' ?

I don't have the function module CLOI_PUT_SIGN_IN_FRONT in the system.

How to achieve that?

Regards,

Rayden

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Do like this.

DATA: TEXT1(1) TYPE C,

VALUE(5) type c.

value = '90-'.

SEARCH VALUE FOR '-'.

IF SY-SUBRC = 0 AND SY-FDPOS <> 0.

SPLIT VALUE AT '-' INTO VALUE TEXT1.

CONDENSE VALUE.

CONCATENATE '-' VALUE INTO VALUE.

ELSE.

CONDENSE VALUE.

ENDIF.

Regards

Haritha.

10 REPLIES 10

Former Member
0 Kudos

use this function module

'CLOI_PUT_SIGN_IN_FRONT'

0 Kudos

Hi pavan,

I don't have the function module CLOI_PUT_SIGN_IN_FRONT in the system.

Is there any other way to do that?

Regards,

Rayden

Former Member

go to your system control panel -> Regional and Language Options->Customize->

choose negative number format -> -1.1

Former Member
0 Kudos

replace '-' in variable with space.

concatenate '-' 'variable' into 'variable'.

this will sove your issue

tc

saji

Former Member
0 Kudos

go to your system control panel -> Regional and Language Options->Customize->

choose negative number format -> -1.1

or

SHIFT string BY 1 PLACES CIRCULAR

Former Member
0 Kudos

Hi

Do like this.

DATA: TEXT1(1) TYPE C,

VALUE(5) type c.

value = '90-'.

SEARCH VALUE FOR '-'.

IF SY-SUBRC = 0 AND SY-FDPOS <> 0.

SPLIT VALUE AT '-' INTO VALUE TEXT1.

CONDENSE VALUE.

CONCATENATE '-' VALUE INTO VALUE.

ELSE.

CONDENSE VALUE.

ENDIF.

Regards

Haritha.

former_member387317
Active Contributor
0 Kudos

Check out below way...

using <b>edit mask</b> you can achieve it..

WRITE variablename using edit mask<b> 'LLV_________.__'.

</b>

if your variable has value 1.00- then it should appear as -1.00.

<b>Hope it will solve your problem</b>

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

Please try this....

data: string type string value '1100.00-'.

data: d type i.

d = strlen( string ).

d = d - 1.

SHIFT string BY d PLACES CIRCULAR.

write:/ string.

Message was edited by:

Muthurajan Ramkumar

Former Member
0 Kudos

hi,

use :

CLOI_PUT_SIGN_IN_FRONT Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justifed as numbers normally are.

reagrds,

ritika malhotra

0 Kudos

data(lv_test) = '120-'.
shift lv_test BY strlen( lv_test ) - 1 PLACES CIRCULAR.

write:/ lv_test.