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

ZERO remove

Former Member
0 Likes
583

Hi Gusy,

I am getting value like "49000000000" but i need to display only "49". How to remove the sufix zeros after numeric char.

Can any one suggest how i can reslove this issue.

Thanks,

Gourisankar.

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
561

Try like this:


DATA: L_NUM1 TYPE VBELN,
      L_CHAR TYPE CHAR10.

L_NUM1 = '4900000000'.
L_CHAR = L_NUM1.

SHIFT L_CHAR RIGHT DELETING TRAILING '0'.

WRITE: L_CHAR.

Regards,

Naimesh Patel

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
561
data: var type char10 value '4900000000'.

shift var right deleting trailing '0'.
shift var left deleting leading space.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
561

do.

lv_rem = LV_Num % 10.

if lv_rem ne 0.

break.

else.

Read only

narin_nandivada3
Active Contributor
0 Likes
561

Hi,

If its a character type then you can remove by using offset..

char+0(2) for the first two characters.. and so one...

You can even check whether the character is equal to index.

IF char2(3) EQ 0. then compare the rest of the character like IF Char3 EQ 0. if so then the rest of the characters are equal to zero.. or else first take the length if the variable and then repeat checking each character and if it is not equal to zero then you can concatenate it to the other variable..

Hope this would help you.

Good luck

Narin