cancel
Showing results for 
Search instead for 
Did you mean: 

XML with BSP

Former Member
0 Kudos

Hello,

I have created a xml file "data.xml" with a string page

attribut "xml" and the following page layout.

<?xml version='1.0' encoding='iso-8859-1'?>

<%@page language="abap"%>

<%=xml%>

in the event handler "On Request" I set the xml variable

with the following SELECT statement

SELECT matkl, bez .....

REPLACE '<' IN bez WITH ' kl '.

REPLACE '>' IN bez WITH ' gr '.

CONCATENATE item '<ITEM>' '<VAL>' matkl '</VAL>' '<DES>' bez '</DES>' '</ITEM>' INTO item.

ENDSELECT.

CONCATENATE '<GOODSGROUPS>' item '</GOODSGROUPS>' INTO xml.

As you can see I use the character encoding "iso-8859-1"

http://www.validome.org/doc/HTML_ge/inter/zeichensaetze.htm

My problem is that there are some characters that cannot

be viewed. Why? And which one? (I found out that there

are problems to view "<" and ">" and I REPLACED this one)

Error message in Web browser

<?xml version="1.0" encoding="iso-8859-1" ?>

- <GOODSGROUPS>

- <ITEM>

<VAL />

<DES />

</ITEM>

- <ITEM>

<VAL>1AA</VAL>

<DES>Si Scheiben kl150mm</DES>

</ITEM>

- <ITEM>

<VAL>4BF</VAL>

<DES>geloescht</DES>

</ITEM>

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

-


A semi colon character was expected. Error processing resource 'http://vies12ex.vih.infineon.com:1080/sap/bc/bsp/sap/y_data...

<ITEM><VAL>5BD</VAL><DES>E undV Pressen</DES></ITEM><ITEM><VAL>5BE</VAL&g...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Give us the whole XML. Open the file via notepad and copy it.

For a better overview, restrict the select for one line, so that we can see the minimum xml.

Former Member
0 Kudos

bellow u can see the whole abap code in the event handler (OnRequest). the variable "xml" contains the whole xml code, which is dynamically generated.

-


DATA: matkl TYPE T023-MATKL,

wgbez TYPE T023T-WGBEZ,

item TYPE string,

bez TYPE string,

schar.

item = ''.

SELECT FMATKL PWGBEZ

INTO (matkl, wgbez)

FROM T023 AS F JOIN T023T AS P

ON FMATKL = PMATKL AND

FMANDT = PMANDT

WHERE P~SPRAS = SY-LANGU.

bez = wgbez.

REPLACE '<' IN bez WITH ' kl '.

REPLACE '>' IN bez WITH ' gr '.

CONCATENATE item '<ITEM>' '<VAL>' matkl '</VAL>' '<DES>' bez '</DES>' '</ITEM>' INTO item.

ENDSELECT.

CONCATENATE '<GOODSGROUPS>' item '</GOODSGROUPS>' INTO xml.

-


the thing is, everything works without

the column "wgbez", only in this column are some characters

which cause troubles. But also in this column there are

only characters from ISO-8859-1 (Latin-1) character set.

Thx 4 help!

BR,

Rene.

athavanraja
Active Contributor
0 Kudos

simply selecte the data into and internal table and then use

CALL TRANSFORMATION to create the xml.

code sample.

call transformation (`ID`)

source output = itab[]

result xml xml_out.

variable xml_out can be of type string or xstring.

Regards

Raja

Former Member
0 Kudos

Hello Raja,

Thanks a lot!

This is exactly the solution I was looking for!

BR,

Rene.

Answers (0)