‎2013 Sep 03 3:36 PM
Hi experts,
In the following code, I am replacing the first digit of my value by 0 and the last digit by 0 also.
It's working fine for the first digit but not always for the last one and i don't see why:
DATA:
lgn TYPE i,
antec TYPE /bic/oizbpn,
antecid TYPE /bic/oizbpn.
IF source_fields_rule-/bic/zbpntrans = 'XXX'.
antec = source_fields_rule-/bic/zbpn.
lgn = STRLEN( antec ) - 1.
REPLACE antec+0(1) IN antec WITH '0'.
REPLACE antec+lgn(1) IN antec WITH '0'.
RESULT = antec.
ELSE.
RESULT = source_fields_rule-/bic/zbpn.
ENDIF.
Thanks for your support.
Amine
‎2013 Sep 03 3:53 PM
Hi,
What you're code is doing is to replace the characters that are equal to your first and last character with 0.
You should change this lines:
REPLACE antec+0(1) IN antec WITH '0'.
REPLACE antec+lgn(1) IN antec WITH '0'.
And try with:
antec+0(1) = '0'.
antec+lgn(1) = '0'.
Martin
‎2013 Sep 03 3:43 PM
‎2013 Sep 03 3:44 PM
‎2013 Sep 03 4:00 PM
‎2013 Sep 03 4:07 PM
The first letter is always replaced by 0, by the last one not always.
Amine
‎2013 Sep 03 3:53 PM
Hi,
What you're code is doing is to replace the characters that are equal to your first and last character with 0.
You should change this lines:
REPLACE antec+0(1) IN antec WITH '0'.
REPLACE antec+lgn(1) IN antec WITH '0'.
And try with:
antec+0(1) = '0'.
antec+lgn(1) = '0'.
Martin
‎2013 Sep 03 4:07 PM