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: 

Append space when the value is 0

Former Member
0 Kudos

Hi,

I need to pass space if the field value is '0'. I have field which returns '00000000' in the output. For this i need to pass space. I tried many ways to pass space to this field. But its displaying as '00000000' only. How to pass space to this field. In database the field value is displayed as 0.

Regards,

Ram

7 REPLIES 7

anversha_s
Active Contributor
0 Kudos

hi ram,

suppose char1 = '000001'.

do this.

REPLACE all occurances of '0' in char1 WITH space INTO char2.

char2 ='1'.

rgds

anver

if helped pls mark points

Message was edited by: Anversha s

Former Member
0 Kudos

Use "REPLACE" statement

Former Member
0 Kudos

in case of ALV,

fcat-no_zero = 'X'.

in case of normal report

write: repid no-zero.

regards

Prabhu

Former Member
0 Kudos

Hi Ram,

You can also use 'CONVERSION_EXIT_ALPHA_OUTPUT'...suppose the input is '0001' then the output will be '1'.

Thanks...

Preetham S

Former Member
0 Kudos

Please try if it works this way...

<b>replace all occurrences of '0' in <fld> with ' '.</b>

Kind Regards

Eswar

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Here is the sample code.Try this,it will output space.

data c1(10) value '00000'.

pack c1 to c1.

replace '0' with space into c1.

write c1.

Former Member
0 Kudos

Donot use replace,because when ever the value is '00100' the o/p will be 1.

Instead use this syntax

SHIFT value LEFT DELETING LEADING '0'.

Regards,

Dharani.