cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue in the target structure when same structure is repeated in source files

Former Member
0 Kudos

Dear All,

I am working in File -> SAP PI 7.3 -> ECC (Abap Proxy). XML file is kept in FTP folder and these files are picked up by File adapter. During the initial stages of mapping test, I found Cannot create target element , Values missing in queue context. Target XSD req but was solved once I used node function MapWithDefault.

Now the issue arises with the source XML files when the structure with multiple occurrence, the target structure repeats only once. I mean to say if the same structure repeats 4 times in source, the target structure shows only once with out any data. The source XML files, the Mapping definition and the mapping results are shown below.

Note : While uploading the XML files itself in the mapping test, it shows red status in the source structure. I can not change the source structure of the XML files

Regards

Accepted Solutions (1)

Accepted Solutions (1)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

When you try to do a test mapping and the root message appears in red you have two posibilities: The structure provided are differents

OR

check whether the xml provided by the client has a namespace in the root node. if it doesnt have it, go to Message Type ande delete the namespace below to the DT name, active the changes  and try again

Regards

Former Member
0 Kudos

Hi Rodrego,

Your suggestion to remove the namespace worked along with the suggestion provided by Amit..

Hats off to both of you..

The issue is solved ..

Regards

Answers (3)

Answers (3)

subhro_de
Active Participant
0 Kudos

Hi Rebecca ,

Your source message type does not seem to conform to the test data you are using . Referring to your screenshots

The top node of your test message seem to be MTPGRob but the message type is MT_AglPGR_OB

At the field level the second field is AbyShip_Ntfctn in the test data but AglShip_Ntfctn in the mapping structure - and all the fields seem to marked as mandatory - which means all the fields need value. If this is not the case in the data type you can change the non mandatory fields to 0..1 rather than 1..1.

Regards

Subhro

Former Member
0 Kudos

Hello,

>>Note : While uploading the XML files itself in the mapping test, it shows red status in the source structure. I can not change the source structure of the XML files

There is a discrepancy between the source structure created in SAP PI and the xml file which u have pasted in PI (the MT type name is different, so u have to correct the same in PI)

>>I mean to say if the same structure repeats 4 times in source, the target structure shows only once with out any data

It seems that target structure is getting created with empty data because u have used MWD...

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

I hope you have answered which I feel would end up in the solution. Points awarded.

I have updated Anupam answers along with the source and target message type in details as well as the XML payload.

Please abbreviate MWD in

<<It seems that target structure is getting created with empty data because u have used MWD...>>

Regards

Muniyappan
Active Contributor
0 Kudos

Hi,

what is the constant value you are passing in the mapwithdefault funciton?

if you don't give any values it will pass blank. that is why you are getting blank.

Please abbreviate MWD in

<<It seems that target structure is getting created with empty data because u have used MWD...>>

i think it should be function name MapWithDefault.

Regards,

Muniyappan.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rebecca,

                      First problem is to resolve the red status when you put the test payload.

in the source XSD all the elements are mandatory. There may be missing mandatory elements or spelling mistake etc which is causing the red symbol to appear. Could you please upload the actual xml payload and the complete screen shot (message type) if possible of the source and target XSD.

Regards

Anupam 

Former Member
0 Kudos

Hi Anupam,

Kindly refer to the screenshots of source and target message types. I have attached the XML payload.

Please clear on the following.

1.Amit mentioned in his reply that the Message Type of the XML payload has to be same. In the XML payload , its MTPGROB and in the SAP-PI its MT_AglPGR_OB. So I will make the Message Type as MTOGROB in the PI system. Do I need to make for Data Type as well.

2. I didn't get what Amit mentioned MWD.

Regards

Former Member
0 Kudos

Hello,

IMO, ur xml file itself is not correct, for instance check the name of tag "ns0MTPGROB" in XML file. Ideally it should be something like <ns0:MTPGROB> or <MTPGROB>, but in ur case it's "<ns0MTPGROB>"...

Having said that if u can't change the XML file then create MT name as "<ns0MTPGROB>" in PI

>>So I will make the Message Type as MTOGROB in the PI system. Do I need to make for Data Type as well.

In addition to MT name, u have to correct following names in PI according to XML file and use:

1) "AgilityPGR" name in Data Type instead of Agility_PGR

2) "AbyShip_Ntfctn" instead of "AglShip_Ntfctn" in ur Data Type

3) "AbdMat_No" instead of "AglMat_No"

By MWD, i mean map with default.

So it seems that u have mapped "mapwithdefault" function to each and every target field as a result u r getting empty target nodes/elements.

So, firstly try to correct ur source structure and once done check the mapping

Thanks

Amit Srivastava