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: 

Deleted zero

Former Member
0 Kudos

Hi all,

i have small prob.... how i want to delete zero in string format... let say i have 123000 and i want to get output 123 or i have 1200000 so i want to be 12...

can someone help me...

Thanks...

6 REPLIES 6

Former Member
0 Kudos

hi,

Use the command UNPACK.

UNPACK fieldname.

Former Member
0 Kudos

data type decleared as pack

Former Member
0 Kudos

Hi,

u can do it in number of ways.

Use TCODE SU3

Select default tab and select radio button 123467.89 in decimal notation and save it.

or u can try :

if you want to do this through ABAP program.

1. to delete trailing spaces.

SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.

to delete leading zeroes,

SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.

only for one abap program, u can use set country command

for all programs :

sap menu>system->go to user profil->own data>default --> and choose ur format.

or u can use these fms also..

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

reward if it helps..

Regards,

Omkar.

former_member491305
Active Contributor
0 Kudos

Hi,

Use mod function in do loop.

data:c type i,v_var type i type 1230000.

c = v_var.

Do.

v_var = c.

c = c mod 10

If c ne 0.

Exit.

Endif.

Enddo.

Then Value of V_var after this do loop will be 123.

Former Member
0 Kudos

If the problem is at the end of string ,you ca use also

SHIFT <your string> RIGHT DELETING TRAILING '0'.

regards

Yossi

Message was edited by:

Yossi Rozenberg

Former Member
0 Kudos

Thanks....