on 06-10-2015 9:23 AM
Hi Experts,
I have a scenario where the XML which SAP PI is receiving from source side is like as shown below.
<HEADER>
<indicator>name,address,workCity,Party</indicator>
<abc>....
<def>....
</HEADER>
<Body>
<name>John</name>
<surname>Adams</surname>
<address>
<apartment>123</apartment>
<street>Kennedy Rd>/street>
</address>
<workCountry>USA</workCountry>
<workCity>FL<workCity>
<PartyGroup>Boston PG</PartyGroup>
<Party>Universal</Party>
<Body>
In header it contains a tag "indicator" which includes the names of fields in a record which have changed, separated by comma.
In body we have all possible fields for a record.
The requirement is for SAP PI to read this "indicator field" in header and pick only those fields from "body" which are listed in <indicator> tag.
I have two questions:
i) Is it possible to send comma separated fields like this in an XML? Or do they need to be double quoted?
e.g. instead of <indicator>name,address,workCity,Party</indicator> should it be:
<indicator>"name,address,workCity,Party"</indicator>
In any case..
ii) how to implement this requirement of segregating multiple comma separated values within same tag and picking ony selective fields as mentioned earlier?
Please help, this is urgent.
Warm Regards
Saurabh
Hi Saurabh,
In my opinion it can be handled using Java mapping.
i) Is it possible to send comma separated fields like this in an XML? Or do they need to be double quoted?
e.g. instead of <indicator>name,address,workCity,Party</indicator> should it be:
<indicator>"name,address,workCity,Party"</indicator>
Answer: In java mapping you can use split function for splitting the values of indicator field.
In any case..
ii) how to implement this requirement of segregating multiple comma separated values within same tag and picking ony selective fields as mentioned earlier?
Answer: I can think of two ways to resolve this issue.
one way is you can use java mapping and in side java code you can handle the selective values using tags getting from the indicator field.
second approach could be you can break the mapping in two parts.
a) keep source and target structure same and just populate the target fields using indicator values with some dummy value.
eg: suppose if indicator contains name, address, work city then populate these three fields with the values comming from source and rest all fields with dummy values something like XXXX.
b) and then in second mapping just check if the value in the field is "XXXX" dont create the target element.
Please let me know if you have more query's.
thanks and regards,
Praveen T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurabh,
Question:1
how to implement this requirement of segregating multiple comma separated values within same tag and picking ony selective fields as mentioned earlier?
Answer:
In my opinion it can be handled using XSLT mapping. For segregating multiple comma separated values within same tag XSLT mapping will help you to separate the data as you want.
EXample: <xsl:for-each select="POExtract/row[not(PONumber = preceding-sibling::row/PONumber)]">
Question: 2
Is it possible to send comma separated fields like this in an XML? Or do they need to be double quoted?
e.g. instead of <indicator>name,address,workCity,Party</indicator> should it be:
<indicator>"name,address,workCity,Party"</indicator>
Answer:
By using XSLT mapping we can change the structure as you want wasily when compared to Java Mapping. You can try this one once.
If you want any help let us know.
Regards,
Srikanth Mavuri.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.