‎2007 Jan 12 10:01 AM
Hi,
I had read XML file into an internal table. XML source has tag like
</ITM_NUMBER
>
The closing tag is in below line below line because prior to this closing tag >
a special character is visible []> for me .
if i copy that symbol [] into sap it is nothing but Enter.
But in debugging if i see the contents of itab.
instead of [] the itab consists of #.
if i delete [] in source XML file the program is working.
i want to delete in SAP which is # symbol from internal table.
Totally i want to delete this special character from internal table.
Regards,
Ratna
‎2007 Jan 12 10:09 AM
loop at itab into wa_itab.
search wa_itab-text for '#'.
if sy-subrc eq 0.
replace all occurrences of '#' in wa_itab-text with space.
condense wa_itab-text.
modify itab from wa_itab
endif.
endloop.
‎2007 Jan 12 10:06 AM
HI,
DELETE ALL OCCURRENCES OF '#' In ITAB-TEXT into ITAB-TEXT.
modify ITAB.
Regards
Sudheer
‎2007 Jan 12 10:09 AM
loop at itab into wa_itab.
search wa_itab-text for '#'.
if sy-subrc eq 0.
replace all occurrences of '#' in wa_itab-text with space.
condense wa_itab-text.
modify itab from wa_itab
endif.
endloop.
‎2007 Jan 12 10:55 AM
Hi,
your valuble suggestions are very helpful for me.
here in this context 'replace all occurrences' does this work in SAP 4.6 c
since i am getting error.
Regards,
Ratna
‎2007 Jan 12 11:03 AM
Yes you are right , it will not work in SAP 4.6c
I guess u have only one # symbol per line , if so
use
REPLACE '#' with SPACE INTO ITAB-TEXT
and let me know if it works
‎2007 Jan 12 10:21 AM
hi the below thread exactly deals with a similar problem
https://forums.sdn.sap.com/click.jspa?searchID=715686&messageID=2731222
check it and award points if found helpful, see to it that u are making ur program unicode compatible
‎2007 Jan 12 10:29 AM
Hai Ratna
Check the following Code
tables : mara.
data : begin of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
mbrsh like mara-mbrsh,
mtart like mara-mtart,
meins like mara-meins,
end of itab.
*--Internal table to hold the XML contents.
data : begin of it_xml occurs 1,
line(255) type c,
end of it_xml.
data : v_qty(16) type c.
select-options : s_matnr for mara-matnr.
start-of-selection.
perform get_data.
if not itab[] is initial.
perform build_xml.
endif.
end-of-selection.
perform download_xml.
&----
*& Form get_data
&----
text
form get_data .
clear : itab.
refresh : itab.
select a~matnr
b~maktx
a~mbrsh
a~mtart
a~meins
into table itab
from mara as a
inner join makt as b
on bmatnr = amatnr
where a~matnr in s_matnr and
b~spras = sy-langu.
select matnr
mbrsh
mtart
meins
into table itab
from mara
where matnr in s_matnr.
endform. " get_data
&----
*& Form build_xml
&----
text
----
form build_xml .
sort itab by matnr.
*--This logic interprets the XML code behaviour hardcoded
*--to build the xml content.
loop at itab.
at first.
it_xml-line = '<materialdata>'.
append it_xml.
clear it_xml.
endat.
at new matnr.
read table itab index sy-tabix.
concatenate '<Material No = ' ' "' itab-matnr '"' '>' into it_xml-line.
append it_xml.
clear it_xml.
endat.
concatenate '<desc>' itab-maktx '</desc>' into it_xml-line.
append it_xml.
concatenate '<Mat.Type>' itab-mbrsh '</Mat.Type>' into it_xml-line.
append it_xml.
concatenate '<ind.sec>' itab-mtart '</ind.sec>' into it_xml-line.
append it_xml.
concatenate '<unit.mes>' itab-meins '</unit.mes>' into it_xml-line.
append it_xml.
at end of matnr.
it_xml-line = '</Material>'.
append it_xml.
clear it_xml.
endat.
endloop.
it_xml-line = '</materialdata>'.
append it_xml.
clear it_xml.
endform. " build_xml
&----
*& Form download_xml
&----
text
----
form download_xml .
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\mat.xml'
filetype = 'ASC'
tables
data_tab = it_xml.
endform. " download_xml
Regards
Sreeni
‎2007 Jan 12 11:16 AM
Hi,
SAP uses # as representation of non-displayable characters. Switch to HEX representation to see what it really is. ENTER may be a simple line feed or a carriage-return and a linefeed. As it is only one character, Linefeed can be assumed. Remove it using
DELETE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>NEWLINE
Regards,
Clemens
‎2007 Jan 12 11:52 AM
Hi Clemens,
Thanks for your help.
But i am using SAP 4.6c, <b>Delete All</b> syntax does not allowing.
Regards,
Ratna.
‎2007 Jan 12 11:59 AM
‎2007 Jan 12 12:02 PM
if ur problem is not still solved(If u have more than 1 # in one line ) , then
data : v_len type i,
v_i type i.
v_i = 0.
loop at itab into wa_itab.
v_len = strlen(wa_itab).
v_len = v_len - 1.
do v_len times.
search wa_itab+v_i(1) for '#'.
if sy-subrc eq 0.
clear wa_itab_v_i(1).
endif.
v_i = v_i + 1.
enddo.
modify itab from wa_itab.
endloop.
‎2007 Jan 12 12:08 PM