2007 Apr 20 2:22 PM
Hi ,
In the internal table i have the following fields .
INTERNAL TABLE
FIELD1 FIELDS2 FIELD3
X1 ABCDF Y1
X2 TRSRT Y2
X3 TX ABCD TX ABCD
need to replace 'ABCDF' with 'RRRRRRRRRR' where every 'ABCD' text occurs in the internal table
USING 'search' and 'replace' commands only.
thxs,
Vind
2007 Apr 20 2:33 PM
Something like this might do it.
LOOP AT itab.
REPLACE ALL OCCURRENCES OF 'ABCDE' IN itab WITH 'RRRRR'.
modify itab.
ENDLOOP.
Regards,
RIch Heilman
2007 Apr 20 2:30 PM
Use the below code...
loop at itab.
if itab-field2 CS 'ABCD'.
itab-field2 = 'RRRRRRRRRR'.
modify itab index sy-tabix.
endif.
endloop.
2007 Apr 20 2:31 PM
Hi ,
Use like this...
loop at it_data itno x_data.
REPLACE ALL OCCURrENCES OF 'ABCD' IN x_data-maktx
WITH 'RRRRRRRRRRR'.
modify it_data from x_data.
endloop.
2007 Apr 20 2:31 PM
Hi Vind,
<b>
Here t_table is a internal table with header line :</b>
data:
t_table LIKE
STANDARD TABLE
OF <abc_structure>
WITH HEADER LINE.
LOOP AT t_table.
IF t_table-field co 'ABCDF'.
t_table-field = 'RRRRRRRRRRR'.
MODIFY t_table.
ENDIF.
ENDLOOP.
<b>
Reward all helpful answers</b>
Regards,
V.Raghavender.
2007 Apr 20 2:33 PM
2007 Apr 20 2:35 PM
2007 Apr 20 2:53 PM
Hi Rich ,
I am using the below code , but it resulted in an ABAP dump saying .
Error Analysis :
The argument <FS> can only take a character -type data object.
In this case , the operand <FS> has the non-character type 'F'.
May i know how to recity this ??
thanks,
Vind
2007 Apr 20 3:05 PM
Ooops, try this.
FIELD-SYMBOLS: <fs>.
LOOP AT itab.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE itab TO <fs>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
DATA: field_type TYPE string.
DESCRIBE FIELD <fs> TYPE field_type.
IF field_type = 'C'.
REPLACE 'ABCDE' IN <fs> WITH 'RRRRR'.
ENDIF.
ENDDO.
MODIFY itab.
ENDLOOP.
Regards,
Rich Heilman
2007 Apr 20 2:34 PM
Hi,
loop at internal_table.
replace 'ABCDF' with 'RRRRRRRRR' into internal_table-field1.
replace 'ABCDF' with 'RRRRRRRRR' into internal_table-field2.
replace 'ABCDF' with 'RRRRRRRRR' into internal_table-field3.
modify internal_table.
endloop.
regards,
2007 Apr 20 2:35 PM
Hi,
Loop at Itab.
search itab for 'ABCD'.
if sy-subrc = 0.
replace all occurrences 'ABCD' in itab with 'RRRRRRRRRRR'.
endif.
modify itab index sy-tabix.
endloop.
2007 Apr 20 3:15 PM
loop at itab into wa_itab.
search wa_itab-field2 for 'ABCD'.
if sy-subrc eq 0.
replace 'ABCD' in wa_itab-field2 with 'RRRRRRRR'.
modify itab from wa_itab.
endif.
endif.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |