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

Append space when the value is 0

Former Member
0 Likes
1,028

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

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
Read only

anversha_s
Active Contributor
0 Likes
1,003

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

Read only

Former Member
0 Likes
1,003

Use "REPLACE" statement

Read only

Former Member
0 Likes
1,003

in case of ALV,

fcat-no_zero = 'X'.

in case of normal report

write: repid no-zero.

regards

Prabhu

Read only

Former Member
0 Likes
1,003

Hi Ram,

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

Thanks...

Preetham S

Read only

Former Member
0 Likes
1,003

Please try if it works this way...

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

Kind Regards

Eswar

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,003

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.

Read only

Former Member
0 Likes
1,003

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.