cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping exception in XI :Cannot produce target element

Former Member
0 Kudos

Hi All,

This is for RFC-to-JDBC Scenario.

I import an RFC from SAP for Vendor Master ( BTE Event : 00001421). In that there are tables and structures.

When i create a Vendor in transaction XK01, if i dont fill any of the values in structure WYT3, it gives an exception in mapping in XI when i test it in Message Mapping ( Cannot produce target element /ns1:MT_MDM_RECEIVER/STATEMENT1/NC_SUPPLIERMASTER/ACCESS/PARTNERTYPE. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd ).

In the XML format in XI at sender side it doesn`t show the fields in the structure at all if it doesnt have any data.

Thanks & Regards,

Ruchi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ruchi,

For the RFC the field might be mandatory but it might not be a mandatory data for creating the vendor Master through standard transaction.

If you are not sending the data then the node is not getting created and going into error.

Check in RFC if this is a mandatory data?

Regards

Vijaya

Former Member
0 Kudos

Hi Vijaya,

Its not a manadatory field, but then it is mapped to a field in oracle DB, so it is possible that it doesn`t have any data.

I noticed that the node is not created when the structure doesnt have data.

So how do i eliminate this error. Is there somethin in the mappings by which i can check if the node for that field is created, pass the data else avoid it from throwin runtime exception.

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi Ruchi,

You can check the field existence using 'Exist' node function

You can have a look at 'Createif' function also.

Regards

Vijaya

Former Member
0 Kudos

Hi Vijaya,

I tried with 'exists', but it deosn`t work.

It still gives the same exception.

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi Ruchi,

YOu will have to see

senderfield> exists>IfelseCondition-->receivermessage

If exists

then (the vairable that you want to send

else (constant)

Regards

Vijaya

Former Member
0 Kudos

Vijaya,

I tried the same thing , but it doesn`t work.

I get the same exception.In Display Queue it doesn`t show any value for exists, neither true nor false.

The senderfield node is not there at Runtime bcoz it doesn`t have any data.

'exists' does check for the existence of the node, but its not workin here....dont know why !!!

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi Ruchi,

Try MapWithDefault function in your mapping. This will create the node even if the sender field is not there.

Cheers

JK

Former Member
0 Kudos

Hi JK,

Where do I find MapwithDefault Function?

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi All,

I check for a node exists in NODE Funtions, if the node is there it returns 'true', but if its not there, it doesnt return anyhting.

Sourcefield->exists->ifthenesle-?targetfield

Here i use if-then-else, so ideally it should execute the else part, but it doesnt do that.

It gives an error 'Cannot produce targetfield'.

Can anybody pl. help me on this.

Thanks & Regards,

Ruchi

former_member187339
Active Contributor
0 Kudos

Hi,

Check the display queue of <b>exists</b>...

Chage the context to the parent elemnet of the source field.

Regards

Suraj

Former Member
0 Kudos

Thanx a lot Suraj !!

It works by changing the context to parent element.

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi,

you can also use removeContext function in between which does the same job as setting the context to parent in this case.

Regards,

Sudheer.

former_member187339
Active Contributor
0 Kudos

Hi,

Congrats... I think now you can close this thread

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

Can you plz tell me how to close this thread.

Thanks & Regards,

Ruchi

bhavesh_kantilal
Active Contributor
0 Kudos

Ruchi,

When you award 10 points / Solved problem to a thread, it implies that the solution to your problem has ben arrived at and this logically implie closing the thread.

Regards,

Bhavesh

Answers (1)

Answers (1)

former_member187339
Active Contributor
0 Kudos

Hi,

You have specified PARTNERTYPE in target as a mandatory field (ie its having an occurence of 1)...

Now if this field is not mapped then it will give error, so you have to map. IF your source doesn't have any value to map to it then give a constant. For that you have to use IF-THEN-Else but with suitable context handling.

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

Actually the problem is tht sourcefield is in a structure. Now if i dont pass any data in any of the fields in this structure it doesnt create any field nodes at all , i.e in my sender xml file i dont have the sourcefield.

So it doesnt find the source field to be mapped to the target fieldand it gives Runtime Exception 'Cannot produce target'.

Also i tried working with exists and all, but its not working.

I have not worked with Context Handling. So, pl. can you help me more on this.

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi Ruchi,

What you need to do is that in the message mapping, you map your source field to your target field and in between from the standard functions available select node functions -> mapWithDefault. Now for the field which is not getting generated, once you make use of this function it will be looking like,

source field->mapWithDefault->target field.

what this does is that even if the source field xml tag is not there, then it will generate the xml tag in the target side and if any value is present then will pass that to the source structure.

Cheers

JK

PS: Award points if this helps you

former_member187339
Active Contributor
0 Kudos

Hi,

Ok can you give me part of the target XML structure which is causing the problem (along with the occurences). Also give that part of the source structure which is being used for mapping with this target field (along with occurences).

Regards

Suraj

Former Member
0 Kudos

Hi JK,

I cannot see mapwithDefault in node Funtions.

Thanks & Regards,

Ruchi

Former Member
0 Kudos

Hi Suraj,

The sender xml is a structure(FWYT3) which might have data and might not , -

- <xsd:complexType name="FWYT3">

- <xsd:sequence>

- <xsd:element name="PARVW" minOccurs="0">

- <xsd:simpleType>

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="2" />

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

If this structure doesnt have data it`ll only show like this in sender xml,ni.e it doesnt show the fields in this structure (T_YWYT3).So this field parvw is mapped to partnertype in target.But when parvw doesnt have any data this field is not at all displayed in this structure WYT3.

- </T_YWYT3>

The target xml structure is whose occurence is '1'-

- <xsd:element name="PARTNERTYPE" default="Supplier">

- <xsd:annotation>

<xsd:appinfo source="http://sap.com/xi/TextID">d27dbd80e40b11da8293ece80a9821f4</xsd:appinfo>

</xsd:annotation>

- <xsd:simpleType>

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="40" />

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

Thanks & Regards,

Ruchi

former_member187339
Active Contributor
0 Kudos

Hi,

I hope PARTNERTYPE doesn't have any parent node and if it have then that nodes occurence is not minOccurs as 0.

Because if it has a parent node with minOccurs as 0 then you can allow that node to be created only when PARVW in the source exists.

Now if PARTNERTYPE is not haveing a parent node then:

1) Use IF then ELSE : You have to take care of the contexts. Right click on each node and see th edisplay queue for more help with contexts.

2) MapWithDefault : If you didn't have any value for the source node then this Default value is assigned to the target field.

Regards

Suraj