‎2006 Mar 03 5:45 AM
Hello All,
Slect single * from t881 where rldnr = p_rldnr.
if t881-tab ne 'ZZXG1A'. (This can be ZZXG1T)
i need to change the 'T' to 'A'.
so ZZXG1AT becomes ZZXG1A.
rldnr = ledger
p_rldnr is the parameter used enters.
Regards,
- Sravan
‎2006 Mar 03 5:48 AM
Hi sravan,
1. Simple.
2. use like this.
REPORT abc.
DATA : m(30) TYPE c.
m = 'ZZXG1A'.
<b>REPLACE 'A' IN m WITH 'T'.</b>
break-point.
regards,
amit m.
‎2006 Mar 03 5:48 AM
Hi Sravan,
Can you please complete your question...
Slect single * from t881 where rldnr = p_rldnr.
if t881-tab ne 'ZZXG1A'. (This can be ZZXG1T)
t881-tab+5(1) = 'T'.
MODIFY t881 TRANSPORTING tab.
‎2006 Mar 03 5:51 AM
REPORT YCHATEST .
tables:t881.
parameters : p_rldnr like t881-rldnr.
Select single * from t881 where rldnr = p_rldnr.
if t881-tab ne 'ZZXG1A'.
replace 'T' with 'A' into t881-tab.
write : t881-tab.
endif.Message was edited by: Sekhar
‎2006 Mar 03 6:06 AM
Hi All,
Thanks for your postings.
Replace works fine but, the Table always not turns to be ZZXG1T, it could be ZZXG1<b>X</b>.
That is the reason only the last character has to be modified to 'A'.
regards,
- Sravan
‎2006 Mar 03 6:08 AM
Hi,
Use...
Select single * from t881 where rldnr = p_rldnr.
if t881-tab ne 'ZZXG1A'.
<b>*This converts the last character from A to T</b>
t881-tab+5(1) = 'T'.
MODIFY t881 TRANSPORTING tab.
endif.
‎2006 Mar 03 6:10 AM
REPORT YCHATEST .
tables:t881.
data : len type i,
length type i.
parameters : p_rldnr like t881-rldnr.
Select single * from t881 where rldnr = p_rldnr.
len = strlen( t881-tab ).
length = len - 1.
if t881-tab ne 'ZZXG1A'.
replace t881-tab+length(len) with 'A' into t881-tab.
write : t881-tab.
endif.
‎2006 Mar 03 6:11 AM
Hi sravan
HI sravan
try like this
Select single * from t881 where rldnr = p_rldnr.
dat = t881-tab.
<b>dat1 = dat+5(1).</b>
replace dat1 in dat with 'A'
it is working for me correctly
<b>data: dat(10) type c, dat1 type c.
dat = 'ZZXG1A'.
dat1 = dat+5(1).
replace dat1 in dat with 'X'.
write dat.</b>
OR you can try this
replace dat1 with 'X' into dat.
if dat ne '....'
regards
kishore
Message was edited by: Harikishore Sreenivasulu
Message was edited by: Harikishore Sreenivasulu
‎2006 Mar 03 6:23 AM
Hi Harikishore,
I receive the message 'in Dat' is not expected.
Regards,
- Sravan
‎2006 Mar 03 6:26 AM
Hi Sravan,
Please check my previous post , it will replace last character with A irrespective of the length
‎2006 Mar 03 8:28 AM
Hi Sekar,
I implemented the code provided and i receive the message "Offset specification '+LENGTH' is not Numeric"
replace t881-tab+length(len) with 'A' into t881-tab.
‎2006 Mar 03 8:36 AM
Did you define length and len as Integer data types.
DATA length TYPE i.
DATA len TYPE i.
‎2006 Mar 03 8:38 AM
‎2006 Mar 03 8:48 AM
Hi Sravan,
I have even tested it. It works fine for me.
Can you please post your code...
DATA str(12) VALUE '12335'.
DATA len TYPE i VALUE 0.
DATA len1 TYPE i VALUE 1.
REPLACE str+len(len1) WITH 'A' INTO str.
‎2006 Mar 03 9:03 AM
Hi,
data: len type i,
length type i.
*t881-tab is defined as Character type C of 10
SELECT single * from t881 where rldnr = p_rldnr.
* The output of the above could be ZZXG1T OR ZZEMEA1T
if t881-tab ne 'ZZXG1A'.
len = strlen( t881-tab ).
length = len - 1.
-->replace t881-tab+length(len) with 'A' into t881-tab.
endif.
The message occurs at the arrow pointed.
Regards,
- Sravan
‎2006 Mar 03 9:12 AM
Hi Sravan,
I hope you are using the table workarea.
Do this modification...
<b>TABLES: t881.
DATA wa LIKE t881.</b>data: len type i,
length type i.
SELECT single * from t881 <b>INTO wa</b> where rldnr = p_rldnr.
if wa-tab ne 'ZZXG1A'.
len = strlen( wa-tab ).
length = len - 1.
replace wa-tab+length(len) with 'A' into wa-tab.
endif.
‎2006 Mar 03 5:51 AM
Slect single * from t881 where rldnr = p_rldnr.
if t881-tab not in 'ZZXG1A'.
t881-tab = 'ZZXG1T'.
endif.
‎2006 Mar 03 5:52 AM
u can use
1.REPLACE statement as well
or else
2.u can do like this no.
if t881-tab ne 'ZZXG1A'.
t881-tab = 'ZZXG1T'.
‎2006 Mar 03 5:52 AM
HI sravan
Select single * from t881 where rldnr = p_rldnr.
dat = t881-tab.
replace 'A' in dat with 'T'.
if dat ne 'ZZXG1T'.
regards
kishore
‎2006 Mar 03 5:58 AM
Hi,
Use:
Select single * from t881 where rldnr = p_rldnr.
if t881-tab ne 'ZZXG1A'.
t881-tab = 'ZZXG1AT'.
endif.
Lokesh
‎2006 Mar 03 5:58 AM
Hi Sravan,
You can use either of the following:
a) TRANSLATE : This command will change your 'T' to 'A' if its ZZXG1T. If its not, it will leave it as it is.
SELECT SINGLE * FROM T881 WHERE RLDNR = P_RLDNR.
DATA: WA_CHANGE(2) VALUE 'TA'.
TRANSLATE T881-TAB USING WA_CHANGE.b) RELPACE : This too will perform the same function.
REPLACE 'T' WITH 'A' INTO T881-TAB.The only difference between the two is that TRANSALTE replaces all occurances of a character with the one succeeding it in WA_CHANGE, while REPLACE will replace only the 1st occurance of the character.
Hope this helps,
Regards,
Madhur
NB: Please do award points if found helpful.
Message was edited by: Madhur Chopra