Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Deep Insert request throwing an error "Error while parsing an XML stream"

0 Likes
11,420

Hello There,

This is my first Odata Serivce that I am creating. I have created a below Odata service with Navigation to HeaderDetails to TAddCost and TAddCost to TAddLog but while passing the Payload with POST method - I am getting below XML parse error. Could you please help assist if I am doing any mistakes in the payload or in Odata Service?

Error message: code>CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406</code> <message xml:lang="en">Error while parsing an XML stream</message>

Odata Service:


MPC_EXT:

TYPES: BEGIN OF Head2AddCostNav,
Matnr TYPE ZBAPI_ADDITIVE_COST-Matnr,
Werks TYPE ZBAPI_ADDITIVE_COST-Werks,
Klvar TYPE ZBAPI_ADDITIVE_COST-Klvar,
Tvers TYPE ZBAPI_ADDITIVE_COST-Tvers,
Losgr TYPE ZBAPI_ADDITIVE_COST-Losgr,
Kadat TYPE ZBAPI_ADDITIVE_COST-Kadat,
Bidat TYPE ZBAPI_ADDITIVE_COST-Bidat,
Posnr TYPE ZBAPI_ADDITIVE_COST-Posnr,
Typps TYPE ZBAPI_ADDITIVE_COST-Typps,
Herk2 TYPE ZBAPI_ADDITIVE_COST-Herk2,
Herk3 TYPE ZBAPI_ADDITIVE_COST-Herk3,
Menge TYPE ZBAPI_ADDITIVE_COST-Menge,
Meeht TYPE ZBAPI_ADDITIVE_COST-Meeht,
Ltext TYPE ZBAPI_ADDITIVE_COST-Ltext,
Gpreis TYPE ZBAPI_ADDITIVE_COST-Gpreis,
Kstar TYPE ZBAPI_ADDITIVE_COST-Kstar,
Hrkft TYPE ZBAPI_ADDITIVE_COST-Hrkft,
Arbpl TYPE ZBAPI_ADDITIVE_COST-Arbpl,
Arbplwerk TYPE ZBAPI_ADDITIVE_COST-Arbplwerk,
Peinh TYPE ZBAPI_ADDITIVE_COST-Arbplwerk,
AddCost2AddLogNav TYPE STANDARD TABLE OF TS_TADDLOG WITH DEFAULT KEY,
END OF Head2AddCostNav.

types: begin of TS_DEEP_ENTITY,
ITestRun TYPE C LENGTH 1,
IZadd TYPE C LENGTH 1,
IZcost TYPE C LENGTH 1,
Head2AddCostNav TYPE STANDARD TABLE OF Head2AddCostNav WITH DEFAULT KEY,
END OF TS_DEEP_ENTITY .

Payload in JSON:

{
"ITestRun":"X",
"IZadd":"X",
"IZcost":"",
"Head2AddCostNav":[
{
"Matnr":"",
"Werks":"",
"Klvar":"",
"Tvers":"",
"Losgr":"",
"Kadat":"",
"Bidat":"",
"Posnr":"",
"Typps":"",
"Herk2":"",
"Herk3":"",
"Menge":"",
"Meeht":"",
"Ltext":"",
"Gpreis":"",
"Kstar":"",
"Hrkft":"",
"Arbpl":"",
"Arbplwerk":"",
"Peinh":"",
"AddCost2AddLogNav":[
{
"Matnr":"",
"Werks":"",
"Klvar":"",
"Kadat":"",
"Bidat":"",
"Status":"",
"Message":""
}
]
}
]
}

1 ACCEPTED SOLUTION
Read only

0 Likes
10,411

The issue is fixed Subhajit. Thanks for attempting to help.

Fix: Cardinitlity for the association between TAddCost and TAddLog was set to 1 whereas HeaderDetails to TAddCost was 1 and M. Since, TAddCost has mismatch cardinality between both associations - we were getting the error - now I have corrected it to M and the issue is resolved. 🙂

5 REPLIES 5
Read only

subhajit
Active Participant
0 Likes
10,411

Your payload seems to be fine..

What does the error log say ?

Read only

0 Likes
10,411

Hi Subhajit,

Thanks for the response - here is the exception that I have received. Really, don't see the user freindly message to share.

Read only

0 Likes
10,411

maybe u can attach / share the error 'TEXT' by clicking on Error Log in Gateway Client..

Read only

0 Likes
10,411

Here you go,

But I have an interesting finding - for AddCost2AddLogNav Navigation I see "multiplicity" in below internal is mismatching with "/iwcor/if_ds_edm=>gc_multiplicity_many" due to which exception is thrown - do you know what does this validation means?

Read only

0 Likes
10,412

The issue is fixed Subhajit. Thanks for attempting to help.

Fix: Cardinitlity for the association between TAddCost and TAddLog was set to 1 whereas HeaderDetails to TAddCost was 1 and M. Since, TAddCost has mismatch cardinality between both associations - we were getting the error - now I have corrected it to M and the issue is resolved. 🙂