‎2010 Feb 10 7:31 AM
Hi ,
one of my field var = 0000501
I want to display it like var = ****501
I want to replace all leading zero's with ' * ' .
Replace statement replaces all zeros with ' * ' & display var = ***51.
I want my output = ****501.
Plz help
Thanks in Advance
Sai
‎2010 Feb 10 7:40 AM
Hello
Try this snippet:
data: str1(10),
x type i,
y type i.
str1 = '0000501'.
x = strlen( str1 ).
shift str1 left deleting leading '0'.
y = strlen( str1 ).
x = x - y.
do x times.
concatenate '*' str1 into str1.
enddo.
write str1.
‎2010 Feb 10 7:40 AM
Hello
Try this snippet:
data: str1(10),
x type i,
y type i.
str1 = '0000501'.
x = strlen( str1 ).
shift str1 left deleting leading '0'.
y = strlen( str1 ).
x = x - y.
do x times.
concatenate '*' str1 into str1.
enddo.
write str1.
‎2010 Feb 10 7:54 AM
thanks to all of u for there proper reply
Closing the thread
Sai
‎2010 Feb 10 7:41 AM
Hi,
Try this simple code:
DATA value(7) TYPE c VALUE '0000501'.
DATA i TYPE i.
WHILE value+i(1) EQ '0'.
value+i(1) = '*'.
ADD 1 TO i.
ENDWHILE.
WRITE value.
‎2010 Feb 10 7:41 AM
Hello,
Check this logic and modify if required according to your need.
data temp(7) type c.
data len type i.
data n type i.
temp = '0000501'.
len = strlen( temp ).
do len times.
if temp+n(1) <> '0'.
exit.
else.
replace '0' in temp+n(1) with '*' .
endif.
n = n + 1.
enddo.
write temp.
Hope this helps in solving your query.
Regards,
Sachin
‎2010 Feb 10 7:44 AM
How about something like this?
DATA: lv_init TYPE char07 VALUE '0000501'.
DATA: lv_conv TYPE char07.
DATA: lv_star TYPE char07 VALUE '*******'.
data: lv_outp type char07.
DATA: lv_init_l type i.
data: lv_conv_l type i.
data: lv_offset type i.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = lv_init
IMPORTING
output = lv_conv.
lv_init_l = strlen( lv_init ).
lv_conv_l = strlen( lv_conv ).
lv_offset = lv_init_l - lv_conv_l.
lv_outp = lv_star.
lv_outp+lv_offset(lv_conv_l) = lv_conv.
WRITE:/ lv_outp.Regards,
RIch Heilman
‎2010 Feb 10 8:02 AM
hi.
i tried coding below .
FIELD-SYMBOLS : <fs> type c .
do .
off = sy-index - 1.
assign text+off(1) to <fs> .
if <fs> <> 0.
exit .
else.
replace SECTION offset off length 1 of text with '*' .
endif.
enddo.