cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Multi Level Hierarchy To Flat

Former Member
0 Kudos

HI

I have the following Message Structures

<HRMD_A05>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<TABNAM>EDI_DC40</TABNAM>

<MANDT>100</MANDT>

<DOCNUM>0000000000462483</DOCNUM>

<DOCREL>700</DOCREL>

<STATUS>30</STATUS>

<DIRECT>1</DIRECT>

<OUTMOD>2</OUTMOD>

<IDOCTYP>HRMD_A05</IDOCTYP>

<MESTYP>HRMD_A</MESTYP>

<SNDPOR>SAPPH1</SNDPOR>

<SNDPRT>LS</SNDPRT>

<SNDPRN>PH1100</SNDPRN>

<RCVPOR>A000000015</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPRN>GD_XIB_P</RCVPRN>

<CREDAT>20110130</CREDAT>

<CRETIM>200709</CRETIM>

<SERIAL>20110130200628</SERIAL>

</EDI_DC40>

<E1PLOGI SEGMENT="1">

<PLVAR>01</PLVAR>

<OTYPE>P</OTYPE>

<OBJID>00000021</OBJID>

<OPERA>I</OPERA>

<E1PITYP SEGMENT="1">

<PLVAR>01</PLVAR>

<OTYPE>P</OTYPE>

<OBJID>00000021</OBJID>

<INFTY>0001</INFTY>

<BEGDA>20110130</BEGDA>

<ENDDA>20110130</ENDDA>

<E1P0001 SEGMENT="1">

<PERNR>00000021</PERNR>

<INFTY>0001</INFTY>

<ENDDA>99991231</ENDDA>

<BEGDA>20110101</BEGDA>

<SEQNR>000</SEQNR>

<AEDTM>20110110</AEDTM>

<UNAME>CHEHROUTSDT</UNAME>

<BUKRS>0116</BUKRS>

<WERKS>UK01</WERKS>

<PERSG>1</PERSG>

<PERSK>M2</PERSK>

<KOSTL>0000005000</KOSTL>

<ORGEH>51004895</ORGEH>

<PLANS>60006175</PLANS>

<STELL>70000004</STELL>

<SNAME>Financial Control</SNAME>

<ENAME>Financial Controller &amp; Bus Tra Officer</ENAME>

</E1P0001>

<E1P0001 SEGMENT="1">

<PERNR>00000021</PERNR>

<INFTY>0001</INFTY>

<SUBTY>GDP1</SUBTY>

<ENDDA>99991231</ENDDA>

<BEGDA>20110101</BEGDA>

<SEQNR>000</SEQNR>

<AEDTM>20110110</AEDTM>

<UNAME>CHEHROUTSDT</UNAME>

<WERKS>GB</WERKS>

<PERSG>X</PERSG>

<ORGEH>00000000</ORGEH>

<PLANS>00000000</PLANS>

<STELL>00000000</STELL>

<MSTBR>00035657</MSTBR>

<SNAME>TETRA PAK LTD.</SNAME>

<ENAME>TP Tetra Pak Ltd.</ENAME>

<FISTL>Wrexham</FISTL>

<GEBER>GB0001</GEBER>

</E1P0001>

<E1P0001 SEGMENT="1">

<PERNR>00000021</PERNR>

<INFTY>0001</INFTY>

<SUBTY>GDP2</SUBTY>

<ENDDA>99991231</ENDDA>

<BEGDA>20110101</BEGDA>

<SEQNR>000</SEQNR>

<AEDTM>20110110</AEDTM>

<UNAME>CHEHROUTSDT</UNAME>

<ORGEH>00000000</ORGEH>

<PLANS>00000000</PLANS>

<STELL>00000000</STELL>

<SNAME>FI Accounting Leader</SNAME>

<ENAME>Finance &amp; Business Transformation</ENAME>

</E1P0001>

</E1PITYP>

</E1PLOGI>

</IDOC>

</HRMD_A05>

in the above structure <HRMD_A05>/<IDOC>/<E1PLOGI><E1PITYP> has a segment <E1P0001> which gets repeated 3 with different Qualifers("",GD1,GD2) base on the Qualifer the <Smane> has to be mapped to 3 different fields in the target Structure

The Target Structure is a Flat Structure As shown Below

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="urn:xibprototype:source:to:target" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:xibprototype:source:to:target">

<xsd:element name="HRPlanningAndMasterData" type="HRPlanningAndMasterData"/>

<xsd:complexType name="HRPlanningAndMasterData">

<xsd:annotation>

<xsd:appinfo source="http://sap.com/xi/VersionID">154335859c8011e0ac8a0000022ca112</xsd:appinfo>

</xsd:annotation>

<xsd:sequence>

<xsd:element name="LineItems" minOccurs="0" maxOccurs="unbounded">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="tpjobtype" type="xsd:string" minOccurs="0"/>

<xsd:element name="tpposition" type="xsd:string" minOccurs="0"/>

<xsd:element name="tpfunctionalarea" type="xsd:string" minOccurs="0"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

I did the graphical Mapping the As Below

ns0:HRPlanningAndMasterData/LineItems/tpjobtype=mapWithDefault(SplitByValue(removeContexts(ifWithoutElse(stringEquals(/HRMD_A05/IDOC/E1PLOGI/E1PITYP/E1P0001/SUBTY, const(value=GDP2)), /HRMD_A05/IDOC/E1PLOGI/E1PITYP/E1P0001/SNAME, keepss=true)), type=0), default_value=, result)

If i load the Instance XMl file and See the Context Queues .. the Number of the Context Changes in the Queue in more than the Context Changes that are to be produced

eg.. I feed 2 records as input then i see 6 context Changes

eg..

SUPPRESS

SUPPRESS

<ActualValue>

SUPPRESS

SUPPRESS

<ACTUAL VALUE>

I am expecting only 2 context changes with the actual Values... (if the second record does not have a value an empty value is expected)

Can Some help me in solving these Values... Some How i need to remove the SUPPRESS/false Values

Note: The Contects for the Source Elements are not changed

Regards

Edited by: aalla renukumar on Jun 27, 2011 12:18 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Aalla,

Change the context of SUBTY to E1PITYP and donot use splitByValue and removeContext

Former Member
0 Kudos

Hi aalla

Try setting property keepss of ifWithoutElse block to false.

Regards,

Giuseppe