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

How to remove Zero's.

Former Member
0 Likes
6,974

Hi,

I have a internal table with materal number. The sample records are

000000000007509644

000000000000000698

000000007500980011

I want to remove the Zero's if its present infront of numbers.

i need like below only

7509644

698

7500980011

Plz give me a idea.

Mohana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,569

Hi,

use code as below :

data : a(25), b(25).

a = '000000000007509644'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = a

IMPORTING

OUTPUT = b

.

write 😕 a.

write 😕 b.

Regards,

Sandeep Kaushik

11 REPLIES 11
Read only

Former Member
0 Likes
3,569

Hi,

Use condense. It will remove leading zeroes

or use CONVERSION_EXIT_ALPHA_OUTPUT

Regards

Shiva

Read only

Former Member
0 Likes
3,569

Hi

u can use SHIFT text RIGHT DELETING LEADING '0' or use CONDENSE.

Thanks

Vasudha.

Message was edited by:

Vasudha L

Read only

Former Member
0 Likes
3,569

use

SHIFT V_CHAR LEFT DELETING LEADING '0'.

or

REPLACE '0' WITH SPACE INTO L_VAR.

CONDENSE L_VAR.

Read only

former_member386202
Active Contributor
0 Likes
3,569

Hi,

Use shift statement and delete left leading zeros.

ex.

first convert matnr in char format

SHIFT matnr LEFT DELETING LEADING SPACE.

Regards,

Prashant

Read only

Former Member
0 Likes
3,570

Hi,

use code as below :

data : a(25), b(25).

a = '000000000007509644'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = a

IMPORTING

OUTPUT = b

.

write 😕 a.

write 😕 b.

Regards,

Sandeep Kaushik

Read only

rainer_hbenthal
Active Contributor
3,569

If this is a "problem" with an ALV report you can just tell the system in the fieldcatalog to suppress the zeroes:

wa_fcat-no_zero = 'X'.

Read only

Former Member
0 Likes
3,569

Hi,

Try using Pack statement. You cah search in SAP help(F1)

Deserve Reward.

Gaurav.

Read only

Former Member
0 Likes
3,569

Hi Mohana,

1. If this is a "problem" with an ALV report you can just tell the system in the fieldcatalog to suppress the zeroes:

wa_fcat-no_zero = 'X'.

or

2. Use the FM

ws_number = 0000000000000001.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = ws_number

IMPORTING

OUTPUT = ws_number.

or

3. Use CONDENSE stmt

Reward If USeful.

Regards,

Chitra

Read only

Former Member
0 Likes
3,569

Hi,

Copy this code and run in se38.You will find the solution.

REPORT Zxya .

data: n type i value '0000011'.

write:/ n no-zero.

Reward for helpful solutions.

Regards,

Harini.S

Read only

Former Member
0 Likes
3,569

Hi

try this

1.take the value into variable <b>v1=000000000007509644</b>

2.use the command <b>shift v1 left deleting leading '0'.</b>

3.print v1.

it wl be helpful

plz reward

Read only

gopi_narendra
Active Contributor
0 Likes
3,569

There already exists a conversion exit for Material Number. You can use it

CONVERSION_EXIT_MATN1_OUTPUT.

Just execute the FM with input as 000000000007509644, you will get the output as 7509644

Regards

Gopi