cancel
Showing results for 
Search instead for 
Did you mean: 

Structure Mapping: suppress multi occurence based on field content

Former Member
0 Kudos

Hello,

i have a tricky problem. The input-message/structure is like that:

<b>Number</b> Field1 Name Value

4711 aaa Name1 Value1

4711 aaa Name2 Value2

4711 aaa Name3 Value3

4712 bbb Name1 Value1

4712 bbb Name2 Value2

The destination Message must just have 1 record per <b>Number</b>.

But all the Name/Value pairs belonging to a unique <b>Number</b> must appear

i an sub-structure of the single destination Message:

4711 aaa

Name1 Value1

Name2 Value2

Name3 Value3

4712 bbb

Name1 Value1

Name2 Value2

does anybody know what the basic approach is to solve this problem? If at all, do i need a globalContainer to remember the <b>Number</b>?

Gunnar.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

Source structure -

source 1.. n

Name

Field1

Name

Value

Target Structure -

Target 1..n

Header 1..1

Number

Field1

Data 1..n

Name

Value

You need to write a UDF in which the Header details are copied to a global variable and loop till match exists and get all data fileds and put in one structure and then add a context to it .

Nanda

Former Member
0 Kudos

Hi,

Please use the graphical mapping fuction Formatbyexample or write a UDF to group the records based on one item.

see the below link .. take the mapping pattern - table/lookup.

http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf

Regards

Chilla..

<i>Points rewarded if it is helpful..</i>

Former Member
0 Kudos

I guess you need JAVA mapping to handle this. Still, can you give the XML structure of source and target. Will give it a try and let you know...

Regards,

JaiShankar

Former Member
0 Kudos

Hello,

here you can find the xsd source and destination. You can ignore those fields which are not related to the problem. The point ist, that the same source 'Material' may come several times with the same 'MatNum'. In the destination we must have one 'Material' per 'MatNum' with all collected Name/Value pairs ('Merkmal').

Sourch schema:

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="LichtServiceMaterialMM">

<xs:annotation>

<xs:documentation>Liste von SAP Materialien aus dem Bereich EVN Lichtservice</xs:documentation>

<!--

Author: Ralf Banning

Datum: 07.02.2007

Version: 1

Copyright by EVN AG 2007

-->

</xs:annotation>

<xs:complexType>

<xs:sequence maxOccurs="unbounded">

<xs:element name="Material">

<xs:complexType>

<xs:sequence>

<xs:element name="WaGrpe">

<xs:annotation>

<xs:documentation>Warengruppe in SAP (PM|PL|PZ)</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="PM"/>

<xs:enumeration value="PL"/>

<xs:enumeration value="PZ"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="MatNum" type="xs:string">

<xs:annotation>

<xs:documentation>Materialnummer in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="MgEinh" type="xs:string">

<xs:annotation>

<xs:documentation>Mengeneinheit in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="MatKTXT" type="xs:string">

<xs:annotation>

<xs:documentation>Materialkurztext in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="SPreis" type="xs:string">

<xs:annotation>

<xs:documentation>Standardpreis des Materials in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:sequence maxOccurs="unbounded">

<xs:element name="Merkmal">

<xs:annotation>

<xs:documentation>Klassenmerkmale in SAP</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence maxOccurs="unbounded">

<xs:element name="Name" type="xs:string">

<xs:annotation>

<xs:documentation>Feldname des Merkmals</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="Wert" type="xs:string">

<xs:annotation>

<xs:documentation>Feldwert des Merkmals</xs:documentation>

</xs:annotation>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

<xs:element name="ErrorNumber" type="xs:string" default="000" minOccurs="0"/>

<xs:element name="ErrorText" type="xs:string" minOccurs="0"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

Destination schema:

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="LichtServiceMaterialResponse">

<xs:annotation>

<xs:documentation>Liste von SAP Materialien aus dem Bereich EVN Lichtservice</xs:documentation>

<!--

Author: Ralf Banning

Datum: 07.02.2007

Version: 1

Copyright by EVN AG 2007

-->

</xs:annotation>

<xs:complexType>

<xs:sequence maxOccurs="unbounded">

<xs:element name="Material">

<xs:complexType>

<xs:sequence>

<xs:element name="MTLuxData">

<xs:annotation>

<xs:documentation>Materialtyp in LuxData</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Masten"/>

<xs:enumeration value="Ausleger"/>

<xs:enumeration value="Leuchten"/>

<xs:enumeration value="Schaltschränke"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="WaGrpe">

<xs:annotation>

<xs:documentation>Warengruppe in SAP (PM|PL|PZ)</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="PM"/>

<xs:enumeration value="PL"/>

<xs:enumeration value="PZ"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="MatNum" type="xs:string">

<xs:annotation>

<xs:documentation>Materialnummer in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="MgEinh" type="xs:string">

<xs:annotation>

<xs:documentation>Mengeneinheit in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="MatKTX" type="xs:string">

<xs:annotation>

<xs:documentation>Materialkurztext in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="SPreis" type="xs:string">

<xs:annotation>

<xs:documentation>Standardpreis des Materials in SAP</xs:documentation>

</xs:annotation>

</xs:element>

<xs:sequence minOccurs="0" maxOccurs="unbounded">

<xs:element name="Merkmal">

<xs:annotation>

<xs:documentation>Klassenmerkmale in SAP</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="Name" type="xs:string">

<xs:annotation>

<xs:documentation>Feldname des Merkmals</xs:documentation>

</xs:annotation>

</xs:element>

<xs:element name="Wert" type="xs:string">

<xs:annotation>

<xs:documentation>Feldwert des Merkmals</xs:documentation>

</xs:annotation>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

<xs:element name="ErrorNumber" type="xs:string" default="000" minOccurs="0"/>

<xs:element name="ErrorText" type="xs:string" minOccurs="0"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>