cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering of records in Message Mapping

Former Member
0 Kudos

I am facing problem during filtering record in message mapping. My message comes from R3 and should be sent to one business service in entirety and should also be sent to another business service in part. To resolve this I created a message map for selecting record based on some conditions but this creates empty XML nodes wherever condition is not satisfied. Everything works fine but the scenario fails at the end while trying to convert XML to text using file adapter. The error is ‘Conversion configuration error: Unknown structure '' found in document', probably configuration error in file adapter (XML parser error)’

Accepted Solutions (1)

Accepted Solutions (1)

STALANKI
Active Contributor
0 Kudos

Follow Sam's approach..

Have two mapping programs .

1.Sender->1st recievr..mapping 1 generates the complete XML.

2.Sender->2nd reciever mapping 2 generates the XML that is required to send it as a part.

But donot create empty nodes.

Raju's approach is right and after some work you should be able to get your configuration and mapping set right.

Former Member
0 Kudos

Hi Rajesh,

Please change u r conversion parameters and record structure as below.

<b>Conversion Parameters:</b>

DETAIL_RECORD.fieldFixedLengths 4,10,40,40,40,40,3,10,60,18,15,4,4,1,40,16,11,12,12

DETAIL_RECORD.addHeaderLine 0

DETAIL_RECORD.endSeparator 'nl'

root.fieldSeparator 'nl'

root.endSeparator 'nl'

VendorMasterExtract_Type.endSeparator 'nl'

VendorMasterExtract_Type.fieldSeparator 'nl'

DETAIL_RECORD.fixedLengthTooShortHandling Cut

<b>Record Set Strcture:</b>

root,VendorMasterExtract_Type,DETAIL_RECORD

As u can see u r conversion parameter says <b>VendorMasterExtract_Type1</b> where as u r output xml has <b>VendorMasterExtract_Type</b> also u have to include all the subsequent paranet nodes of VendorMasterExtract_Type in my case <b>root</b> is the parent node for VendorMasterExtract_Type.

Regards,.

KNS Kumar.

Former Member
0 Kudos

Thanks KNS for your response again. I tried as suggested by you and I am receiving this error now.

<b>Delivery of the message to the application using connection AFW failed, due to: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters! (Value 'US10')', probably configuration error in file adapter (XML parser error)'.</b>

<b>Record Set Strcture:</b>ns0:VendorMasterExtract_MT1,VendorMasterExtract_Type,DETAIL_RECORD

<b>Conversion Parameters:</b>

DETAIL_RECORD.addHeaderLine 0

DETAIL_RECORD.fieldFixedLengths 4,10,40,40,40,40,3,10,60,18,15,4,4,1,40,16,11,12,12

VendorMasterExtract_Type.endSeparator 'nl'

DETAIL_RECORD.fixedLengthTooShortHandling Cut

DETAIL_RECORD.endSeparator 'nl'

ns0:VendorMasterExtract_MT1.fieldSeparator 'nl'

ns0:VendorMasterExtract_MT1.endSeparator 'nl'

VendorMasterExtract_Type.fieldSeparator 'nl'

Thanks

Rajesh

Former Member
0 Kudos

Thanks Sravya for response.

I am following this approach only. The problem is occurring during content conversion of 2nd interface. My mapping is correct but it creats empty node as shown below. The highlighted empty node should not have been there. Any tips how to avoid it?

<b><VendorMasterExtract_Type /></b> - <VendorMasterExtract_Type>

- <DETAIL_RECORD>

<COMPCODE>US10</COMPCODE>

<VENDORID>600016</VENDORID>

<VNDRNAME>1099 Test Vendor#2</VNDRNAME>

<VNDRADRS1>2 Street</VNDRADRS1>

<VNDRADRS2 />

<VNDRCITY>rwc</VNDRCITY>

<VNDRSTATE>CA</VNDRSTATE>

<VNDRZIP>11111</VNDRZIP>

<BANKNAME />

<BNKACUNT />

<BANKKEY />

<BANKTYPE />

<ACCNTGRP>Z006</ACCNTGRP>

<ZPURIND />

<VNDRNAME2>Constant</VNDRNAME2>

<TAXNMB1>Constant</TAXNMB1>

<TAXNMB2>Constant</TAXNMB2>

<TELPHONE1>Constant</TELPHONE1>

<FAX>Constant</FAX>

</DETAIL_RECORD>

</VendorMasterExtract_Type>

moorthy
Active Contributor
0 Kudos

Hi Rajesh,

Did u try like this in content conversion?

VendorMasterExtract_Type.fixedLengthTooShortHandling Cut

Also for more-

http://help.sap.com/saphelp_nw2004s/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm

Otherwise try to avoid in Mapping itself.

Hope this helps..

Regards,

Moorthy

Former Member
0 Kudos

Hi Rajesh,

Please paste the mapping rule for the Node <b>VendorMasterExtract_Type</b>, that can help us in analyzing the problem in a better manner.

In the mean while you can try the following xslt mapping program which will applies after the existing mapping program in existing interface mapping. This xslt will suppress the empty <b>VendorMasterExtract_Type</b> nodes.

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="namespace">

<xsl:output method="xml" indent="yes"/>

<xsl:template match="ns0:VendorMasterExtract_MT1">

<ns0:VendorMasterExtract_MT1 xmlns:ns0="namespace">

<xsl:apply-templates/>

</ns0:VendorMasterExtract_MT1>

</xsl:template>

<xsl:template match="VendorMasterExtract_Type">

<xsl:variable name="childCount">

<xsl:value-of select="count(descendant::*)"/>

</xsl:variable>

<xsl:if test="$childCount &gt; 0">

<xsl:copy-of select="."/>

</xsl:if>

</xsl:template>

</xsl:stylesheet></b>

please change the name space as per urs..

Regards,

KNS Kumar.

Former Member
0 Kudos

Thanks KNS for your response. I appreciate your interest in resolving the issue. I will certainly try what you are suggesting. I am fairly new to the field of XI and therefore will have to explore where and how to specify XSLT program.

Here is the initial portion of mapping rules.

/ns0:VendorMasterExtract_MT1=/ns0:VendorMasterExtract_MT=

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type=/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type=

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD=createIf(stringEquals(/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type/DETAIL_RECORD/ACCNTGRP=, const()))

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/COMPCODE=/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type/DETAIL_RECORD/COMPCODE=

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/VENDORID=/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type/DETAIL_RECORD/VENDORID=

Thanks and regards

Rajesh

Former Member
0 Kudos

Hi Rajesh,

By changing the above mapping rules as below could help... Please check.

/ns0:VendorMasterExtract_MT1=/ns0:VendorMasterExtract_MT=

<b>/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type=createIf(stringEquals(/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/ACCNTGRP=, const()))

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD=SplitByValue(createIf(stringEquals(/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/ACCNTGRP=, const())))</b>

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/COMPCODE=/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type/DETAIL_RECORD/COMPCODE=

/ns0:VendorMasterExtract_MT1/VendorMasterExtract_Type/DETAIL_RECORD/VENDORID=/ns0:VendorMasterExtract_MT/VendorMasterExtract_Type/DETAIL_RECORD/VENDORID=

<b>Note:</b> The Context for ACCNTGRP for the mappings of VendorMasterExtract_Type and DETAIL_RECORD is set to VendorMasterExtract_MT1

Rest of the elements like COMPCODE and VENDORID have the context as DETAIL_RECORD

If this works there is no need for xslt mapping...

Regards,

KNS Kumar.

Former Member
0 Kudos

Thanks KNS Kumar

This XSL mapping program worked and interface worked correctly. I was not able to get into SDN for past 4-5 days and hence could not respond.

But still i believe that we do not have to use XSL map and we should be able to do this with simple mapping. I will continue looking for solution.

Thanks a lot for your help.

Answers (4)

Answers (4)

Former Member
0 Kudos

If you want to filter out records (unbounded) from the results then you can use "createif" node function.

This is explained - SAP Help Link: [Example Message Mappings|http://help.sap.com/saphelp_nw70/helpdata/en/84/e8763c997fda50e10000000a11405a/frameset.htm]

note the variable that we want to use to conditionally control is referred / moved to higher context as explained in above example.

We wanted to map only the records where tag DebitCredit was DR

Source Message :

<Transactions>

<RecType>2</RecType>

<CardNumber>12333444344</CardNumber>

<EmployeeName>Debit 1</EmployeeName>

<TransactionDate>20080201</TransactionDate>

<DebitCredit>DR</DebitCredit>

<Amount>12345</Amount>

</Transactions>

<Transactions>

<RecType>2</RecType>

<CardNumber>12333444345</CardNumber>

<EmployeeName>Credit 2</EmployeeName>

<TransactionDate>20080201</TransactionDate>

<DebitCredit>CR</DebitCredit>

<Amount>12345</Amount>

</Transactions>

STALANKI
Active Contributor
0 Kudos

Check this links for mastering message mapping

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13

Former Member
0 Kudos

Hi,

This could be because of the content conversion at the receiver communication chanel. Please copy the output xml payload(from sxmb_moni) and the content conversion rules you have defined in the receiver chanel. So that it gives us a better picture of the problem.

Regards,

KNS Kumar.

Former Member
0 Kudos

Thanks KNS for your response. Here are the additional details:

<b>Part of XML (Output) message -</b>

<VendorMasterExtract_Type />

- <VendorMasterExtract_Type>

- <DETAIL_RECORD>

<COMPCODE>US10</COMPCODE>

<VENDORID>600055</VENDORID>

<VNDRNAME>Elmer Jacela</VNDRNAME>

<VNDRADRS1>12345 East Eastern Ave</VNDRADRS1>

<VNDRADRS2 />

<VNDRCITY>The City</VNDRCITY>

<VNDRSTATE>CA</VNDRSTATE>

<VNDRZIP>92756</VNDRZIP>

<BANKNAME />

<BNKACUNT />

<BANKKEY />

<BANKTYPE />

<ACCNTGRP>Z006</ACCNTGRP>

<ZPURIND />

<VNDRNAME2>Constant</VNDRNAME2>

<TAXNMB1>Constant</TAXNMB1>

<TAXNMB2>Constant</TAXNMB2>

<TELPHONE1>Constant</TELPHONE1>

<FAX>Constant</FAX>

</DETAIL_RECORD>

</VendorMasterExtract_Type>

<VendorMasterExtract_Type />

<b>Content Conversion Parameters –</b>

Record set Structure - VendorMasterExtract_Type1,DETAIL_RECORD

DETAIL_RECORD.addHeaderLine - 0

DETAIL_RECORD.fieldFixedLengths -4,10,40,40,40,40,3,10,60,18,15,4,4,1,40,16,11,12,12

VendorMasterExtract_Type1.fieldSeparator- 'nl'

DETAIL_RECORD.fixedLengthTooShortHandling- Cut

DETAIL_RECORD.endSeparator - 'nl'

Looking forward to hear from you.

claus_wallacher
Active Participant
0 Kudos

Hi Rajesh,

you should be able to set up your mapping in such a way that you don't have any empty nodes.

It is a little hard to describe without any details, but as a general rule you should do the following:

If you have a field that should only be filled under a certain condition, test the condition on the node level as well and finish with the createIf statement. Then the complete node is only created if your condition is true and you can simply fill the subordinate field without checking the condition again.

Hope this helps,

Claus

sam_raju
Contributor
0 Kudos

Hi Rajesh,

I am not sure if you tried forwarding messages to multiple receivers using the "configured receivers" of Receiver Determination?

This way you can define two interface determinations with one interface mapping for one receiver and the other interface mapping (with conditions) for the other receiver.

Rgds,

Sam Raju

Former Member
0 Kudos

Hi Rajesh,

This scenario you are trying can be done using CONDITIONAL RECEIVER DETERMINATION and RB SPLIT, where you can basically have one sender and two receivers.

To do this without using a BPM.

1. Create your mapping program that will map the information from the source file

into the destination idoc. This has to be a 1:N split. Just make sure that the destination message type and message interface are are of occurrence N.

2. Also, you will have 2 destination interfaces and 2 interface mapping, one for the IDOC and one for the mail.

Now, there are a few essential steps in your configuration,

1. In the receiver determination, specify the 2 receiver systems, one for your IDOC and the other for your MAIL.

2. Now, you will have a condition window. Just type the condition on the basis of which the receiver has to be determined for the mail and the idoc business system. Just remember that the condition can be specified only for the source message.

3. In the Interface Determination, you have an option called RB CLASSIC and RB SPLIT. To do a 1:N split, you will have to do a RB_SPLIT.

And since you wanted to covert the XML format to text format you require content conversion at the receiver adapter end, for that please go through these links below. It clearly explains your requirement.

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm

I hope I have answered your query.

Regards,

Abhy

note: do reward points for the helpful answers.

Former Member
0 Kudos

Hi Claus

Thanks for your response. I am doing as stated by you but that CrateIf statements creates empty node like:

<VendorMasterExtract_Type/>

When receiver communication channel encounters this empty node, it does not know how to convert it. see part of my XML output and content conversion parameters in my response to some query in this thread.

Thanks

Rajesh

Former Member
0 Kudos

Thanks Sam Raju for your response.

I am doing exactly the way you described. But this approach seem to work at whole message level and not at individual transactions within messages.

Thanks and regards

Rajesh

moorthy
Active Contributor
0 Kudos

Hi Rajesh,

Just try like this in Mapping- If node exists then map the node to target node else just map with empty to the target node.

So in your mapping it looks like this.

If -> node -> exists->then Map with the target sturcture

else ->empty node(i.e constant with nothing) is mapped with the target sturcutre.

If this is done , i think it will not generate empty nodes in the target structure.

Regards,

Moorthy

Former Member
0 Kudos

Thanks Abby for your response.

I am not sure where should i specify my message map. And the problem seem to be occuring at the last point i.e. at conversion when it find empty XML tags. File adapter doesn't seem to handle empty XML tags well.