‎2007 Mar 08 2:00 PM
Hi,
I need to replace the appearance of # character with space in a character field.
the normal Replace property of ABAP does not work.
Please advise.
Sheetal
‎2007 Mar 08 2:05 PM
‎2007 Mar 08 2:01 PM
try this ..
split v_str at <b>cl_abap_char_utilities=>HORIZONTAL_TAB</b>
‎2007 Mar 08 2:02 PM
The # you see is not a # in reality thats why it is not workinf.
It must be TAB character or a page break character.
Use the atrributes of the class CL_ABAP_CHAR_UTILITIES like HORIZONTAL_TAB or NEWLINE etc.
replace CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB with space in string.
Regards,
Ravi
‎2007 Mar 08 2:02 PM
translate w_char using '# ' .
After # space is mandatory in single quotes.
regards,
sai ramesh
‎2007 Mar 08 2:05 PM
‎2007 Mar 08 2:15 PM
I have tried this , but the solution is not working for me.
Could you help me with some sample code?
To give you more indepth knowhow--->
I have converted OTF data to PDF into internal table having structure TLINE.
I am trying to replace the ## occurrences from the field TDLINE of this internal table.
‎2007 Mar 08 2:17 PM
‎2007 Mar 08 2:26 PM
‎2007 Mar 08 2:31 PM
‎2007 Mar 08 2:21 PM
report oo_deneme1.
TYPES: BEGIN OF TY_OUTPUT,
TEXT1(10),
TEXT2(10),
TEXT3(30),
END OF TY_OUTPUT.
DATA: OUTPUT_TAB TYPE TY_OUTPUT OCCURS 0 WITH HEADER LINE.
TYPES: BEGIN OF TY_DATA,
TEXT(80) ,
END OF TY_DATA.
DATA: DATA_TAB TYPE TY_DATA OCCURS 0 .
DATA: DATA_WA TYPE TY_DATA.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT
IMPORTING
DATA = DATA_TAB
LENGTH =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT DATA_TAB INTO DATA_WA.
replace all occurrences of CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
in DATA_WA-TEXT with '*'.
SPLIT DATA_WA-TEXT AT '*' INTO
OUTPUT_TAB-TEXT1
OUTPUT_TAB-TEXT2
OUTPUT_TAB-TEXT3.
IF SY-SUBRC = 0 .
APPEND OUTPUT_TAB.
WRITE: / OUTPUT_TAB.
ELSEIF SY-SUBRC = 4.
WRITE: / 'Split error:', DATA_WA-TEXT.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2007 Mar 08 2:23 PM
hi Sheetal,
Please try the following logic:
data itab type table of tdline.
data wa_itab type tdline.
loop at itab into wa_itab.
replace all occurrences of
cl_abap_char_utilities=>CR_LF in wa_itab-line with space.
modify itab from wa_itab index sy-tabix.
endloop.
"instead of CR_LF try with HORIZONTAL_TAB also.
Hope this helps,
Sajan Joseph.