2012 Jun 13 5:51 AM
Hi All,
Need some help here. As below is my syntax. However after i tried to activate it, it will give an error message: "In CHAR MODE a character-type, or in BYTE MODE a byte-type field is expected as the row type for the table "GT_FG" ". Please advice.
Syntax:
REPLACE ALL OCCURRENCES OF '--'
IN TABLE gt_fg WITH `? ` IN CHARACTER MODE.
2012 Jun 13 5:56 AM
Hi Shawn,
The table gt_fg nust be character type for this to work.
Replace the declaration of gt_fg with this.
DATA gt_fg type standard table of string.
Thanks,
Shambu
Hi All,
Need some help here. As below is my syntax. However after i tried to activate it, it will give an error message: "In CHAR MODE a character-type, or in BYTE MODE a byte-type field is expected as the row type for the table "GT_FG" ". Please advice.
Syntax:
REPLACE ALL OCCURRENCES OF '--'
IN TABLE gt_fg WITH `? ` IN CHARACTER MODE.
2012 Jun 13 5:56 AM
Hi Shawn,
The table gt_fg nust be character type for this to work.
Replace the declaration of gt_fg with this.
DATA gt_fg type standard table of string.
Thanks,
Shambu
2012 Jun 13 6:01 AM
Hi Shambu,
Thanks for your reply. Here is my declaration for my table as below. I am not sure whether can i change it into string. Please advice me.
DATA: BEGIN OF gt_fg OCCURS 0,
matnr TYPE mchb-matnr,
maktx LIKE makt-maktx,
bklas LIKE mbew-bklas, " MOD4.4
bismt LIKE mara-bismt, " MOD4.4
lgort(4),
lumi1(30),
lumi2(30),
lumi3(30),
ctor1(30),
ctor2(30),
ctor3(30),
fovo1(30),
fovo2(30),
fovo3(30),
datcd(30),
bestq(6),
sgtxt(50), "mod5
gesme LIKE lqua-gesme,
END OF gt_fg.
2012 Jun 13 6:07 AM
Do you want to replace the value '--' in all these fields?
Please check my reply below.
Thanks,
Shambu
2012 Jun 13 6:15 AM
Hi Shambu,
Yes, i would like to replace the value '--' in all of the fields. Please advice me. Thanks.
2012 Jun 13 6:25 AM
2012 Jun 13 6:33 AM
Hi Karthik,
Perhaps could you give me an example on how to use the keyword TRANSLATE on my syntax?
2012 Jun 13 6:37 AM
Use this.
FIELD-SYMBOLS : <wa> TYPE ANY,
<field> TYPE ANY.
DATA str TYPE string.
LOOP AT gt_fg.
ASSIGN gt_fg TO <wa>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <wa> TO <field>.
IF sy-subrc = 0.
str = <field>.
REPLACE ALL OCCURRENCES OF '--'
IN str WITH `? ` IN CHARACTER MODE.
<field> = str.
ELSE.
EXIT.
ENDIF.
ENDDO.
MODIFY gt_fg.
ENDLOOP.
2012 Jun 13 8:22 AM
Hi Shambu,
Appreciate your guidance very much and now i am able to run my report program. Thank so much.. Have a nice day..:)
2012 Jun 13 6:00 AM
IF your table cannot be converted to TYPE TABLE OFstring, then you need to loop at the field and use REPLACE like below.
DATA: str type string.
Loop at gt_fg INTO wa_fg.
str = wa_fg-field. " Field to be replaced
REPLACE ALL OCCURRENCES OF '--'
IN str WITH `? ` IN CHARACTER MODE.
wa_fg-field = str.
MODIFY gt_fg FROM wa.
ENDLOOP.
Thanks,
Shambu
2012 Jun 13 6:02 AM
Hi,
First loop at the itab into a work area and use Replace all for the work area.Otherwise try TRANSLATE
Karthik.R
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |