Product Information
Comparing material document creation ODATA API and SOAP Async API in S4 Hana Cloud
In some S4HC project , there is integration for material document creation in s4hc . S4HC has provided odata api and soap async api for this . Then question is in what kind of situation using odata, in what kind of situation using soap async api .
I want take this blog to test these 2 types of API.
First let test ODATA Api . Odata api is sync api, which means after calling finished, the result can be get from the return message .
If using odata api to create material documen , need 2 steps
1 get csrf token, it will take 2.6 s .
2 using posting to create material document , it will take 5.23 s
So if use ODATA API to create material document , it will take about 7.83 s atleast . For this material documen, it only has 1 item . But after the calling finished, the material document number is return at once .
Then let’s testing SOAP async API , only 1 step , it will take only about 3 s . But the material document creation is schedule in back end . So no material document will returned after calling . But S4HC will send out soap message after the material document created successfully in backend .
The following is the message body :
<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:glob=”http://sap.com/xi/APPL/Global2″>
<soapenv:Header/>
<soapenv:Body>
<glob:MaterialDocumentCreateRequest_Async>
<MessageHeader>
<!–Optional:–>
<ID schemeID=”” schemeAgencyID=”” schemeAgencySchemeAgencyID=””></ID>
<!–Optional:–>
<UUID schemeID=”” schemeAgencyID=””></UUID>
<!–Optional:–>
<ReferenceID schemeID=”” schemeAgencyID=”” schemeAgencySchemeAgencyID=””></ReferenceID>
<!–Optional:–>
<ReferenceUUID schemeID=”” schemeAgencyID=””></ReferenceUUID>
<CreationDateTime></CreationDateTime>
<!–Optional:–>
<TestDataIndicator></TestDataIndicator>
<!–Optional:–>
<ReconciliationIndicator></ReconciliationIndicator>
<!–Optional:–>
<SenderBusinessSystemID>xxxxxxx</SenderBusinessSystemID>
<!–Optional:–>
<RecipientBusinessSystemID></RecipientBusinessSystemID>
<!–Optional:–>
<SenderParty>
<!–Optional:–>
<InternalID schemeID=”” schemeAgencyID=””></InternalID>
<!–Zero or more repetitions:–>
<StandardID schemeAgencyID=””></StandardID>
<!–Optional:–>
<ContactPerson>
<!–Optional:–>
<InternalID schemeID=”” schemeAgencyID=””></InternalID>
<!–0 to 4 repetitions:–>
<OrganisationFormattedName></OrganisationFormattedName>
<!–0 to 4 repetitions:–>
<PersonFormattedName></PersonFormattedName>
<!–Zero or more repetitions:–>
<PhoneNumber>
<!–Optional:–>
<AreaID></AreaID>
<!–Optional:–>
<SubscriberID></SubscriberID>
<!–Optional:–>
<ExtensionID></ExtensionID>
<!–Optional:–>
<CountryCode></CountryCode>
<!–Optional:–>
<CountryDiallingCode></CountryDiallingCode>
<!–Optional:–>
<CountryName languageCode=””></CountryName>
</PhoneNumber>
<!–Zero or more repetitions:–>
<FaxNumber>
<!–Optional:–>
<AreaID></AreaID>
<!–Optional:–>
<SubscriberID></SubscriberID>
<!–Optional:–>
<ExtensionID></ExtensionID>
<!–Optional:–>
<CountryCode></CountryCode>
<!–Optional:–>
<CountryDiallingCode></CountryDiallingCode>
<!–Optional:–>
<CountryName languageCode=””></CountryName>
</FaxNumber>
<!–Zero or more repetitions:–>
<EmailURI schemeID=””></EmailURI>
</ContactPerson>
</SenderParty>
<!–Zero or more repetitions:–>
<RecipientParty>
<!–Optional:–>
<InternalID schemeID=”” schemeAgencyID=””></InternalID>
<!–Zero or more repetitions:–>
<StandardID schemeAgencyID=””></StandardID>
<!–Optional:–>
<ContactPerson>
<!–Optional:–>
<InternalID schemeID=”” schemeAgencyID=””></InternalID>
<!–0 to 4 repetitions:–>
<OrganisationFormattedName></OrganisationFormattedName>
<!–0 to 4 repetitions:–>
<PersonFormattedName></PersonFormattedName>
<!–Zero or more repetitions:–>
<PhoneNumber>
<!–Optional:–>
<AreaID></AreaID>
<!–Optional:–>
<SubscriberID></SubscriberID>
<!–Optional:–>
<ExtensionID></ExtensionID>
<!–Optional:–>
<CountryCode></CountryCode>
<!–Optional:–>
<CountryDiallingCode></CountryDiallingCode>
<!–Optional:–>
<CountryName languageCode=””></CountryName>
</PhoneNumber>
<!–Zero or more repetitions:–>
<FaxNumber>
<!–Optional:–>
<AreaID></AreaID>
<!–Optional:–>
<SubscriberID></SubscriberID>
<!–Optional:–>
<ExtensionID></ExtensionID>
<!–Optional:–>
<CountryCode></CountryCode>
<!–Optional:–>
<CountryDiallingCode></CountryDiallingCode>
<!–Optional:–>
<CountryName languageCode=””></CountryName>
</FaxNumber>
<!–Zero or more repetitions:–>
<EmailURI schemeID=””></EmailURI>
</ContactPerson>
</RecipientParty>
<!–Zero or more repetitions:–>
<BusinessScope>
<TypeCode listID=”” listVersionID=”” listAgencyID=”” listAgencySchemeID=”” listAgencySchemeAgencyID=””></TypeCode>
<!–Optional:–>
<InstanceID schemeID=”” schemeAgencyID=””></InstanceID>
<!–Optional:–>
<ID schemeID=”” schemeAgencyID=””></ID>
</BusinessScope>
</MessageHeader>
<MaterialDocument>
<GoodsMovementCode>4</GoodsMovementCode>
<PostingDate>2019-12-30</PostingDate>
<!–Optional:–>
<DocumentDate>2019-12-30</DocumentDate>
<!–Optional:–>
<BillOfLading></BillOfLading>
<!–Optional:–>
<ReferenceDocument></ReferenceDocument>
<!–Optional:–>
<Description>soap test</Description>
<!–1 or more repetitions:–>
<MaterialDocumentItem>
<GoodsMovementType>321</GoodsMovementType>
<!–Optional:–>
<GoodsRecipientName></GoodsRecipientName>
<!–Optional:–>
<MaterialDocumentLine>1</MaterialDocumentLine>
<!–Optional:–>
<ParentMaterialDocumentLine>0</ParentMaterialDocumentLine>
<!–Optional:–>
<Material>A0101010001</Material>
<!–Optional:–>
<GlobalTradeItemNumber></GlobalTradeItemNumber>
<!–Optional:–>
<Batch>201911002</Batch>
<!–Optional:–>
<SerialIDCreateAutomaticIndicator></SerialIDCreateAutomaticIndicator>
<!–Optional:–>
<Plant>WX01</Plant>
<!–Optional:–>
<StorageLocation>WX01</StorageLocation>
<!–Optional:–>
<ShelfLifeExpirationDate></ShelfLifeExpirationDate>
<!–Optional:–>
<ManufactureDate></ManufactureDate>
<!–Optional:–>
<BatchBySupplier></BatchBySupplier>
<!–Optional:–>
<StockType></StockType>
<!–Optional:–>
<InventorySpecialStockType></InventorySpecialStockType>
<!–Optional:–>
<QuantityInEntryUnit unitCode=”KG”>1.000</QuantityInEntryUnit>
<!–Optional:–>
<!–<QuantityInBaseUnit unitCode=”KG”>1.000</QuantityInBaseUnit>–>
<!–Optional:–>
<InventoryValuationType></InventoryValuationType>
<!–Optional:–>
<Customer></Customer>
<!–Optional:–>
<Supplier></Supplier>
<!–Optional:–>
<PurchaseOrder></PurchaseOrder>
<!–Optional:–>
<PurchaseOrderItem></PurchaseOrderItem>
<!–Optional:–>
<SalesOrder></SalesOrder>
<!–Optional:–>
<SalesOrderItem></SalesOrderItem>
<!–Optional:–>
<SalesOrderItemScheduleLine></SalesOrderItemScheduleLine>
<!–Optional:–>
<ManufacturingOrder></ManufacturingOrder>
<!–Optional:–>
<ManufacturingOrderItem></ManufacturingOrderItem>
<!–Optional:–>
<Delivery></Delivery>
<!–Optional:–>
<DeliveryItem></DeliveryItem>
<!–Optional:–>
<IsCompeletelyDelivered></IsCompeletelyDelivered>
<!–Optional:–>
<Reservation></Reservation>
<!–Optional:–>
<ReservationItem></ReservationItem>
<!–Optional:–>
<ReservationIsFinallyIssued></ReservationIsFinallyIssued>
<!–Optional:–>
<ProjectNetwork></ProjectNetwork>
<!–Optional:–>
<GLAccount></GLAccount>
<!–Optional:–>
<CostCenter></CostCenter>
<!–Optional:–>
<CostObject></CostObject>
<!–Optional:–>
<ProfitCenter></ProfitCenter>
<!–Optional:–>
<ProfitabilitySegment></ProfitabilitySegment>
<!–Optional:–>
<FunctionalArea></FunctionalArea>
<!–Optional:–>
<WBSElement></WBSElement>
<!–Optional:–>
<UnloadingPointName></UnloadingPointName>
<!–Optional:–>
<MaterialDocumentItemText>soaptest</MaterialDocumentItemText>
<!–Optional:–>
<GoodsMovementRefDocType></GoodsMovementRefDocType>
<!–Optional:–>
<GoodsMovementReasonCode></GoodsMovementReasonCode>
<!–Optional:–>
<IssgOrRcvgMaterial>A0101010001</IssgOrRcvgMaterial>
<!–Optional:–>
<IssgOrRcvgBatch>201911002</IssgOrRcvgBatch>
<!–Optional:–>
<IssuingOrReceivingPlant>WX01</IssuingOrReceivingPlant>
<!–Optional:–>
<IssuingOrReceivingStorageLoc>WX18</IssuingOrReceivingStorageLoc>
<!–Optional:–>
<IssuingOrReceivingValType></IssuingOrReceivingValType>
<!–Optional:–>
<MasterFixedAsset></MasterFixedAsset>
<!–Optional:–>
<FixedAsset></FixedAsset>
<!–Optional:–>
<FundsManagementCenter></FundsManagementCenter>
<!–Optional:–>
<FundsManagementFund></FundsManagementFund>
<!–Optional:–>
<CommitmentItem></CommitmentItem>
<!–Optional:–>
<Grant></Grant>
<!–Zero or more repetitions:–>
<SerialNumbers></SerialNumbers>
</MaterialDocumentItem>
</MaterialDocument>
</glob:MaterialDocumentCreateRequest_Async>
</soapenv:Body>
</soapenv:Envelope>
In S4HC message dashboard APP, we can find the material document is in the precess of creation .
So here lets come to the summary . If using odata API , it will take 7.8 s for every material document creation at least . If using soap async api , it will take about 3 s . So SOAP async api is much faster . If the interface has high concurrence for creating material document in S4HC, the better choice is SOAP async API.
Then END
Jacky Liu
Jacky Liu very detailed technical comparison, thanks for sharing this.
Thanks Jacky! You can probably also include the set up of message dashboard (through the app "Assign Recipients to users") for the benefit of those who may not be knowing this. But nevertheless, this is good and quite detailed information.
thanks for your contribution
Hi Jacky Liu
can we call OData Post Calls in Async Mode ?
i know that SOAP Calls are async in nature and will obviously be called in Async Mode. accordingly we can certainly leverage AIF for monitoring ..
thanks
Santhosh