‎2006 Aug 10 11:58 AM
Hi All,
I have a field called PSPID which iam fetching from the table PROJ, the field as for the following values:
PSPID
HURT00031 00000000
HURT00031R00000000
HURT00031R01000000
HURT00031R02000000
HURT00031R03000000
HURT00031C00000000
HURT00031C02000000
HURT00031C03000000
Now my requirement is to remove the trailing zeros from that field. i have used
shift W_FINAL1-PSPID right deleting trailing '0'.
But this is not working with this shift command.
plz help me in this.
Thanks in Advance,
Neha
‎2006 Aug 10 12:04 PM
Hi,
Try moving the value to a character field and then use shift right deleting trailing 0.
Rgds,
HR
‎2006 Aug 10 12:04 PM
Hi,
Try moving the value to a character field and then use shift right deleting trailing 0.
Rgds,
HR
‎2006 Aug 10 12:07 PM
Hi HR,
I declared it as character field only but still it is not working.
Neha
‎2006 Aug 10 12:11 PM
the problem is with the length , what is the length of the field W_FINAL1-PSPID , check if it matches the length of the value , if it matches only shift will work
chk this
REPORT ABC.
DATA : VAR1(18) VALUE 'HURT00031C03000000'.
SHIFT VAR1 RIGHT DELETING TRAILING '0'.
WRITE VAR1.now change the length of var1 to 20 it will not work
‎2006 Aug 10 12:27 PM
hi,
when we check thje data type in se11 of pspid , it is character type with length of 24, so i declared w_final1-pspid of smae length i.e 24 but the value it is holding in that field is of only 18 characters, so i have written the code given below. but still it is not working.
data l_string type char18.
loop at t_final1 into w_final1.
If w_final1-pspid+17(1) = '0'.
move w_final1-posid to l_string.
shift l_string RIGHT deleting trailing '0'.
move l_string to w_final2-posid.
endif.
‎2006 Aug 10 12:34 PM
‎2006 Aug 10 1:10 PM
Just FYI.
here is my program to do that
REPORT ZSRIM_TEMP2.
data : v_char(50) type c.
v_char = 'HURT00031 00000000'.
condense v_char NO-GAPS.
shift v_Char left deleting leading space.
shift v_Char right deleting trailing space.
shift v_char right deleting trailing '0'.
condense v_char.
write 😕 v_char.
now this will HURT00031
Regards
Srikanth
‎2006 Aug 10 12:07 PM
Hi Neha,
Move that field into a char field and then use no-zero say
data: w_temp(24) type c.
move W_FINAL1-PSPID to w_temp.
write: w_temp no-zero.
Regards,
Vidya
‎2006 Aug 10 12:13 PM
Hello,
try this
data: l_len type i,
l_pspid(20),
l_off type i.
l_pspid = 'HURT00031 00000000'.
l_len = strlen( l_pspid ).
do.
l_off = l_len - 1.
if l_pspid+l_off(1) = '0'.
clear l_pspid+l_off(1).
else.
exit.
endif.
l_len = l_off.
enddo.
regards,
Naimesh