2007 Apr 17 7:54 AM
Hi Frnds,
I am facing one problem with read_text FM.
While using the read_text,the longtext in the tline table has one # symbol in each line( which is not needed).
can anyone suggest me how to eliminate this #.
thanks
Suganya
2007 Apr 17 7:56 AM
Hi.
The character '#' can be a Horizontal tab or a new line or a Vertical tab...
Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.
<b>constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>
<b>replace all occurrences of C_HTAB in w_string with space.</b>
or ...
loop at itab into wa.
<b>replace all occurrences of C_HTAB in wa with space.</b>
endloop.
Hi Frnds,
I am facing one problem with read_text FM.
While using the read_text,the longtext in the tline table has one # symbol in each line( which is not needed).
can anyone suggest me how to eliminate this #.
thanks
Suganya
2007 Apr 17 7:56 AM
Hi.
The character '#' can be a Horizontal tab or a new line or a Vertical tab...
Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.
<b>constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>
<b>replace all occurrences of C_HTAB in w_string with space.</b>
or ...
loop at itab into wa.
<b>replace all occurrences of C_HTAB in wa with space.</b>
endloop.
2007 Apr 17 8:15 AM
Hi,
eventhough im using replace statement its not getting replaced.
the # is displayed in the print out.
i have given points to you.
any suggestions?
thanks
Suganya
2007 Apr 17 9:53 AM
2007 Apr 17 10:00 AM
Hi sugunya,
can u paste ur code of call function 'read_text' here??
and also the contents ( 1 line enough ) of itab u r getting with the text lines...
2007 Apr 17 10:01 AM
2007 Apr 19 3:06 AM
hi,
ltext-TDFORMAT = *
ltext-TDLINE = BOM LIST.#
This is data after the read_text FM.
but the display in the print out should be as below
BOM LIST.
but the display in the print out is coming as
BOM LIST.#
This is the code,
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'AVOT'
language = sy-langu
name = tdname
object = 'AUFK'
archive_handle = 0
IMPORTING
HEADER = LHEAD
TABLES
lines = ltext
EXCEPTIONS
not_found = 4.
IF sy-subrc = 0.
DELETE ltext FROM 1 TO 1.
IF lhead-tdname NE ''.
LOOP AT ltext.
cnt = cnt + 1.
replace all occurrences of C_HTAB in ltext-tdline with space.
IF cnt = 1.
w_cnt1 = w_cnt1 + 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'OP_LONGTEXT'
window = 'MAIN'.
ELSE.
w_cnt1 = w_cnt1 + 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'OP_LONGTEXT2'
window = 'MAIN'.
ENDIF.
ENDLOOP.
ENDIF.
kindly give me some suggestion....
thanks
Suganya
2007 Apr 19 6:48 AM
Hi Sugunya,
do one thing...
<b>data: w_str type string.</b>
LOOP AT ltext.
cnt = cnt + 1.
<b>w_str = ltext-tdline.</b>
<b>replace all occurrences of '#' in w_str with space.</b>
ltext-tdline = w_str.
<place ur code>
..
.
.
endloop.
OR...
constants :
C_HTAB value CL_ABAP_CHAR_UTILITIES=><b>NEWLINE</b>.
replace all occurrences of C_HTAB in w_str with space.
try this ....
Rammohan
2007 Apr 19 7:57 AM
Hi Rammohan Nagam,
Thanks, u have solved my issue.
Thanks a lot.
It works....thank u
2007 Apr 19 6:56 AM
HI,
Refer code below.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z031'
LANGUAGE = SY-LANGU
NAME = G_TEXT_KEY
OBJECT = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = TD_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
DELETE TD_LINE WHERE TDFORMAT = '*'
AND TDLINE = SPACE.
READ TABLE TD_LINE INTO TD_LINE_STRUCTURE INDEX 1.
I think it is useful.
Reward with points if helpful.
Regards
Santosh