Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

READ_TEXT problem with unwanted #

Former Member
0 Likes
1,511

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,349

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.

9 REPLIES 9
Read only

Former Member
0 Likes
1,350

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.

Read only

0 Likes
1,349

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

Read only

0 Likes
1,349

try with CL_ABAP_CHAR_UTILITIES=>CR_LF

Read only

0 Likes
1,349

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...

Read only

0 Likes
1,349

try this..

TRANSLATE V_STR USING '# '.
condense V_STR.

Read only

0 Likes
1,349

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

Read only

0 Likes
1,349

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

Read only

0 Likes
1,349

Hi Rammohan Nagam,

Thanks, u have solved my issue.

Thanks a lot.

It works....thank u

Read only

Former Member
0 Likes
1,349

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