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

compressing zeros

Former Member
0 Likes
1,012

hai ,

please help me to find out how can i compress the zeros

in the numeric field.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
920

hi,

the leading zeros can be compressed by using NO-ZEROS.

eg: write var1 to var2 no-zeros

Regards,

Anil.

Edited by: Anilkumar Prajapati on Mar 27, 2008 7:26 AM

6 REPLIES 6
Read only

Former Member
0 Likes
920

Hi

Move the data to CHar type and use condense

or use FM conversion_alpha_exit_output

Or in write statement you can use no-zero

WRITE: '000123',

/ '000123' NO-ZERO.

000123

123

Regards

Shiva

Read only

Former Member
0 Likes
921

hi,

the leading zeros can be compressed by using NO-ZEROS.

eg: write var1 to var2 no-zeros

Regards,

Anil.

Edited by: Anilkumar Prajapati on Mar 27, 2008 7:26 AM

Read only

Former Member
0 Likes
920

Use the Function Module CONVERSION_EXIT_ALPHA_INPUT

Check the sample code:

data: NUMBER(8) VALUE 0, "Original number without zeros

NUMBER2(8). "numbers with zeros

*Incrementing value.

NUMBER = NUMBER + 1.

*Padding zeros

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = NUMBER

IMPORTING

OUTPUT = NUMBER2.

WRITE: / 'Number 1 ', NUMBER,

'Number 2 ', NUMBER2.

Reward points if useful.

Read only

Former Member
0 Likes
920

Hello,

Check this .

DATA:wrk_char TYPE char10.

DATA:wrk_num TYPE i.

wrk_num = ' 1000'.

wrk_char = wrk_num.

PACK wrk_char TO wrk_char.

CONDENSE wrk_char.

Neeraj

Read only

Former Member
0 Likes
920

best way is to use PACK or UNPACK

REWARD IF USEFUL

SAMEER

Read only

Former Member
0 Likes
920

thanks