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: 

Texting in Sapscript

Former Member
0 Kudos

Hi developers,

I'm modifying a Sapscript and I need to change the way a field &field_name& is displayed.

I've got to display a negative number. In that field the number is written with the sign on the right (for example like "15-") but i need to represent it with the sign on the left (like "-15").

Is there anything that allows me to do that immediately?

Thanks,

Simone

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

Hi,

Write ur variable like below.

&field_name(<)&

Thanks,

Vinod

5 REPLIES 5

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

Why can't use the Split and Concatenate mechanism for this.

Val = 15-.

Concatenate val2(1) val0(2) into val.

Write:/ Val.

Val = -15 now.

Regards,

Sreeram Kumar.Madisetty

Former Member
0 Kudos

Hi,

Use the control command

SET SIGN LEFT

for more information check this link

[SCRIPTS|http://saphelp.border-states.com/EN/d1/802ddb454211d189710000e8322d00/frameset.htm]

regards

sarves

vinod_vemuru2
Active Contributor
0 Kudos

Hi,

Write ur variable like below.

&field_name(<)&

Thanks,

Vinod

Former Member
0 Kudos

&symbol(S)& Omit Leading Sign

&symbol(<)& Display Leading Sign to the Left

&symbol(>)& Display Leading Sign to the Right

Regards,

Gurpreet

Former Member
0 Kudos

Change your driver program with a logic to add '-' sign at start of filed.

if you atre using a statndard sap driver program,

create a small include program, write a subroutine in the same and call that perfor from sap script.

Perform <XYZ> in program 'zabc' using &field-name&

changing &filed-name& .

include zabc.

form XYZ tables input_table structure itcsy

output_table structure itcsy.

data:g_value(20) type c.

loop at input_table.

if input_table-name = 'FIELD-NAME'.

g_value = input_table-value.

end loop.

condence g_value with no-gaps..

g_n = strlen(g_value).

" if last character is negaetive

if g_value(g_n) = '-'

g_new_value(1) = '-'.

g_new_value+1(g_n) = g_value.

g_value

endif.

input_tabl

endform.