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 function

Former Member
0 Likes
1,353

hi,

i have a prob. when i run read function, let say my data in header text is

we & you

then this function returns

we <(>& <)> you

why this is happing and how can i got same text as i feed in header text.

i.e. it convert & char. to <(>& <)>

mukesh

8 REPLIES 8
Read only

Former Member
0 Likes
1,035

Hi Mukesh,

You can look at the sample code at this link.

I hope it will surely help you.

[http://www.sap-img.com/abap/use-fm--read-text-to-read-the-various-text.htm]

Regards,

Amit.

Read only

Former Member
0 Likes
1,035

Hi,

try this..



data:       it_lines TYPE STANDARD TABLE OF tline.
DATA: c_tab TYPE tdtab_c132 WITH HEADER LINE.


  CALL FUNCTION 'READ_TEXT'
    EXPORTING
     client                        = sy-mandt
      id                            = 'B01'
      language                      = sy-langu
      name                          = name
      object                        = 'EBANH'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
    TABLES
      lines                         = it_lines
 EXCEPTIONS
   id                            = 1
   language                      = 2
   name                          = 3
   not_found                     = 4
   object                        = 5
   reference_check               = 6
   wrong_access_to_archive       = 7
   OTHERS                        = 8
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  REFRESH c_tab[].

  CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
   EXPORTING
*     CODEPAGE                = '0000'
     formatwidth             = 72
     language                = sy-langu
     tabletype               = 'ASC'
*     TAB_SUBSTITUTE          = ' '
*     LF_SUBSTITUTE           = ' '
     replace_symbols         = 'X'
     replace_sapchars        = 'X'
   IMPORTING
*     FORMATWIDTH_E           =
*     X_DATATAB               =
     c_datatab               = c_tab[]
*     X_SIZE                  =
    TABLES
      itf_lines               = it_lines
*   EXCEPTIONS
*     INVALID_TABLETYPE       = 1
*     OTHERS                  = 2
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  LOOP AT c_tab.
    CONCATENATE text c_tab INTO text  SEPARATED BY space.
  ENDLOOP.

Arunima

Read only

Former Member
0 Likes
1,035

After the function module, use the following;

REPLACE ALL OCCURRENCES OF '<(>'  IN TABLE itab_lines WITH '' .
REPLACE ALL OCCURRENCES OF '<)>'  IN TABLE itab_lines WITH '' .

This will solve your problem.

Regards

Karthik D

Read only

0 Likes
1,035

hello karthik,

actually this prob occurs for every special character...so it is not possible to write this line for every special character....so it is better to pass the final table through any perticular FM...i think it will be much more easier..

Arunima

Read only

0 Likes
1,035

As far as i tested only special characters like $ and < are enclosed as mentioned by you that too all are enclosed by the same format <(> <)> So you can make use of my code.

Regards

Karthik D

Read only

0 Likes
1,035

No...it is for all special characters....and also for special styles...in the text if you underline or bold or something other style use..then also some unknown character will come in the output....so i have passed it in this FM....so all the formatting will be ok...

Arunima

Read only

0 Likes
1,035

Thats ok, if you got the solution close the thread as answered.

Regards

Karthik D

Read only

Former Member
0 Likes
1,035

thanks