Application Development 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_text with special character "&".

Former Member
0 Kudos

Hi Friends,

I am using the READ_TEXT to read the texts in the invoice header. In one of the text type there is an "&" and it reads out as

"<(>&<)>".

If i print the same invoice from SAP Script its printing properly.

I am using this function to extract the text and send it to the Legacy system.

Please share your thoughts on this.

Venky.

3 REPLIES 3

valter_oliveira
Active Contributor
0 Kudos

I can only remember of a solution like:


DATA: lines TYPE STANDARD TABLE OF tline,
      wa TYPE tline,
      char1 TYPE char3 VALUE '<(>',
      char2 TYPE char3 VALUE '<)>'.

CALL FUNCTION 'READ_TEXT'
  EXPORTING
    client   = sy-mandt
    id       = '0001'
    language = 'P'
    name     = '0000000001'
    object   = 'VBBK'
  TABLES
    lines    = lines.

LOOP AT lines INTO wa.
  IF wa-tdline CA char1 OR wa-tdline CA char2.
    REPLACE ALL OCCURRENCES OF char1 IN wa-tdline WITH space.
    REPLACE ALL OCCURRENCES OF char2 IN wa-tdline WITH space.
    CONDENSE wa-tdline.
  ENDIF.
ENDLOOP.

Regards,

Valter Oliveira

0 Kudos

Valter,

In this case if someoine has used brackets in the text, it will replace the brackets with the space too.. do you know any other solution?

Regards,

Kamesh Bathla

0 Kudos

Hi

The brackets <(>&<)> are placed automatically by the system if the text is written by new editor, the bracket is placed because & is a special character in SAPSCRIPT, infact it's used to introduced a variable has to be printed: &VAR&

Max