‎2006 Apr 21 10:41 AM
Hi all,
While i am trying to read long text thru "READ_TEXT" function module , instead of "&" i am getting "(<)&(>)" .
For ex.
if the long text which i have to read is
<b>" hi all & h r u & "</b>
while reading am getting a text like this
<b> "hi all (<)&(>) h r u (<)&(>)" .</b>
hope u got my problem n could nybody there to help me out
‎2006 Apr 21 12:13 PM
hi,
if the problem is not solved then u can manually change to original text .
that is use following command.
REPLACE ALL OCCURRENCES OF '(<)&(>)' IN text WITH '&'.
i.e
loop at TLINE.
REPLACE ALL OCCURRENCES OF '(<)&(>)' IN TLINE-TDLINE WITH '&'.
Modify TLINE.
endloop.
regards
Manoj
‎2006 Apr 21 10:45 AM
Can you show your code?
How do you know that the long text is that way?
‎2006 Apr 21 10:50 AM
‎2006 Apr 21 12:13 PM
hi,
if the problem is not solved then u can manually change to original text .
that is use following command.
REPLACE ALL OCCURRENCES OF '(<)&(>)' IN text WITH '&'.
i.e
loop at TLINE.
REPLACE ALL OCCURRENCES OF '(<)&(>)' IN TLINE-TDLINE WITH '&'.
Modify TLINE.
endloop.
regards
Manoj
‎2006 Apr 21 12:32 PM
thatz fine manoj , but there might be some case like i need to enter text <b>(<)hi(>)</b> . Actually there will be no scenario like this , but if i need to do that by some chance then u'r procedure is not appropriate. My intention is to know why we get those characters, is that because of length ? or type ?
‎2006 Apr 24 8:17 AM
Hi manoj ,
I have tried everything to solve this problem but ulmately i have to use replace . But in 4.6 am unable to use REPLACE ALL OCCURRENCES , When i am using REPLACE WITH , only first occurrence is being replaced , could you help how i can replace that in entire text .
‎2006 Apr 21 12:32 PM
HI
refer this code
REPORT ZTEXT .
TABLES: PBIM.
stxh, stxl, stxb - trans tables for text
ttxit - text on text-ids
ttxot - Short texts on text objects
Transaction MD63
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
S_WERKS FOR PBIM-WERKS.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: BEGIN OF LTEXT OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF LTEXT.
DATA: BEGIN OF DTEXT OCCURS 50.
DATA: MATNR LIKE PBIM-MATNR.
INCLUDE STRUCTURE TLINE.
DATA: END OF DTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
MOVE PBIM-BDZEI TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'PB'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'PBPT'
ARCHIVE_HANDLE = 0
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
MOVE PBIM-MATNR TO DTEXT-MATNR.
APPEND DTEXT.
ENDIF.
ENDLOOP.
ENDSELECT.
LOOP AT DTEXT.
WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
ENDLOOP.
if you still have the problem then look at the text table defination... even you can replace this by usin gthe REPLACE with spaces with some conditions
Thanks
Sudheer
‎2006 Apr 22 4:36 AM
‎2006 Apr 22 6:53 AM
Hi Jwalith,
this behaviour may be due to the reason that & is used to identify variables in the script.. u may verify this by putting anything else in the text..it wont create any such problems.. hence, u may need to get the text in the program, n then make necessary modifications as suggested in the posts above,..
Regards,
Bikash
‎2006 Apr 23 6:56 AM
after reading the text using READ_TEXT use FM CONVERT_ITF_TO_ASCII to convert it to ASCII format.
pass the itf content from READ_TEXT to itf_lines table in CONVERT_ITF_TO_ASCII
C_DATATAB export parameter will return the correct results.
Regards
Raja
‎2006 Apr 23 7:08 AM
here is the complete code sample.
DATA: itf_tab TYPE STANDARD TABLE OF tline ,
wa_itf TYPE tline .
DATA: c_datatab TYPE tdtab_c132 .
.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'ST'
language = sy-langu
name = 'Y_RAJA_HTML'
object = 'TEXT'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER = HEADER
TABLES
lines = itf_tab
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.
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 = FORMATWIDTH_E
* X_DATATAB = X_DATATAB
c_datatab = c_datatab
* X_SIZE = X_SIZE
TABLES
itf_lines = itf_tab
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.Regards
Raja
‎2006 Apr 24 8:13 AM
Hi Durairaj,
That was a gr8 reply, actually i am working on 4.6 , the function module which u had specified is not there so i have used FM "DSVAS_TEXTE_CONVERT_ITF2ASCII" . This FM solved my problem and raised another problem. That was , its again converting some text to <*> and also am not getting the entire text after calling this function module , could you please look into it ,
‎2006 Apr 24 8:36 AM
<*> is the TD format. before passin the ITF table from READ_TEXT to this convert to ASCII function clear the TD format column.
not getting the entire text? is some text getting cut off?
as for replace all
do
find '<' in <var> .
if sy-suvrc eq 0 .
replace ...
else .
exit .
endo .
Regards
Raja
‎2006 Apr 24 12:24 PM
Hi Durairaj,
Thanq for u'r repetative search n replace. Regarding READ_TEXT and ASCII conversion , some text is missing. what might be the problem. I awarded points for u
‎2006 Apr 24 12:41 PM
its very difficult to anyalyze the issue. are you using some stadandard staandard text or cutom one. if its a standard one, give me the name of the text i will try to simulate the case to check.
Regards
Raja
‎2015 Mar 03 12:33 PM