cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Dear colleagues,

I need to create simple XML payload for API_MATERIAL_DOCUMENT_SRV for direct posting to S/4 via OData service from Postman, but all payloads I try lead me to error

"System expected the element '{http://www.w3.org/2005/Atom}entry".

Even such simple:

<?xml version="1.0" encoding="UTF-8"?>
<A_MaterialDocumentHeader>
<A_MaterialDocumentHeaderType>
<GoodsMovementCode>01</GoodsMovementCode>
<PostingDate>2018-06-09T00:00:00</PostingDate>
<to_MaterialDocumentItem>
<A_MaterialDocumentItemType>
<QuantityInEntryUnit>20</QuantityInEntryUnit>
<Plant>1710</Plant>
<Material>TG11</Material>
<PurchaseOrderItem>10</PurchaseOrderItem>
<PurchaseOrder>4500000107</PurchaseOrder>
<GoodsMovementRefDocType>B</GoodsMovementRefDocType>
<GoodsMovementType>101</GoodsMovementType>
<EntryUnit>PC</EntryUnit>
<MaterialDocument/>
<MaterialDocumentYear/>
<MaterialDocumentItem/>
</A_MaterialDocumentItemType>
</to_MaterialDocumentItem>
<MaterialDocument/>
<MaterialDocumentYear/>
</A_MaterialDocumentHeaderType>
</A_MaterialDocumentHeader>

While JSON payload works fine:

{
 "DocumentDate": "/Date(1611320834000)/",
 "PostingDate": "/Date(1611320834000)/",
 "MaterialDocumentHeaderText": "testAPI",
 "GoodsMovementCode": "01",
 "to_MaterialDocumentItem": {
 "results": [
 {
 "Material": "1016158",
 "Plant": "ROT1",
 "StorageLocation": "RO1Z",
 "GoodsMovementType": "101",
 "Supplier": "90011172",
 "PurchaseOrder": "4500001080",
 "PurchaseOrderItem": "10",
 "GoodsMovementRefDocType": "B",
 "GoodsMovementReasonCode": "0",
 "EntryUnit": "PC",
 "QuantityInEntryUnit": "1",
 "GdsMvtExtAmtInCoCodeCrcy": "0.00",
 "SlsPrcAmtInclVATInCoCodeCrcy": "0.00",
 "IsCompletelyDelivered": false,
 "SerialNumbersAreCreatedAutomly": true,
 "ReservationIsFinallyIssued": false,
 "MaterialDocumentLine": "1",
 "MaterialDocumentParentLine": "0",
 "HierarchyNodeLevel": "0",
 "GoodsMovementIsCancelled": false
 }
 ]
 }
}

Could you, please, advise, what could be the reason?

Best regards,

Alexander

View Entire Topic
MaximePacary
Discoverer
0 Likes

I faced identical issue.

It appears that you cannot simply copy/paste XML contents you see in Integration Suite iflow traces, into a Postman call.

It seems that an "OData" call step in Integration Suite adds many tags and attributes to the provided XML payload.

As an example, see in this doc page Create Material Documents | SAP Help Portal

The only example using XML format I could find was in "Create a Goods Receipt with Serial Numbers":

<?xml version="1.0" encoding="utf-8"?> <entry xml:base="https://Your_Server/sap/opu/odata/SAP/API_MATERIAL_DOCUMENT_SRV/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"> <category term="API_MATERIAL_DOCUMENT_SRV.A_MaterialDocumentHeaderType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="A_MaterialDocumentHeader" rel="self" title="A_MaterialDocumentHeaderType"/> <link href="A_MaterialDocumentHeader/to_MaterialDocumentItem" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_MaterialDocumentItem" type="application/atom+xml;type=feed" title="to_MaterialDocumentItem"> <m:inline> <feed xml:base="https://Your_Server/sap/opu/odata/SAP/API_MATERIAL_DOCUMENT_SRV/"> <link href="Item" rel="self" title="A_MaterialDocumentItem"/> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_MaterialDocumentItemType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Item 1" rel="self" title="A_MaterialDocumentItemType"/> <link href="Item 1)/to_MaterialDocumentHeader" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_MaterialDocumentHeader" type="application/atom+xml;type=entry" title="to_MaterialDocumentHeader"/> <link href="Item_1/to_SerialNumbers" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_SerialNumbers" type="application/atom+xml;type=feed" title="to_SerialNumbers"> <m:inline> <feed xml:base="https://Your_Server/sap/opu/odata/SAP/API_MATERIAL_DOCUMENT_SRV/"> <link href="Item_1/to_SerialNumbers" rel="self" title="A_SerialNumberMaterialDocument"/> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_SerialNumberMaterialDocumentType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Serial Number 1" rel="self" title="A_SerialNumberMaterialDocumentType"/> <content type="application/xml"> <m:properties> <d:SerialNumber>SERIALNUMBER_1</d:SerialNumber> </m:properties> </content> </entry> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_SerialNumberMaterialDocumentType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Serial Number 2" rel="self" title="A_SerialNumberMaterialDocumentType"/> <content type="application/xml"> <m:properties> <d:SerialNumber>SERIALNUMBER_2</d:SerialNumber> </m:properties> </content> </entry> </feed> </m:inline> </link> <content type="application/xml"> <m:properties> <d:Material>Your_Material</d:Material> <d:Plant>1010</d:Plant> <d:StorageLocation>101A</d:StorageLocation> <d:GoodsMovementType>501</d:GoodsMovementType> <d:EntryUnit>PC</d:EntryUnit> <d:QuantityInEntryUnit>2</d:QuantityInEntryUnit> <d:SerialNumbersAreCreatedAutomly>false</d:SerialNumbersAreCreatedAutomly> </m:properties> </content> </entry> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_MaterialDocumentItemType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Item 2" rel="self" title="A_MaterialDocumentItemType"/> <link href="Item 2)/to_MaterialDocumentHeader" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_MaterialDocumentHeader" type="application/atom+xml;type=entry" title="to_MaterialDocumentHeader"/> <link href="Item_2/to_SerialNumbers" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_SerialNumbers" type="application/atom+xml;type=feed" title="to_SerialNumbers"> <m:inline> <feed xml:base="https://Your_Server/sap/opu/odata/SAP/API_MATERIAL_DOCUMENT_SRV/"> <link href="Item_2/to_SerialNumbers" rel="self" title="A_SerialNumberMaterialDocument"/> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_SerialNumberMaterialDocumentType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Serial Number 3" rel="self" title="A_SerialNumberMaterialDocumentType"/> <content type="application/xml"> <m:properties> <d:SerialNumber>SERIALNUMBER_3</d:SerialNumber> </m:properties> </content> </entry> <entry> <category term="API_MATERIAL_DOCUMENT_SRV.A_SerialNumberMaterialDocumentType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="Serial Number 4" rel="self" title="A_SerialNumberMaterialDocumentType"/> <content type="application/xml"> <m:properties> <d:SerialNumber>SERIALNUMBER_4</d:SerialNumber> </m:properties> </content> </entry> </feed> </m:inline> </link> <content type="application/xml"> <m:properties> <d:Material>Your_Material</d:Material> <d:Plant>1010</d:Plant> <d:StorageLocation>101A</d:StorageLocation> <d:GoodsMovementType>501</d:GoodsMovementType> <d:EntryUnit>PC</d:EntryUnit> <d:QuantityInEntryUnit>2</d:QuantityInEntryUnit> <d:SerialNumbersAreCreatedAutomly>false</d:SerialNumbersAreCreatedAutomly> </m:properties> </content> </entry> </feed> </m:inline> </link> <content type="application/xml"> <m:properties> <d:GoodsMovementCode>05</d:GoodsMovementCode> <d:MaterialDocumentHeaderText>This is Text </MaterialDocumentHeaderText> </m:properties> </content> </entry>

By adapting this example to my use case, I could make the material document to be created.

It seems that when not using Integration Suite, it is simpler/clearer to use JSON format.