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

Command for remove zeros in sapscript

Former Member
0 Likes
1,004

Hello:

I need to remove zeros of a variable in a sapscript,

TALGN = 0000427795776

and I need to remove the zeros so:

TALGN = 427795776

But sometimes will be 3, 4 or more zeros, is there a way to do it with a sapscript command? or this should be done in the program?

Best regards and thank you for your help.

Miriam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
948

&SYMBOL(Z)& Suppress leading zeros &MATNR(Z)&,

leading zeros (functionality of FM CONVERSION_EXIT_ALPHA_INPUT) keep in print program and pass this variable to script after you removed leading zeros.

Thanks,

AMS

5 REPLIES 5
Read only

Former Member
0 Likes
949

&SYMBOL(Z)& Suppress leading zeros &MATNR(Z)&,

leading zeros (functionality of FM CONVERSION_EXIT_ALPHA_INPUT) keep in print program and pass this variable to script after you removed leading zeros.

Thanks,

AMS

Read only

Former Member
0 Likes
948

Hi

Check the below code.

data a(9) value '000012345'.

SHIFT a LEFT DELETING LEADING '0'.

write:/ a.

Output will be : 12345

Regards

Vinay Kolla

Read only

venkat_o
Active Contributor
0 Likes
948

Hi Miriam, Certain symbol values are output with leading zeros. If you wish to suppress these, you may do so with the Z option. Syntax

&TALGN(Z)&
Thanks Venkat.O

Read only

Former Member
0 Likes
948

Hi Miriam,

In SAP Scripts , you have Layout Set Symbols which you can use for doing things like :-

Getting Offset - &SYMBOL+4&

Length - &SYMBOL(5)&

If symbol is initial ,output nothing - &SYMBOL(I)&

Suppress Leading zeroes - &SYMBOL(Z)&.

And many more such symbols.

Hence, you dunt need to write the code in your driving program and pass to the Script.

You can directly use these symbols in your script and get things done in simple manner.

Hope this helps...

Regards,

Samreen...

Read only

0 Likes
948

Hello:

Thank you.

Where can I find all this commands? do you have any documentation?

Best regards,