cancel
Showing results for 
Search instead for 
Did you mean: 

RFC to File - XML file output

Former Member
0 Kudos

Hi,

We are doing a RFC to file scenario where our o/p file is in XML format.

The required o/p file format is :


<?xml version="1.0" ?> 
<MAT_GROUP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <HEADER>
  <MINISTRY_CODE>TOT</MINISTRY_CODE> 
  <DEPARTMENT_CODE>000</DEPARTMENT_CODE> 
  </HEADER>
 <DETAILS>
   <MATERIAL_GROUP>
     <CODE>THIRDPRTY</CODE> 
    <END_DATE xsi:nil="true" /> 
  </MATERIAL_GROUP>
  </DETAILS>
 </MAT_GROUP>

But i am using a graphical mapping which gives me the following o/p


<?xml version="1.0" encoding="utf-8" ?> 
 <xsi:MAT_GROUP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <HEADER>
  <MINISTRY_CODE>TOT</MINISTRY_CODE> 
  <DEPARTMENT_CODE>000</DEPARTMENT_CODE> 
  </HEADER>
 <DETAILS>
<MATERIAL_GROUP>
     <CODE>THIRDPRTY</CODE> 
    <END_DATE>0000-00-00</END_DATE> 
  </MATERIAL_GROUP>
  </DETAILS>
 </MAT_GROUP>

can u let me know how to remove xsi which is before MAT_GROUP and how to changed the END_DATE with xsi:nil="true"

I tried to do XSLT mapping using ALTOVA by following the steps given in the link [url]http://wiki.sdn.sap.com/wiki/display/XI/FileTOFile-UsingXSLTmapping(forBeginners) but when i copy the XSD code from DT and save it as XML/XSD file and trying to Insert it into ALTOVA Mapforce it is not able to create the schema and shows the following error:

An error has occurred when generating an XML schema for the file C:\Documents and Settings\ISSUSER\Desktop\Gebiz\xml code\header_rcv1.xml.

Nothing to generate. Maybe all root elements are in known namespaces (e.g. 'http://www.w3.org/2001/XMLSchema').

Can anyone guide me...

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member200962
Active Contributor
0 Kudos
The required o/p file format is :
<?xml version="1.0" ?> 

But i am using a graphical mapping which gives me the following o/p
<?xml version="1.0" encoding="utf-8" ?>

For this check the JAVA code given by Suraj in this thread:

Regards,

Abhishek.

Former Member
0 Kudos

can we use multiple types of mapping at the same time?

b'cos we also want to remove xsi in the o/p file

<xsi:MAT_GROUP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

former_member200962
Active Contributor
0 Kudos
can we use multiple types of mapping at the same time?

Keep the JAVA mapping as the last one in the Interface Mapping.....and yes you can use multiple mapings (types of mappngs) in the same Interface Mapping.

If you remove the namespace from Message Type then too you will see xml encoding tag in the output.....to remove this xml encoding you have to use the JAVA mapping.

b'cos we also want to remove xsi in the o/p file

You want to remove only xsi?

Regards,

Abhishek.

Edited by: abhishek salvi on May 27, 2010 4:57 PM

Former Member
0 Kudos

Hi,

We want to remove the xsi which is prefixed to MAT_GROUP

<xsi:MAT_GROUP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

.

.

.

</xsi:MAT_GROUP>

Former Member
0 Kudos

Hi,

Can anyone send me the JAR file com.sap.aii.mapping.api. B'cos we are not able to find it in our PI server.

We are using PI 7.1.

stefan_grube
Active Contributor
0 Kudos

Create your target message type without a namespace.

If you have PI 7.11 you can use constant xsd:nil for this purpose.

Otherwise add that nil and the namespace with XSLT

Former Member
0 Kudos

Hi,

Do u mean that passing xsi:nil="true" in Message mapping or in DT.

We are using PI 7.1

stefan_grube
Active Contributor
0 Kudos

> Do u mean that passing xsi:nil="true" in Message mapping or in DT.

In message mapping

> We are using PI 7.1

This only works with PI 7.1 EhP1

Former Member
0 Kudos

Try this - Edit your Message Type in ESR/IR and make the XML namespace field blank. This will remove the xmlns:xxx stuff from the payload.

If you want to go for XSLT mapping, check out this tutorial - [Beginneru2019s Guide to XSLT Mapping in SAP PI|http://www.riyaz.net/blog/beginners-guide-to-xslt-mapping-in-sap-pi/technology/sap/769/]

Former Member
0 Kudos

Hi Riyaz,

I hope that we cant change anything in the Message type except inputting the DT & its namespace.

and also we cannot create a message type without the namespace since it is one of the mandatory field

do u want me to change in DT?

Former Member
0 Kudos

Hi,

The field XML Namespace is available in Message Type. Not in datatype. This field is very much editable, check again. Generally data type namespace by default gets copied to this field. If you make it blank, your payload namespace will become blank.

Edit: Please note that Namespace and XML Namespace are two different fields

Edited by: Riyaz Sayyad on May 27, 2010 3:30 PM

Former Member
0 Kudos

Hi,

i have removed the value in XML namespace of MT, but still no effect

Former Member
0 Kudos

Go for XSLT mapping then. You can design and tweak your XSL template the way you want to get the desired output. If it is plain one to one mapping or with simple transformation logic, you can create XSLT file using any text editor. No need to use Mapforce if you are finding it difficult.