Abt XSLT tricky mapping
Hi Friends,
I am working on one scenario file to IDoc using XSLT Mapping.I have got the following query.
The file is obtained by the third party as xsd file.
This xsd file is mapped to IDoc.The xsd file contains multiple tax details (E1EDK04 seg) at the header level and multiple line item details at the item level (E1EDP01- E1EDP04 seg).
My query is, for each Tax header detail (E1EDK04), only one Tax Item detail /item detail should appear.
For ex:
E1EDK04(1) should match with E1EDP01-E1EDP04 (1) values. and so on.
IDOC
--E1EDK04 (1)
--E1EDK04 (2)
--E1EDP01
E1EDP02
E1EDP04 (1)
--E1EDP01
E1EDP02
E1EDP04 (2)
Currently I am getting structure as below:
IDOC
--E1EDK04 (1)
--E1EDK04 (2)
--E1EDP01
E1EDP02
E1EDP04 (1)
E1EDP04 (2)
--E1EDP01
E1EDP02
E1EDP04 (1)
E1EDP04 (2)
but the desired result is :
IDOC
--E1EDK04 (1)
--E1EDK04 (2)
--E1EDP01
E1EDP02
E1EDP04 (1)
--E1EDP01
E1EDP02
E1EDP04 (2)
E1EDK04 (1) seg to E1EDP04 (1)seg and so on for the above case using XSLT mapping..?
Thanks in advance for your help
Sam
Is there a specific reason why you are using XSLT mapping? You can go for graphical mapping and use node functions to acheive your result.
Similar Messages
-
How to use XSLT for mapping feild names one by one to array element
I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
I give an sample below.
source:
<Items xmlns="http://www.example.org/sample">
<SourceSystem>SourceSystem2573</SourceSystem>
<TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
<Item>
<ID>2574</ID>
<Type>2575</Type>
<Name>2576</Name>
</Item>
</Items>
source XSD like:
<element name="Items" type="tns:ItemsType"></element>
<complexType name="ItemsType">
<sequence>
<element name="SourceSystem" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="TimeStamp" type="dateTime" maxOccurs="1"
minOccurs="1">
</element>
<element name="Item" type="tns:ItemType"
maxOccurs="unbounded" minOccurs="1">
</element>
</sequence>
</complexType>
<complexType name="ItemType">
<sequence>
<element name="ID" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="Type" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="Name" type="string" maxOccurs="1"
minOccurs="1">
</element>
</sequence>
</complexType>
target need to be like:
<ns1:AttributesCollection>
<ns1:Attributes>
<ns1:fieldname>SourceSystem</ns1:fieldname>
</ns1:Attributes>
<ns1:Attributes>
<ns1:fieldname>TimeStamp</ns1:fieldname>
</ns1:Attributes>
<ns1:Attributes>
<ns1:fieldname>ID</ns1:fieldname>
</ns1:Attributes>
<ns1:Attributes>
<ns1:fieldname>Type</ns1:fieldname>
</ns1:Attributes>
<ns1:Attributes>
<ns1:fieldname>Name</ns1:fieldname>
</ns1:Attributes>
</ns1:AttributesCollection>
target XSD:
<xs:element name="AttributesCollection" type="AttributesCollection"/>
<xs:complexType name="AttributesCollection">
<xs:sequence>
<xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Attributes">
<xs:sequence>
<xs:element name="fieldname" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
I know we can use local-name() to get the tag/field name,
but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
I tried whole day but no successful
Does anyone have some idea?
Thanks very much!
Keith
Edited by: user1065212 on 17-Jan-2010 22:50
Edited by: user1065212 on 17-Jan-2010 22:53
Edited by: user1065212 on 17-Jan-2010 22:59can you paste source xsd and the correct xml output, the current one isn't really valid
<ID>2574</TotalNumOfItems> -
Hi All,
I am working on XSLT in 10g(10.1.3.4), Also I would like to use auto-map option available in Jdev.
currently mapping is done as below,
<ProductName>
<xsl:value-of select="ProductName"/>
</ProductName>
But I would need each node encapsulated with xsl:if, so that epmty node will not present in output doc.
ExampleWith xsl:If
<xsl:if test="ProductName">
<ProductName>
<xsl:value-of select="ProductName"/>
</ProductName>
</xsl:if>
is this auto option is available in 10g?
Please help me to achieve this in 10 g XSLT.
thanks,
SantoshI think there is a misunderstanding as to what a persistence layer is and does... To update your application with new state, you need to first update your object model (has nothing to do with TopLink), then your application (again, nothing to do with TopLink), and then your mappings and persistence layer code (has to do with TopLink). There is no magic here.
Auto-mapping is a feature in the Mapping Workbench to do much of the tedious O-R mapping automatically. It does not automatically keep your application up to date with schema chages.
- Don -
Hello,
we want to use the value mapping table in ID with XSLT.
Here is my source:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Source xmlns:ns0="http://comsol-ag.com/xi/rfcxslt">
<CustomerNumber>A</CustomerNumber>
</ns0:Source>
XSLT Mapping:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:trg="http://comsol-ag.com/xi/rfcxslt" xmlns:ns0="http://test/xi/tsts" xmlns:ValueMap="java:com.sap.aii.mapping.value.api.XIVMService">
<xsl:template match="/">
<trg:Target>
<CustomerInfo>
<xsl:variable name="sourceValue" select="ns0:Source/CustomerNumber"/>
<ID>
<xsl:value-of select="$sourceValue"/>
</ID>
<xsl:variable name="response" select="ValueMap:executeMapping('http://sap.com/XI/xi','SourceAgency','SourceScheme',string($sourceValue),'http://sap.com/XI/xi','TargetAgency','TargetSchema')"/>
<Name>
<xsl:value-of select="$response"/>
</Name>
</CustomerInfo>
</trg:Target>
</xsl:template>
</xsl:stylesheet>
Target:
<?xml version="1.0" encoding="utf-8" ?>
<trg:Target xmlns:trg="http://comsol-ag.com/xi/rfcxslt">
<CustomerInfo>
<ID>A</ID>
<Name /> ???????????????????????????????????
</CustomerInfo>
</trg:Target>
But the receiving data is not converted to value table in ID:
Integration Directory Value Table :
http://www.image-load.eu/out.php/i26896_pic1.PNG
Please point out where i m going wrong.
Thanksproblem solved!
-
XSLT Interface Mapping Not Found For HTTP Response
NW 04's SR 10, RFC => XSL => HTML
The scenario transforms data from R/3 into XML using XSLT and sends it to a 3rd party vendor wrapped inside a field of an HTML form via the HTTPS adapter. XSL was used for this instead of standard MessageMapping to meet the customer's needed for the XML data to be delivered in an untransformed structure, including their DTD declaration, so they could parse it upon receipt.
The outbound process is successful and the data is posted to the customer's database. Upon receipt, they send back a simple HTML form containing the success/failure in an H1 tag and our submitted XML data in the Body tag.
The problem is that due to the use of an XSL as the outbound mapping XI does not have a cached message structure to which it can map the response and thus throws the <b>Interface mapping .... does not exist in runtime cache</b> message. I do not feel this is a cache problem since I've cleared the XI cache, CPACache and anything else I've read as well as verified that the outbound mapping exists in the XI Cache list. I honestly feel I'm just missing a necessary piece to tell XI how to map the HTML response message back to the RFC Sender.
I have attempted numerous ideas, one of which included the use of the same RFC structure as the inbound and outbound MessageType so that a Response mapping could be specified but a NullPointerException was thrown in the mapping step since the response was of a completely different structure.
My question is how to handle the return data when using XSLT to create the outbound structure dynamically to prevent runtime errors in XI?
Thanks in advance,
LaneThanks for the quick response Bhavesh.
I figured out the response mapping option after I posted the question and also thought of using XSL to handle the response but I ran into a few other issues relating to my limited experience with XSLT that is preventing me from completely solving this.
The response is a plain HTML file structured as:
< html >
< body >
< h1 >Success/FailureMessage< /h1 >
< br >
Record Created
< br >< br > XML Data: <?xml version="1.0" encoding="utf-8"?><!DOCTYPE ....
< /body >
< /html >
where the actual XML data posted to the client system is embedded in the HTML body. Therefore the response is not well-formed XML and fails on parsing but also contains another XML message within the HTML structure that throws off parsing as well. Do you know XSLT well enough to get around this?
What about writing a Java function that just reads the incoming information but in doing this how do I go about mapping back to the RFC? Can I get ahold of the XI API somewhere to instantiate the RFC Objects dynamically?
Thanks again,
Lane -
Hi. Here is my scenario: eGIS -> PI -> SAP
Asynchronous web service call to PI, which I'd like to split into one of two calls, either an IDoc or an RFC call to SAP, depending on the value of a field being passed from eGIS. I'd like to do this using XSLT mapping, as I already have the mapping for the IDoc call.
Is this possible? I'm running PI 7.0 SP 20.
Thank you.
NicoleThis should be simple as said above..
Step 1: Create a message mapping between your source message and target RFC
Step 2: Create an Interface mapping between your source interface and RFC
Step 3: In ID part in the existing Interface Determination 'Add one more Inbound interface(select your RFC)' and select the corresponding Interface mapping created in Step 2. Now save the Interface Determination and you will find a condition editor added for both the 'existing and newly created interface mapping'. specify the respective conditions.
Step 4: Create a Receiver agreement for the RFC.
Hope this helps..
Regards,
Zameer -
XSLT & JAVA Mapping issue.
is there any situation,
where we should definately go for XSLT mapping..
where we should definately go for JAVA mapping..
can anyone brief me plz....
Cheers,
RaghaveshNo hard and fast rules.
There never can be specific rules.
1. Java Mapping should be used when the input is NON XML for sure. As the input is a InputSTream, you can convert it to a string and do the needful programmic logic etc.
2. XSL can be used with HTML source etc.
Regards
Bhavesh -
Help required on XSLT Conditional Mapping
Hi,
We need help on XSLT mapping in BPEL based on a condition. We are transforming from OAG format to a client specific format. We need to map a single tag (but repetitive) on the left hand side (OAG) to different tags on the right hand side. The same tag on the left hand side repeats with different values. Depending on the value the mapping to the right hand side varies. The left hand side (OAG) looks something like this.
<PARTNER>
<PARTNRID>2002</PARTNRID>
<PARTNRTYPE>Supplier</PARTNRTYPE>
<ADDRESS>
<ADDRLINE index="1">2000 Century Way</ADDRLINE>
</ADDRESS>
</PARTNER>
<PARTNER>
<PARTNRID>204</PARTNRID>
<PARTNRTYPE>BillTo</PARTNRTYPE>
<ADDRESS>
<ADDRLINE index="1">90 Fifth Avenue</ADDRLINE>
</ADDRESS>
</PARTNER>
Please note that the tag PARTNER and it's underlying tags appear twice in the XML file.
Based on the value in the tag PARTNRTYPE, the mapping to the right hand side differs. If the value is 2002, PARTNRID should map to Supplier ID on the right hand side and if the value is 24, PARTNRID should map to BillTo ID on the right hand side. The right hand side should look something like
<Supplier>
<SupplierID>2002</SupplierID>
<Address>2000 Century Way</Address>
</Supplier>
<BillTo>
<BillToID>204</BillToID>
<Address>90 Fifth Avenue</Address>
</BillTo>
Please let us know how to achieve this. Your help is much appreciated. Thanks in advance.
Thanks,
PrasannaHi Prasanna ,
I am not an expert but what about this:
<SUPPLIERID>
<xsl:value-of select="/PARTNER/PARTNRID[../PARTNRTYPE = '2002']"/>
</SUPPLIERID>
<BILLTOID>
<xsl:value-of select="/PARTNER/PARTNRID[../PARTNRTYPE = '24']"/>
</BILLTOID>or
<xsl:choose>
<xsl:when test="/PARTNER/PARTNRTYPE = '2002'">
<SUPPLIERID>
<xsl:value-of select="/PARTNER/PARTNRID"/>
</SUPPLIERID>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="/PARTNER/PARTNRTYPE = '24'">
<BILLTOID>
<xsl:value-of select="/PARTNER/PARTNRID"/>
</BILLTOID>
</xsl:when>
</xsl:choose>Regards Pete -
There is one existing message interface, It is using XSLt mapping, When I click on XSLT mapping program :
It goes to "Display Imported Archive"
Where it shows the mapping XSL file.
When I tried to open the xsl file from the Integration repository in edit mode, : Either click on Open or Click on Change program icon: it give me a error message ;
"Cannot display file map.xsl. Unable to determine the code.
While this mapping programm is working and has been developed manually.
may I know why its coming?
While some other xsl program is able to open.Hi Ram,
Pls do export the imported archive as a zip file to your local disk and try opening the same. If its not then the zip file which you have uploaded might have got corrupted/is not fully uploaded.
Try activating the imported archive and do a check before you do that. This you can do with a minor change in the description or so.
Then coming to the point the mapping program is working fine. It could be the old instance which is in the server cache. If you go for a server restart this error might come out as a mapping exception.
Cheers
JK -
Hi Team,
we are trying to add XSLT mapping to convert the name spaces/rootnodes of the xml file.
the following XSLT mapping code used after the graphical mapping to convert the root node and end node of the XML data generated from the graphical mapping.
But the problem is, XSLT code converting the namespaces/Root nnode and end node but removing the XML tags.
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<!--xsl:output indent= "yes" omit-xml-declaration="no"/-->
<xsl:template match="/">
<ns0:SalesOrder_MT xmlns:ns0="urn:Sales_asia">
<xsl:apply-templates/>
</ns0:SalesOrder_MT>
</xsl:template>
</xsl:stylesheet>
Ex: if the input to XSLT is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Sales_MT xmlns:ns0="urn:order_region"
<E1ORDR>
<ORDID>012345</ORDID>
<ORDDT>20140620</ORDDT>
</E1ORDR>
</ns0:Sales_MT>
the output of XSLT code is as follows:
<ns0:SalesOrder_MT xmlns:ns0="urn:Sales_asia">01234520140620</ns0:SalesOrder_MT>
So inoutput data all IDoc segments are removed and lineseparator and end separators also removed...
Can anyone help us with right XSLT code...reuirement is only root nodes should chnage and entire data should be as it is in IDOC XML format that henerated by graphical mapping
sceanrio- Idoc to File
Regards,PrasanthHi Prasanth
1. Remove the following line
<xsl:output method="xml" omit-xml-declaration="yes"/>
2. As for the namespace in E1ORDR, I don't think it matters because that field do not have a prefix (i.e. <ns0:E1ORDR>) so that namespace actually does nothing.
Please try it out.
Rgds
Eng Swee -
Hello Experts,
I have a XSLT senario where XSL map is calling a xml file for value look ups. Can someody help me implement the senarion in PI?
- RajanThanks fo ryour reply Mike,
I have an existing xslt map with the following structure -
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://interlog.dupont.com/transoval/xmlschema">
<xsl:import href="../Common/ErrorHandling.xsl"/>
<xsl:import href="DPC_ZSHPMNT5_46C_to_ShipmentRequest20_ReceiverLookup.xsl"/>
<!-- bizrules file -->
<xsl:param name="bizrules" select="document('DPC_ZSHPMNT5_bizrule_code_list.xml')/Bizrules"/>
<!-- Error Handling parameters -->
Here thsi "bizrules" parameter is actually lokking in to the 'DPC_ZSHPMNT5_bizrule_code_list.xml' file for the values to map.
Can I leverage this XSLT map in the PI or do I need to write a new map with the java extentions you are specifying here? -
Difference in using java,xslt,message mapping
hi friends,
Can i know what difference does it make in using JAVA Mapping ,XSLT and Message Mapping?
Where and when it is used?
Which one is advantageous?
thanks and regards,
PrashanthHi Prashant,
Please go through the following links:
Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/c8/b78d406b305537e10000000a1550b0/frameset.htm
For Java Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
For XSLT Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
Error handling in XSLT Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm
You can also refer some How to guides:
XI New Mapping Features article,
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi 3.0 new mapping features article.evn
Generic XSLT Mapping and Sample Code,
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi code samples/generic xslt mapping and sample code.pdf
How to use ABAP-MApping in XI3.0,
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
I hope it helps,
Thanks & Regards,
Varun Joshi -
Using XSLT for Mapping no XSLT intellisense
I'm using XSD files created with HL7 Accelerator. These schema's use some imports to external librarys. So if I open these XSD files with the xml-editor in Visual Studio I allways see an error on the import "could not find file" because the
schemalocation is not an file-location it is a reference. I understand that this the way it is used for BizTalk I know this will be resolved.
But because of that the XSLT intellisense does not work if I use one of these schema's. Is there a way around this?
(And Yes I've set the key in the register to True, I've tested in another XSLT and there it works).
Kind Regards
benny verhamme signedHave you considered using stylus studio. You can generate the xml instance of your schemas and use it , it gives you intellisense also you don't need to execute your map to test that. In case you have this software consider the following points.
<!--While testing the scripting functoid xslt, after you place the body of your template this is the code you need to include in order to see a xml output or else you will see some values with spaces.-->
<xsl:template match=”/”>
<xsl:call-template name=”YOURTEMPLATENAME”/>
< /xsl:template>
<!--While tsting the Custom XSL path this is what you need to use:-->
<xsl:template match=”/”>
<xsl:apply-templates select=”YOURTEMPLATENAME”/>
< /xsl:template> -
XSLT/JAVA Mapping for cXML DOCTYPE
Hello -
Was anyone successful in adding the header
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd">
after the
<?xml version="1.0" encoding="UTF-8"?> when converting
using either XSL or JAVA?
If there's way let me know what kind of mapping was used and how?
Thanks,
TirumalHi Tirumal,
you can solve that with xsl:output
one example:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" doctype-system="http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd"/>
<xsl:template match="/">
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
Regards,
Udo -
More abt xslt ...
i have one more doubt pondering on....
ie
creating a single xslt program template can be able to be used for various programming transformations in the future... or for each program we create we must create a xslt prog... for THE programs transformation.... is it necessary....HI
GOOD
A SINGLE XSLT PROGRAM CANT BE USE IN VARIOUS PROGRAMM TRNSFORMATION IN THE FUTURE,THE XSLT FILE WILL BE DIFFERENT ACCORDING TO YOUR REQUIREMENT.SO FOR EACH AND EVERY PROGRAM YOU MIGHT HAVE TO RIGHT DIFFERENT XSLT PROGRAM.
I HAD GIVEN YOU SOME LINK,READ THEM CAREFULLY ,I HOPE YOU CAN GET SOME MORE IDEA ABOUT THE XSLT.
THANKS
MRUTYUN
Maybe you are looking for
-
Invoice Receipt Indicator in PO allowing multiple Invoices for the same PO
Hello Experts, For one Purchase Document type, we have ensured the check mark for " invoice receipt " indicator in Invoice TAB at item description level as per client requirement . The issue is that when ever we do invoicing for the same PO , it i
-
Aged Debt Reporting ( AR ) - help required
Hi Guys, I need your help in one of the requirement I have at the moment for AR Reporting. My client wish to see the snap shot of the Debt on weekly and monthly basis since the day the system has gone live. I know how the Aged Debt Reports work in BW
-
Thanks so much for the invite to the private beta, and the how-to e-mail. We have started the testing and have successfully setup the repository server at repo.inmatecanteen.com… but no archives appear from LCCS. We have tested successfully a PUT an
-
How to compile and install glib and gtk+?
Hi, I am trying to "configure", a "make", and "sudo make install" on the package glib-2.26.0. I type ./configure which works fine but then when I type 'make' it gets to a certain point and then gives the following error message: *#error GNU libiconv
-
Hi Friends, I have created a Jumptarget as a R/3 transaction for a query. It is working fine with BEx by prompting R/3 client, where as it is not working with WAD. Indeed I can see the transaction when I click on that it displays No Page display. In