cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Message Mapping: Runtime Exception in PI

former_member211078
Participant
0 Kudos

Hi Everyone!

Im doing a File to XI Scenario. Im facing a couple of issues:

1. I have a folder from where i have to pick a file (.xml) that is throwing an error:

Runtime exception occurred during application mapping com/sap/xi/tf/_MM_DEAL_REQUEST_; com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ns0:MT_DEAL_REQUEST. Values missing in queue context. Target XSD

I have tried a lot of options including testing my payload in ESR in test mode, there too im getting the same error. Am i doing some thing wrong or is there an issue with the xml that is being placed in the folder by 3rd party?

2. When i give the actual file name as value of File Name in IR, there is just 1 file in the folder, still PI cannot pick the file name. However, If i give "*" as value for Filename, then PI can pick the file.

Can anybody help me out with both these issues??

Accepted Solutions (1)

Accepted Solutions (1)

former_member211078
Participant
0 Kudos

THIS IS THE EXACT XML THAT IM GETTING FROM 3RD PARTY:

Is there any issue with the formatting in xml ??

or could it be an issue of data type declaration in xml created in 3rd party software & DATA TYPE created by me in PI???

<?xml version="1.0"?>

-<DEAL>

<ACTION>I</ACTION>

<DEAL_NUMBER>DEALNO_00035</DEAL_NUMBER>

<DEAL_PACKAGE_CODE>AT-#-#</DEAL_PACKAGE_CODE>

<DEAL_VERSION_NO>1</DEAL_VERSION_NO>

<DEAL_GROUP_NO>GRP_00044</DEAL_GROUP_NO>

<DEAL_START_DATE>2014-03-01</DEAL_START_DATE>

<DEAL_END_DATE>2016-03-31</DEAL_END_DATE>

<DEAL_CURRENCY>RS</DEAL_CURRENCY>

<DEAL_ADVERTISER_ID>19182</DEAL_ADVERTISER_ID>

<ADVERTISER_NAME>abc solutions India pvt ltd</ADVERTISER_NAME>

<ADVERTISER_BRANCH_ID>2</ADVERTISER_BRANCH_ID>

<ADVERTISER_BRANCH_NAME>MUMBAI</ADVERTISER_BRANCH_NAME>

<ADVERTISER_PAYMENT_TYPE/>

<ADVERTISER_PAYMENT_DAYS/>

<AGENCY_INVOLVED>1</AGENCY_INVOLVED>

<DEAL_AGENCY_ID>18803</DEAL_AGENCY_ID>

<AGENCY_NAME>cccc</AGENCY_NAME>

<AGENCY_BRANCH_ID>2</AGENCY_BRANCH_ID>

<AGENCY_BRANCH>MUMBAI</AGENCY_BRANCH>

<AGENCY_PAYMENT_TYPE/>

<AGENCY_PAYMENT_DAYS/>

<AGENCY_COMMISION>0.00</AGENCY_COMMISION>

<SPEND_BASED_INCENTIVE_VALUE>40.00</SPEND_BASED_INCENTIVE_VALUE>

<DEAL_GROSS_VALUE>5614800.00</DEAL_GROSS_VALUE>

<DEAL_GROUP_GROSS_VALUE>5614800.00</DEAL_GROUP_GROSS_VALUE>

<DEAL_NET_VALUE>0.00</DEAL_NET_VALUE>

<DEAL_CATEGORY>PAID</DEAL_CATEGORY>

<SALES_REP_ID>18838</SALES_REP_ID>

<SALES_REP_NAME>abc test</SALES_REP_NAME>

<SALES_REP_MANAGER_ID>18814</SALES_REP_MANAGER_ID>

<SALES_REP_MANAGER_NAME>test 1</SALES_REP_MANAGER_NAME>

<DEAL_APPROVED_BY>abc.xyz</DEAL_APPROVED_BY>

<DEAL_ENTERED_BY>abc.xyz</DEAL_ENTERED_BY>

<DEALENTEREDON>2015-03-16T12:02:09.600</DEALENTEREDON>

<IS_UCI_AVAILABLE>0</IS_UCI_AVAILABLE>

<DEAL_REF_VALUE>5614800.00</DEAL_REF_VALUE>

-<TRANSACTIONS>

-<TRANSACTION>

<DEALTRANSACTIONID>268</DEALTRANSACTIONID>

<DEALTRANSACTIONSERIALNO>1</DEALTRANSACTIONSERIALNO>

<DEALPACKAGECODE>AT-DAT/TZ-#</DEALPACKAGECODE>

<DLT_CHL_TYPE>DC</DLT_CHL_TYPE>

<DLT_CHL_CODE>AT</DLT_CHL_CODE>

<DLT_MTY_ID>1</DLT_MTY_ID>

</TRANSACTION>

-<TRANSACTION>

<DEALTRANSACTIONID>300</DEALTRANSACTIONID>

<DEALTRANSACTIONSERIALNO>3</DEALTRANSACTIONSERIALNO>

<DEALPACKAGECODE>XXYYZZAA</DEALPACKAGECODE>

<DLT_CHL_TYPE>BC</DLT_CHL_TYPE>

<DLT_CHL_CODE>AA</DLT_CHL_CODE>

<DLT_MTY_ID>1</DLT_MTY_ID>

</TRANSACTION>

</TRANSACTIONS>

-<INCENTIVES>

-<INCENTIVE>

<DEALINCENTIVEID>129</DEALINCENTIVEID>

<DEALID>52</DEALID>

<DEALNO>1444</DEALNO>

<DLINC_INC_ID>4</DLINC_INC_ID>

<DLINC_INC_NAME>AGENCY COMMISSION</DLINC_INC_NAME>

<DLINC_INV_ID>20</DLINC_INV_ID>

<DLINC_INV_LOWER_VAL>0.00</DLINC_INV_LOWER_VAL>

<DLINC_INV_UPPER_VAL>0.00</DLINC_INV_UPPER_VAL>

<DLINC_PERCENTAGE>0.00</DLINC_PERCENTAGE>

<DLINC_DEAL_NETVALUE>5614800.00</DLINC_DEAL_NETVALUE>

</INCENTIVE>

</INCENTIVES>

</DEAL>

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vinnet,

In PI, did you create a data type, message type for this structure or did you receive the xsd file from third party(which you imported in to PI in external definition and using in message mapping).

If first one is the case, then in the payload I cannot see source message type name(MT...), due to this, in message mapping, PI is not able to matching with the message type that you have created and hence you might be getting the error.

For your confirmation, you can just take the xml from above from <Deal> to </Deal> and put it in test button by replacing the dummy <Deal> to </Deal> and keeping everything as it is, and go to tree view, if it is not showing any red marks, then the payload which you have given is matching with the structure you have defined.

Please check on this and let me know if you face any issues.

Regards

Vishnu

Former Member
0 Kudos

The codepage for an XML message is taken from the attribute “encoding” of the XML declaration. For example :

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

In your XML add <MT_DEAL_REQUEST> at the start.

and at the end </MT_DEAL_REQUEST>

They exist in your structure but not in your XML.

former_member211078
Participant
0 Kudos

I had requested the 3rd party to add an element (MT_DEAL_REQUEST) at the start of the XML. I tried with that also. But still the error persists.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

You can just take the xml from above from <Deal> to </Deal> and put it in test button by replacing the dummy <Deal> to </Deal> and keeping everything as it is, and go to tree view, if it is not showing any red marks, then the payload which you have given is matching with the structure you have defined.


From this, you can see the xml coming from 3rd party is matching with the structure you have defined.



Regards

Vishnu

former_member211078
Participant
0 Kudos

As you said i copied the xml from <DEAL> to </DEAL>. I am getting the above result.

payload has been copied but it is showing red symbol. does this mean the fields are not mapped?

former_member211078
Participant
0 Kudos

What does the standard SAP practice say?

Do we manually create the DATA Type/ Message type in PI Or we import the xsd doc as external definition??

I have tried both the techniques but to no luck i am still stuck over this mapping issue.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

If it is showing red marks, then some mismatch is happening between the structure defined and payload present in the test tab.

Can you cross check between these two, and see where is the mismatch occurring.

Regards

Vishnu

Former Member
0 Kudos

If you have the XSD i thinks it's better to used it (with External definition).

You can try to do a very simple mapping, just the field <action> for example.

Source use XSD

Target make a simple dt and mt for trying to collect the <action> value.

Please send the screenshot of mapping.

former_member211078
Participant
0 Kudos

Below is the xsd document for the same:

Is there an issue with the xsd document???

<?xml version="1.0"?>

<!-- Generated using Flame-Ware Solutions XML-2-XSD v2.0 at http://www.flame-ware.com/Products/XML-2-XSD/ -->

<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

  <xs:element name="DEAL">

    <xs:complexType>

      <xs:sequence>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        <xs:element name="TRANSACTIONS" minOccurs="0" maxOccurs="unbounded">

          <xs:complexType>

            <xs:sequence>

              <xs:element name="TRANSACTION" minOccurs="0" maxOccurs="unbounded">

                <xs:complexType>

                  <xs:sequence>

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

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

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

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

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

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

                  </xs:sequence>

                </xs:complexType>

              </xs:element>

            </xs:sequence>

          </xs:complexType>

        </xs:element>

        <xs:element name="INCENTIVES" minOccurs="0" maxOccurs="unbounded">

          <xs:complexType>

            <xs:sequence>

              <xs:element name="INCENTIVE" minOccurs="0" maxOccurs="unbounded">

                <xs:complexType>

                  <xs:sequence>

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

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

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

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

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

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

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

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

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

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

                  </xs:sequence>

                </xs:complexType>

              </xs:element>

            </xs:sequence>

          </xs:complexType>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">

    <xs:complexType>

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

        <xs:element ref="DEAL" />

      </xs:choice>

    </xs:complexType>

  </xs:element>

</xs:schema>

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

You can  use any XSD validation free tool available online.. and validate this and let us know  if there is any issue.

Regards

Vishnu

Former Member
0 Kudos

Hi Vineet,

I used your XSD and your Payload Xml to do some test, and for me no problem.

I create an external definition with your XSD, no error.

In my Service Inteface i use it for Outbound :

I have created a simple dt/mt for my inbound interface.

Look my Message Mapping :

And finaly operation mapping with test (i used your payload) :

I hope it will help you !

former_member211078
Participant
0 Kudos

Oh Youri. Thanx for your efforts. I will test it & reply in a day's time.

former_member211078
Participant
0 Kudos

Did u copy paste the xml between <xml version> tags?

Im able to do the same if i copy paste between tags. However when i import the xml, PI cant understand it & gives raw source text in unreadable format. If u want i can mail you the xml file?

Try importing it through import xml option & you can also run the complete cycle.

You can tell me your mail id?

Former Member
0 Kudos

I copied pasted all of your your xml :

Look my third screen on the left (internal ressource) : its your payload.

I just added the "encoding" in your XML tag :

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

former_member211078
Participant
0 Kudos

Thanxx Youri, the problem is solved.

Actually i was creating a data type manually by copying the fields from xml, so the message mapping was between - MT outbound request & MT inbound request.

Now, what i did was to import the xsd file as External Definition.

So now my existing mapping is between - ED outbound & MT inbound request.

Another issue i faced was with service interface - SI requires both the Request/Response (mine was synchronous scenario) with same category of message types ( MT/ED/IDOC/RFC ) for generating an ABAP proxy, so i created an External Definition for response too & gave it in my outbound SI.

However, my 2nd problem is still unsolved.

Answers (2)

Answers (2)

praveen_sutra
Active Contributor
0 Kudos

Hi Vineet,

1) regarding your first issue you need to modify your message mapping please send the screenshot of mapping of target node: MT_DEAL_REQUEST.

2) Please check if you are giving the file extension of the file name in the same case. Supposedly if its filename.TXT it should be mentioned same.

hope this helps,

thanks and regards,

Praveen T

former_member211078
Participant
0 Kudos

Mapping is fine in 1 case. I will explain to u my whole scenario.

Third-party is placing a xml file onto my folder. I have created a data type manually by copying their element names from xml. Is it an error-free way? I don't know.

The message type i created is fine when i test it manually in Operation mapping. But when in test mode i load my customer's xml file in it, then the same error comes: RUNTIME EXCEPTION.

former_member211078
Participant
0 Kudos

How do i verify if the xml file given by the customer is valid & not corrupt.? As it is only when i test in Operational mapping (by loading Customer's xml file in ESR) that i get a runtime exception.

Should I request their xsd document also? & create my data type by importing their xsd into ESR??

What is the correct way to go about it?

Former Member
0 Kudos

They are many tools on Internet for XML Validation.

If you have the XSD it's better of course.

With XSD you can easily create your data type / message type for reading customer's XML. Import the XSD under External Definitions and after you can use this XSD as your Message Type in your mapping.

After in your mapping you keep the fields you need :

[XML File (dt from XSD] ===> [Mapping] ===> [My dt with the data that i need]

In ESR - Op Mappings - Test : What's the result ?

In Internal Source you put the XML from customer.

Message was edited by: Youri Catinat

former_member211078
Participant
0 Kudos

    1. Load the xml into test instance & executing, I find this:

   2. Binding between my created message types in Operational mapping:

   3. But when i test the message type that i have created, i find this (gives no error):

Is it because of the issue with the xml??

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

For the above mentioned issue, I think the issue might be with the data, as we can see in the first screen shot you mentioned, the data is in non-english, due to which PI didn't understand or found the source field which you have mapped to the target MT_DEAL_REQUEST.

Regards

Vishnu

former_member211078
Participant
0 Kudos

This is the error im getting in SXMB_MONI:


Runtime exception occurred during application

mapping com/sap/xi/tf/_MM_DEAL_REQUEST_;

com.sap.aii.mappingtool.tf7.IllegalInstanceExcepti

on: Cannot create target element

/ns0:MT_DEAL_REQUEST. Values missing in queue

context. Target XSD ~

what does this error imply?

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

The target mandatory field is not getting created as the source field to which it is mapped might not be present.

Can you share us the mapping screen shot of this target field. Also share us the display queue of the source field along with it.

Regards

Vishnu

Former Member
0 Kudos

PI can't understand the file

Normally the xml should look like :

<MT_DEAL_REQUEST>

     <DEAL>

          <ACTION>I</ACTION>

          <DEAL_NUMBER>SDD</DEAL_NUMBER>

...

</MT_DEAL_REQUEST>

How have you read the content of the xml file ?

Maybe a problem of encoding ?

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vineet,

1. Regarding the message mapping issue, there is some issue in the mapping for the target node MT_DEAL_REQUEST. Can you check what is the source field which is mapped to it.  Can you share screen shot of this field mapping with the sample test file.

2. Can you share us the file channel configuration to pick up the file.

Regards

Vishnu

former_member211078
Participant
0 Kudos

Communication Channel Config

Former Member
0 Kudos

Hi Vineet,

For the 2nd problem, in your "Source Directory" try this :

/india/Deal/CORE_to_SAP/

You just have to put the path, not the filename in Source Directory.

Thanks,

Youri

former_member211078
Participant
0 Kudos

Already tried that but did not work.

Initially it was like

Source Directory: /india/Deal/CORE_to_SAP/

File name: Deal.xml

PI was unable to pick the file. I saw this in Message Monitoring in NWA. Also no message in SXMB_MONI. After I changed the file name to "*", PI still showed in message monitoring that it was unable to pick the file but in SXMB_MONI i got the above runtime exception. (point 1)

Former Member
0 Kudos

A simple test :

Source Directory : /india/Deal/CORE_to_SAP/

File name try : *.xml



former_member211078
Participant
0 Kudos

Did that too. Still, No file was picked by PI.

I have given all the permissions to the folder/file. So i am sure its not a permission issue, as file is picked by value "*".

Former Member
0 Kudos

Ok.

Extension File is really .XML are you sure ?

Check for case sensitivity Deal.xml DEAL.xml Deal.XML ... ?

Your file is not empty ?

former_member211078
Participant
0 Kudos

Did every possible permutation & combination but to no effect.

Former Member
0 Kudos

In Processing tab :

Processing Mode = Test

Test means : Files are not processed.

Only use this mode to test the configurations of the file/FTP adapter or the Integration Engine/PCK. It is not suitable for productive operation.

I never used this File Adapter but maybe you can try with Processing Mode Archive ...

Some informations : Configuring the Sender File Adapter - Advanced Adapter Engine - SAP Library

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vinnet,

For the 2nd problem, do like this

Source Directory: /india/Deal/CORE_to_SAP/

File name: Deal.xml


In the processing tab, for Quality of Service put Exactly once instead of best effort.



Regards

Vishnu

Former Member
0 Kudos

Best effort = Synchronous Message

If you don't need a Synchronous Interface you can indeed change the Quality of Service.

More informations here : Quality of Service - Enabling Application-to-Application Processes - SAP Library