Technical Articles
SAP Business ByDesign – OData API Examples
The SAP Business ByDesign (ByD) provides REST/OData APIs to access ByD business objects, reports and data sources:
- The OData API for Reports is tailored for remote access to pre-processed and formatted analytical data (reports). The remote application may extract a ByD analytical model as a cube incl. semantics like key figures, language-dependent texts and aggregated data.
- The OData API for KPIs is tailored to access ByD KPIs incl. context information.
- The OData API for Data Sources is designed to extract analytical raw data (data sources) in flat tables, free of redundancies from ByD.
- The OData API for Business Objects is designed for UI-driven access to ByD business objects. A UI-like remote application or system interactively queries, reads, creates, updates, deletes or performs actions on ByD business objects and business documents. Using the work center “Application and User Management – OData Services“, key users are empowered to decide which business objects, nodes, elements and actions are exposed via OData API.
You find more information about ByD APIs in blog post SAP Business ByDesign – API Overview.
Where do I get OData examples?
To get some hands-on experience using SAP Business ByDesign OData APIs you find a repository of API Examples on GitHub: SAP Business ByDesign – API Samples.
The GitHub repository provides sample ByD Custom OData Services for currently 44 business objects and 6 Postman collections with more than 600 example OData requests. The Postman collections illustrate hands-on how to access master data, business documents and analytical data in context of ByD business processes with a focus on ByD OData APIs.
All sample Postman collections are tailored to SAP Business ByDesign Partner Demo Tenants (Full scope US) with preconfigured and loaded sample data provided by SAP.
Nevertheless you can use the Postman collections and sample Custom OData Services in other ByD systems as well, if you adopt Postman environment variables and Postman requests according the business configuration and master data of your ByD system.
The GitHub repository contains the following Postman collecions:
- Analytics: Access ByD built-in analytics incl. KPIs, reports and data sources.
- Master Data: Access ByD master data objects using APIs.
- Reference Scenarios: Run ByD business processes using APIs to get insights how to create, change and read involved business documents and how to create business document relationships to achieve a meaningful document flow.
- Projects: Create, change and read cost collecting projects and customer projects.
- Sales and Commerce Scenarios: Run ByD sales and commerce processes using APIs to get insights how to create, change and read involved business documents and how to create business document relationships to achieve a meaningful document flow.
- Internal Logistics: Run internal logistical processes using APIs.
- New Business: Run processes to generate new business such as leads, opportunities and quotes.
Please check the descriptions of the respective Postman collections for further details.
How to run API examples?
The easiest way to run an API sample scenario would be using a SAP Business ByDesign Partner Demo Tenant (Full scope US) with preconfigured and loaded sample data provided by SAP.
The following example is based on such a tenant and I am running the scenario “Master Data – Service Product (write)“:
- Install the API sample package “Master Data“ and configure your ByD system following the instructions in chapters “Download and Installation” and “Configuration” of the GitHub repository readme file.
- Open the Postman Runner and select the collection “Master Data“, the collection folder “Service Product (write)” and the environment “Master Data“:
- Click on “Run Service Product (write)” and see the process flow:
For more detailed analysis you can open the Postman Console to log detailed traces or simply execute the requests one-by-one in the Postman collection itself.
By the way:
The sample Postman collections may serve as well as approach to create meaningful data along process chains to prepare a ByD system for demo purposes, or to run regression tests by processing end-to-end business processes.
Blog Posts with further Examples
- Extend SAP ByDesign using SAP Cloud Platform HTML5 Applications
- Configure OAuth 2.0 for SAP ByDesign OData Services
- OData Example: Read and Write Product Purchasing Data
- OData Example: Create and Update Product Data in ByD
- Create ByD Sales Orders using Alexa
- Alexa Meets SAP Business ByDesign
- SAP Business by Design – How to Create an OData Service (Youtube)
- SAP Business ByDesign Side-by-Side Extensions on SAP Cloud Platform
Update of API sample package "End-to-End Scenarios":
Thanks Knut Heusermann for this very helpful blog.
We have a doubt about Sales Order Item Pricing:
We are building an integration which fits on "Selling Services Scenario" provided on the API Sample Package.
Since our Services are not price defined, we tried to create a SalesOrder indicating the price on each Item, but we got an error.
We also tried to update the SalesOrder when it is created, and since we get no error, the price is not updated.
Could help us with that? We saw that it is possible to do on SOAP, but for this integration we are building, REST is a Must.
Thank you.
Hi Marc,
my OData sample for sales orders assume that prices and taxes are calculated by ByD. As of today sales order price components are not yet OData enabled and hence the sales order SOAP service would be the only possibility to create sales orders with given prices.
In general I would suggest to request an enhancement of the public solution model as described in my blog post SAP ByDesign Public Solution Model, but very likely enabling the sales order price components is no quick fix.
Best regards,
Knut
Update release 1908: Sales order price components can now be updated using OData service. Please find more details and examples in blog post OData Example: Create Update Delete Price Components of Sales Order in SAP Business ByDesign
Update of API sample package “Projects”: Added a sample Custom OData Service and corresponding Postman OData requests to create and read project time recordings.
Hi Knut,
Is there also a way to create non project related time recordings? (Leave, Holiday etc)
Hello.
Using the provided POST request "Update fulfilled quantity" in the "Field Service and repair" Scenario, we are getting the following error:
The server has not found any resource matching the Data Services Request URI.
Has anyone ever found a solution for this?
Thank you in advance.
Hi Marc,
I'm using Postman environment variables in the OData URL. Those variables are either values provided or are populated by previous requests.
In your request the environment variable "ServiceConfirmationItemScheduleLineObjectID" seems to be empty or invalid. Please enter a valid value for variable "ServiceConfirmationItemScheduleLineObjectID" in your Postman environment or run the OData requests of folder "Field Service and Repair" in the given sequence such that the variable is populated by request "Get service confirmation" (see Postman request test script of request "Get service confirmation").
Best regards,
Knut
Hi Knut,
We've got a requirement to create Customer Invoice Requests directly via OData rather than via Sales Orders. Looking at the PSM, it should be possible to create a Customer Invoice Request by setting Business Process Variant Type to 3 (for a manual request), the CustomerInvoiceProcessingTypeCode to CI and buy setting the buyer party and sales unit party (as well as items of course).
I've taken your example web service for Selling Services and have imported the customer invoice request service into my BYD tenant and then altered the service to expose the relevant fields and objects.
However when I try to create a request with a POST, I find that the Sales Unit Party is read only. I am able to set the Business Process Variant Type, and the CustomerInvoiceProcessingTypeCode but the sales unit party ID is read only.
Is this why you've used a sales order and then released the order, and then get the invoice request from the sales order ID, because you ca't create an invoice request directly?
Greg
Hi Greg,
I'm using sales orders because of the scenario that I realized (for example incl. deliveries and ATP check); using sales orders was not intended as workaround for creating invoice requests directly.
You can change the sales unit party of customer invoice requests by a Patch on the corresponding resource of the SalesUnitPartyCollection. The fact that you can't create the sales unit party with the invoice request directly is a gap in our PSM for OData.
However, if you dig deeper you will find out that there are more invoice request elements not yet create/update enabled or missing and hence as of today you can't create an external customer invoice request using OData.
For that reason, I would suggest to use the SOAP API Manage Customer Invoice Requests to create external customer invoice requests. This API provides you with the possibility to create and change invoice requests incl. prices and external payments, and you can furthermore trigger invoicing directly.
Here is an example for an invoice request using API Manage Customer Invoice Requests:
Best regards,
Knut
Hi Knut,
Sorry I didn't thank you for this at the time - for some reason I didn't get notified that you'd left a response, and I had moved onto something else. I am now back on this piece of work - thank you for the explanation; the gap in the ODATA PSM is still there today.
I have a problem using the SOAP API though. Unless Sales Orders are scoped in, which in my customer's tenant it is not, the SOAP API cannot create a Customer Invoice Request. You get a very cryptic error:
No scheme configuration found for scheme '&CIRHP&'
On another tenant with Sales Orders scoped in, I can create the customer invoice requests no problem. However scoping Sales Orders in is not an option on the tenant I need to do this on. Any advice?
Greg
Hi Greg,
I don't think the error message is caused by the Sales Order scoping. Could you please log an incident in ByD to follow up on your issue?
Thanks and best regards,
Knut
Hi Knut,
You are correct. After followup, it's emerged that the option "Upload of Invoice Requests" needs to be in scope. Otherwise you get that very unhelpful error! Thanks again for the help.
Greg
Hello Greg,
May I know what did you do to post the direct Customer Invoice Request via SOAPUI? Can you share you xml code for request in
Thanks,
Chester
Hi Knut
I tested your end-to-end scenario field service and repair.
We also need to read and update the field "Incident Description" in our scenario.
Can you give me a hint how to update the field?
Thank you and best regards
Jasmin
Hi Jasmin,
please do the following:
Text TypeCodes:
Best regards,
Knut
This example creates a service order incident description:
POST /sap/byd/odata/cust/v1/tmserviceorder/TextCollection HTTP/1.1
Host: ...
Content-Type: application/json
x-csrf-token: ...
Accept: application/json
cache-control: no-cache
Postman-Token: ...
{
"ParentObjectID": "{{ServiceOrderObjectID}}",
"Text": "Some incident description ...",
"TypeCode": "10006"
}
I'll add this example to the next version of the OData samples on Github as well 🙂
Update: Today I uploaded a new version of API sample packages to the GitHub repository:
Hi Knut
we are currently implementing incoming Bank Statements with Odata. We have ran into a problem as we cannot get full data for BankStatement items using Odata compared to what can be seen in the CAS using Repository Explorer. It seems that item details are not as well in place as we need. Could you please advise?
Olli
Hi Olli,
to enable business object nodes and element for OData comes with some additional requirements compared to a pure PSM release for CAS development. Please request an enhanced PSM release for your OData use case as described in blog post SAP ByDesign Public Solution Model.
Thanks,
Knut
Hi Knut,
I have requested PSM release on 15.11. but w/o the OData details. We will enhance the request with OData details.
Thanks
Olli
Hi Knut,
it seems that SAP development team is not able to open required BO object:
Hi Knut,
The EDM Type for the standard created on field is string instead of Datetime so we are not able to use all IntervalBoundaryTypeCode (ge, le etc..) for filter option.
We have a requirement to filter the Odata query based on the creation datetime. Is there a way to achieve this.
Thanks,
Naveen
Hi Naveen,
You find some examples to filter by the creation datetime in the Github repository. However, in my examples the edm type is always DateTime or DateTimeOffset. Which API type and entity are you looking for?
Best regards,
Knut
Hi Knut,
We are currently implementing mass data upload with ODATA.
We create Custom BO and Custom Odata Service.
We have tens of thousands data to be uploaded, so, we're testing with reference to Create 2 sales orders + get (batch) scenario.
But it doesn't work.
POST : https://xxxxxxx.sapbydesign.com/sap/byd/odata/cust/v1/svinterface/$batch
in the BODY,
--batch_1
Content-Type: multipart/mixed; boundary=changeset_2
--changeset_2
Content-Type: application/http
Content-Transfer-Encoding: binary
POST SvInterfaceCollection HTTP/1.1
Content-Type: application/json
Content-ID: 1
Content-Length: 10000
Accept: application/json
{
"SourceSystemDocumentID" : "Test097",
"IFResult" : "FAIL",
"SvInterfaceTransactionHead" :
[
{
"Type1" : "10",
"Type2" : "ORD001"
}
{
"Type1" : "10",
"Type2" : "ORD002"
}
]
}
There is no response from system. there is '202 Accepted' message only.
Could you please advice?
Best regards,
J Choi
We solved this issue.
We changed some contents in body.
Hi Knut,
We are testing ways to interface with our SAP ByDesign system and currently we are thankfully using your sapbydesign-api-samples on Github.
I try to update some Project Task Expenses using your Custom Odata Service, but I cannot find a way to make the change in the correct Period Plan.
Can you guide me how I can add these Period Plans data to the Custom Odata Service?
Thanks in advance
Ronald van Herk
Hi Ronald,
to add period plans you need to add the business object node Project/Task/TaskExpense/TaskExpensePeriodPlan to your OData service.
Please note the following:
Take into account that you have to schedule the task as well.
Don't mixup the TaskExpensePeriodPlan with the TaskExpense/PlannedPeriod. In ByD you can plan on multiple levels: task, work/material/expenses/revenues and on periods. The TaskExpense/PlannedPeriod refers to the timeframe for which a task expense item is planned in case you plan on that level.
Sometimes you may observe, that you add a node to an OData service and some elements of this node are greyed out. In this case, save and activate your OData service, close it, reopen it, and now you can add the previously greyed out field (this is a known issue - we are working on it).
Best regards,
Knut
Hi Knut,
Thank you for your quick response. I had to wait a few days before I could try because there was an issue in the latest release with uploading Custom Odata Service XML files.
Now that works again, but the 2 mandatory fields PlannedCostAmount and PlannedPeriod.remain greyed out, even when I follow your instructions to save and activate and then close and re-open the service. Could it be that that is also an issue with the latest release?
I am a little stuck now, I hope you have maybe an idea? Could you add them to your khproject.xml on github for example?
Warm regards,
Ronald
Hi Knut,
I managed to select the 2 mandatory fields now, I think I overlooked something on my end.
Maybe a more general question: How can I know that there are mandatory elements when constructing a Custom Odata service? Can we find that in the SAP documentation?
Warm regards,
Ronald
Hi Knut,
thanks for this comprehensive summary when working with SAP ByD's API.
I want to add a BusinessPartner (Company) to our system via API and therefore tried uploading your OData Services (khbusinesspartner.xml) from Githhub. Unfortunately this fails. Is it possible that with SAP 2005 the xml structure of OData Services changed?
I also haven't been able to shift an ODataServices in May from our Testtenant (already ByD 2005) to our Productivetenant (still ByD 2002).
If the xml structure has changed: Is there a possibility to merge your Services from Github to the new structure? Or can you download them once again and share with us?
Thanks & Regards
Adrian
Hi Knut,
We are using SAP ByDesign OData to integrate with K2 software.
K2 will create a service instance from the metadata of OData but not work with
OData API for Reports because metadata of Key ID missing Nullable attribute.
This is the Error message from K2 software.
Could you have any idea? Or Is it possible we can fix metadata of OData API for Reports?
Thanks & Regards
Warut
UPDATE of the GitHub repository:
Because of the new file format of Custom OData Service exports/imports, I uploaded new versions of all sample Custom OData Services with the new xml file format to the GitHub repository. The content of the Custom OData Services did not change with this update.
With the new Custom OData Service xml files the upload problems in ByD tenants >= release 20.05 as reported by Warut and Adrian should be solved.
Best regards,
Knut
Hallo Knut,
is there a chance to get an example for creating a customer invoice in the Github-Repo?
Hi Konstantin,
in ByD you can create customer invoices from one or more customer invoice requests. This can be done via invoice run, via Soap or OData API or manually via UI.
Customer invoice requests can be considered as billable representatives of a sales document. This means sales orders, customer contract items, server orders, service confirmations, ... create customer invoice request automatically if released. This can be done via the Soap/OData API of the corresponding sales document.
You find examples for such scenarios in the Postman collection "Reference Scenarios" of the Github repo.
In some cases the sales document may reside outside ByD and you would like to trigger an invoicing process in ByD by creating an "External customer invoice request". Unfortunately, as of today this is possible via Soap web service API only, because some mandatory elements for external customer invoice requests are not yet PSM-released or read-only released only (e.g. invoice type code, item type code, BaseBusinessTransactionDocumentID, BaseBusinessTransactionDocumentItemID, ...).
You find an example to create exterbal customer invoice requests via Soap API in the Github repo in Postman collection "Sales and Commerce Scenarios", folder "Invoice External Billing Documents".
You find a guideline to request PSM releases in my blog post https://blogs.sap.com/2017/10/02/sap-bydesign-public-solution-model/.
Best regards,
Knut
Dear Knut
We have built a UI5 based Customer Portal and want to use the Sales Order OData Service with the Batch Variant to create sales orders. We have now built a view test cases and are uncertain about the load that this approach does on the ByD tenant. Our samples include a batch request, where we want to create 4 sales orders with 100 line items each. This seems to be too much for the process. Do you have any information what impact on the load the batch variant has? Unfortunately we don't know if any queuing happens with the batch components or not. So does a batch with 10 sales orders, each having 10 line items, have that same load as one sales order with 100 line items?
Best regards
Pascal
Hi.
Im using the SOAP API for Suppliers to create new Suppliers.
I am able to successfully create suppliers with addresses , contacts, sales and payment data etc...
My only issue is that I cant seem to cretae the business communication E-MAil in the contacts tab for the contacts I create.
The phone data is created, the fax data is created but not the email...
This is how the contacts section of my template looks:
Like i wrote above, this all works except the email.
thank you.
Hi Yan,
thanks for bringing up this - looks like a bug. Could you please raise a ByD incident?
Thanks and best regards,
Knut
Hi Yan,
I need to correct myself:
There is a typo in the element name: The correct element name is "WorkplaceEMailURI" (with a capital "M").
Best regards,
Knut
Hi Knut,
Thank you so much for your reply.
I took the element name directly from the WSDL and/or the examples in the API guides.
When it did not work i did raise an incident, was more than a week ago and i did not hear anything since.
Best regards,
Yan
Update: Examples for Location master data and Goods Movement added.
I added a new Postman collection "Internal Logistics" with a first example to post a goods movement to the Github repository. The example includes requests to read locations and logistics areas, and to get the current stock overview.
To run the Postman collection I added the Postman environment "Internal Logistics" and two new custom OData services "khgoodsandactivityconfirmation" and "khlocation" to the Github repository as well. Please take into account the details in the description of the Postman collection.
Update: Examples for SAP Business ByDesign KPIs.
I added a new Postman collection "Analytics - KPIs" with examples to access ByD KPIs using the OData API for KPIs.
The Postman collection works with the previously published Postman environment "Analytics".
Hi Knut Heusermann ,
Thanks for maintaining this awesome blog!
We are trying the "Customer (write)" sample from the Master Data collection. It fails at the step "Create account note".
We have noticed that adding a note to the account before running this request makes the problem disappear, like this.
Sending the same request after that addition works as expected. I am thus suspecting that it has something to do with the "TextCollection" node which is between the Customer node and the individual Text nodes.
Have you seen this issue before, any advice?
Thanks!
//Carl
Hi Carl,
For text collections we are using a reuse component in Custom OData Services without explicitely exposing the root node of the text collection. Therefore I think this is a bug in the reuse component. Could you please create an incident for the issue?
Thanks and best regards,
Knut
Hi Knut,
I'm already crazy by solving an OData problem.
I need to create and update customer quotes via OData but I have no idea which OData object I can use to set the CustomerQuoteItem price and amount.
OrderQuantity in ItemActualValues is not writable.
In PriceAndTaxCalculation are so many fields ans associations but I don't know which of them is writable or is the right I have to use.
I just need to add a item with a product a quantity and a price.
Could you please help and explane or just link to the information where this is documented?
Kindly regards, Markus
Hi Markus,
I added some examples to create sales quotes with item quantities and prices to the GitHub repository GitHub - ByD API Samples.
Best regards,
Knut
Update: Examples for ByD Sales Quotes.
I added a new Postman collection "New Business" with some first examples to to create sales quotes.
To run the examples you need to upload the new version of the Custom OData Service khcustomerquote published in the GutHub repository today.
The Postman collection "New Business" works with the Postman environment having the same name.
Hi Knut, thank you very much the Postman works great (tested GET only).
Bute there is still one question. How can I add PriceComponent and ItemPriceComponent to my OData service? The matter is I don't have this nodes within the object ItemPriceAndTaxCalculation, only four other nodes.
Thank you, best regards,
Markus
Hi Markus,
I added the sub-nodes "OperationalPriceComponent" for the price components and header level and "OperationalItemPriceComponent" for price components on item level and renamed the nodes for simplicity.
Best regards,
Knut
Hi Knut Heusermann,
it's working very well so far, thank you again.
But now I have another question.
I want to track which user did the last changes on a CustomerQuote when I transfer this data via webhooks to the SAP CPI. But I found no data source for the change history on an CustomerQuote object. Could you tell me where I have to search for?
Best regards, Markus
Hi Markus,
the change history is not available via OData because it is not part of the public solution model (PSM).
However, if your you need to know the user responsible for the last changes only, then you may request to enhance the PSM by the element SystemAdministrativeData.LastChangeIdentityUUID and the association LastChangeIdentity (see as well https://blogs.sap.com/2017/10/02/sap-bydesign-public-solution-model/).
Best regards,
Knut
Hi Knut,
thank you for this insights.
An incident wouldn't be practicable to ask SAP for each change on any CustomerQuote.
I hoped I could extract "This CustomerQuote was created/modified by [employee_name]".
But it's ok I will do without this information.
Best regards,
Markus
Hi,
Thanks for API samples.. But we have some issues about our CustomerInvoice senario Turkish e-Document services.
We are using CustomerInvoiceCollection API for to get released Invoices. We need some informations about Invoice for example CustomerParty > TaxNumer and Item > TaxCode, TaxRate, DiscountRate, DiscountAmount
We are getting TaxNumber from CustomerCollection one by one and it is poor performance. is there any way to get it as $crossjoin. we tried $crossjoin but it's not working.
We are not getting Item > TaxCode, TaxRate, DiscountRate, Discount Amount from CustomerInvoiceCollection
Hi Aydin,
we don't support $crossjoin in ByD so far.
However, you can add the information you are looking for by enhancing your custom OData service: You find the tax-ID of the buyer and seller in node ItemPriceAndTaxCalculation.ItemTaxationTerms, the tax code in node ItemPriceAndTaxCalculation, and all price components in node ItemPriceAndTaxCalculation.OperationalItemPriceComponent.
Best regards,
Knut
Hi Knut,
Thank for your fast replay,
I checked custom OData service and found some answers... But I have still some issue about Tax-ID
There are two way to get BuyerTaxID...
And when I added new selection for Item.ItemPriceAndTaxCalculation. I receive
<H1>500 SAP Internal Server Error</H1>
Update: New samples for data sources and reports.
Analytics - Data Sources:
Analytics - Reports:
Update: Enhancements of custom OData services and new sample requests for master data.
Master data:
Custom OData Service enhancements:
Hi Knut,
Thanks a lot for all the samples published for many objetcs : it is very helpfull !
We have actually some performance issues on oData for projects tasks as we process them one by one for the interface to create/update task on project with up to 1000 tasks.
We suspect performance issue coming from the unitary processing and we would like to know if it is possible to create multiple tasks on an existing project in one call ?
We tried a "patch" operation in the root project with mulitple new tasks as sub-elements but despite no technical error, tasks are not created. Or maybe we didn't provide the right content ?
Also, is multiple update supported by the system ?
If it is supported, a sample based on your data model would be apreciated.
Regards,
Pierre
Hi Pierre,
unfortunately, ByD OData APIs for business objects does not yet support deep patches, i.e. a patch on a project root and multiple subnodes in one hierarchical json-structure.
However, ByD supports OData batch-requests, which means you can include multiple OData requests with project task updates and creations in one http-request. You find some examples in the Postman collection "Sales and Commerce Scenarios", folder "Create Sales Order using batch". This approach may help to improve the performance, but it is still not the same as a mass-operation.
Best regards,
Knut
Update: Enhancements of custom OData service khproject to support task scheduling.
This blog is an awesome resource and definitely the #1 starting point for any new ByD Odata developer. Thank you very much for it!
I am currently trying to find a way to create Site Logistics Tasks confirmations as well as Production Tasks confirmation, which the documentation seems to imply is possible. Unfortunately I can't find any example or code sample on the matter.
The use-case scenario is as following: Lets say a Warehouse Request is created from a sales order process, and a Warehouse Order/Warehouse Task is created manually by an employee:
By selecting the Warehouse Task in the Execution workcenter and confirming it, a Site Logistics Confirmation is created as well as the Outbound Delivery business object as soon as the request has been fully processed.
Now, I understand that this behavior can in theory be replicated in Odata using the SiteLogisticsLot business object, (or ProductionLot in case of a ProductionTask) but the actual usage of it is very poorly explained in the doc. I was hoping that could be improved and/or exemplified?
If on the contrary it is in fact impossible to "confirm" tasks (logistics, production or otherwise) using odata, At least here we could make it official once and for all.
Either way, thank you for your awesome contribution!
Hi Knut,
Thank you very much for the OData examples.
I am trying to create identified stock using OData service. However, I cannot find the way to associate a product sepcification to the identified stock. The screenshot below is the custom OData setting in ByDesign:
I tried the following body in POST to IdentifiedStockCollection.
However I am receving the following error:
I also tried to create the identified stock first without product specification and then assign product spec while activating the identified stock (with PATCH):
The identified stock was activated successfully without error, but the product specification was not assigned.
Could you provide some guidance?
Thanks,
Alan
Hi Alan,
by adding the node ProductRequirementSpecification you include an the association and the business object "ProductRequirementSpecification" itself in your OData service. Therefore the element ProductRequirementSpecification/ID cannot be used to setup the association.
The element to enter the reference to a product specification would be the element ProductRequirementSpecificationVersionUUID on identified stock root level. However, this element is not yet write enabled in the public solution model.
Please request to enhance the public solution model of the identified stock to edit the ProductRequirementSpecificationVersionUUID and the ProductRequirementSpecificationID on identified stock root level. For more details please check my blog post SAP ByDesign Public Solution Model.
Best regards,
Knut
Hello Knut,
I am creating a supplier via POST http request from Postman. Then I have odata Adapter in receiver end. I am passing basically just name to test.
Payload:
<?xml version='1.0' encoding='UTF-8'?><SupplierCollection><Supplier><FirstLineName>TestPostman</FirstLineName></Supplier></SupplierCollection>
CPI Scenario:
BYD:
I am getting the following error :
"Business partner category does not exist; use 1, 2 or 3 Diagnosis This error occurs in the following cases: An attempt was made to use a business partner category that does not exist.
The following values are currently permitted: 1 Person 2 Organization 3 Group No category was specified (content blank)."
FYI I am using khSupplier odata service imported from SAP Business ByDesign – OData API Examples | SAP Blogs / GitHub - SAP-samples/byd-api-samples: A set of Postman collections that enables users to consume SAP Business ByDesign web services.
Business object is : Supplier
Please assist if you can.
Regards
Jay
Hi Jay,
the minimum data to be provided to create a supplier would be: name, category code and role. Unfortunately, the role is read-only and the category code is not exposed in the public solution model so far. Please request an enhancement of the public solution model (PSM) as described in my blog post SAP ByDesign Public Solution Model.
As an alternative approach, you may use the SOAP-service ManageSupplierIn to create the supplier.
Best regards,
Knut
Thanks Kurt.
I tried SOAP referring your GitHub repository > Master Data > Create Supplier. Worked like a charm.
Much helpful.
Regards
Jay
Hi Knut,
Thanks for the informative article.
I am using the khsalesorder Custom OData Service and trying to create a Sales Order via API calls through postman. But when I send multiple items in the Item object, I am facing an issue where the unitCode is not getting populated for one of the items. I tried posting the community - https://answers.sap.com/questions/13497746/creating-a-sales-order-with-multiple-items-using-o.html
Can you please provide some guidance?
Thanks,
Srilekha
Update 18 Feb. 2022:
Enhancement of OData service khproject: I added the live cycle status and the blocking status (referring to the UI field "On Hold") to the project summary task collection.
Update 17. March 2022:
Custom OData service changes:
Postman collection Master Data changed:
Hi Knut!
Thanks for this great resource.
I have a very specific question that we are a bit stuck on: is it possible to create a Purchase Request for Services through OData services?
We have setup an OData service for Purchase Requests, but somehow I suspect this will limit us to creating PRs for To-Stock Materials (same as creating a manual PR in the ByD UI) - is that correct?
We know we can create any kind of PR through SOAP webservices, so if OData will not work we'll go that way, but if OData is possible that would have our preference.
Thanks & kinds regards,
Eelco
Update: Added project status elements to the root node of OData service khproject.
Hello Knut !
Thank you very much for this documentation.
Your work is awesome. You clearly are our hero (in a french company working on CPI)
We have an issue with the khbusinesspartner, while trying to create a contact using BusinessPartnerCollection.
When using Postman and a JSon body, everything is working fine :
But, while in a CPI integration flow, we are able to register name, gender, role, but not any information in CurrentDefaultAddressInformation (ConventionalPhone, Email etc.) :
Do you have any idea why it's not working properly from SAP CPI ?
Thank you in advance for your kind help !
Best regards.
Hi Guillaume,
Thanks a for your kind words 🙂
Are you sending an xml-payload or json-payload from CPI to the ByD OData API? I think there are more detailed insights required to identify the root cause. Could you please address an incident to the CPI team to check the difference in the request send to ByD?
Thanks, Knut
Hello Knut !
We are sending an xml-payload from CPI to ByD.
We will try to contact CPI Team with an incident.
Have a nice day.
Update of OData examples for analytical data sources:
I enhanced the Postman collection "Analytics - Data Sources" and the associated Postman environment "Analytics" by new examples to illustrate how to expand the OData response of data sources to master data details and how to filter by master data IDs.
Hi Knut,
Thanks for all the examples, they are really helpful!
In ByDesign it is possible to combine multiple customer invoice requests into one customer invoice. Is that also possible with one of your custom OData services?
Thanks, Stefanie
Hi Stefanie,
in general customer invoice requests are combined into customer invoices by the invoice run. In the invoice run, you define as well the filter criteria to select the invoice requests to be taken account and the invoice split criteria.
This means you cannot combine multiple invoice requests into a single invoice using an OData service on business object Customer Invoice Request, but you would need to create an OData service on the Invoice Run object. Unfortunately, the invoice run object is currently not part of the ByD public solution model (PSM). However you may request SAP to add the invoice run to the PSM as described in my blog post: SAP ByDesign Public Solution Model.
Exception:
ByD allows you to create "External Customer Invoice Request", which represent a billable document in a remote system. These external customer invoice requests can be created and released via SOAP web service, and if you send multiple external invoice requests with "SettlementPriorityCode>1</SettlementPriorityCode>" as bundle to ByD, then ByD combines those external invoice requests into a single invoice (of cause split criteria apply here as well).
Example:
Hi Knut Heusermann,
We are having a strange issue with the ODATA API for business objects. We tried all the means that are possible from our end and now commenting here for experts/your help.
We have an ODATA URL below where we wanted to filter the data by the SLTaskStatus with two options but the below service URL is executing and the result set is giving all the data irrespective of the status filter that is added. We are not sure if we are using the URL in the right way or not and filter attribute is the right way to add it here or not.
https://myXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootQueryByElements?$format=json&$filter=(SLTaskStatus eq '1' or SLTaskStatus eq '2')
Could you please help us as we are standing in dark with no further direction or clue known?
Thank you for your time and suggestions here on this issue.
Regards
Hanu K
Hi Hanu,
your sample URL appears to be an OData request on a function import of type query. In such requests the filter-parameters have no impact, but you would need to use the parameters of the function (you find these parameters in the OData metadata).
Here is an example using the business partner:
GET <hostname>/sap/byd/odata/cust/v1/khbusinesspartner/QueryByElements?NumberOfRows='20'&InternalID='{{BP-CustomerID}}'
GET <hostname>/sap/byd/odata/cust/v1/khbusinesspartner/BusinessPartnerCollection?$format=json&$filter=InternalID eq '{{BP-CustomerID}}'&$top=20
Best regards,
Knut
Thanks, Knut Heusermann for the response.
Yes, you are right, I am using the function import of type query and this query is a standard query by elements available with the object. The below URL is using the filter parameters as shown from the metadata. I am giving the metadata of our service please let me know the issue with the below URL I am using to filter the data by the status (field is SLTaskStatus. I have highlighted (made BOLD) the section from the metadata that is related to the function import query
Service URL: https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootQueryByElements?$format=json&$filter=SLTaskStatus eq '{2}'
The above URL is still not filtering the data and returning all the data records irrespective of the status I want. Not sure what is mistake I am doing here and missing doing it right. Please help here.
Meta Data:
<edmx:Edmx Version="1.0">
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="cust">
<EntityType Name="SiteLogisticsTaskDataCollectionRoot">
<Key>
<PropertyRef Name="ObjectID"/>
</Key>
<Property Name="ObjectID" Type="Edm.String" Nullable="false" MaxLength="70" FixedLength="true" sap:creatable="false" sap:updatable="false" sap:filterable="true"/>
<Property Name="ActivityType" Type="Edm.String" Nullable="true" MaxLength="10" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootActivityTypeCollection"/>
<Property Name="ChangedBy" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="CreatedBy" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="RefSOFMFName" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="RefSOFMFID" Type="Edm.String" Nullable="true" MaxLength="20" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="RefSOID" Type="Edm.String" Nullable="true" MaxLength="35" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="RefSOStoreName" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="RefSOStoreID" Type="Edm.String" Nullable="true" MaxLength="10" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLRequestProcessingTypeCode" Type="Edm.String" Nullable="true" MaxLength="4" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLRequestProcessingTypeCodeCollection"/>
<Property Name="SLRequestTypeCode" Type="Edm.String" Nullable="true" MaxLength="15" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLRequestTypeCodeCollection"/>
<Property Name="SLRequestProcessTypeCode" Type="Edm.String" Nullable="true" MaxLength="2" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLRequestProcessTypeCodeCollection"/>
<Property Name="SLRequestSiteName" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLRequestID" Type="Edm.String" Nullable="true" MaxLength="35" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLRequestSiteID" Type="Edm.String" Nullable="true" MaxLength="20" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLRequestLifeCycleStatus" Type="Edm.String" Nullable="true" MaxLength="2" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLRequestLifeCycleStatusCollection"/>
<Property Name="SLRequestReleaseStatus" Type="Edm.String" Nullable="true" MaxLength="2" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLRequestReleaseStatusCollection"/>
<Property Name="SLRequestUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskID" Type="Edm.String" Nullable="true" MaxLength="35" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskStatus" Type="Edm.String" Nullable="true" MaxLength="2" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLTaskStatusCollection"/>
<Property Name="SLTaskLotOpActUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="CreationDateTime" Type="Edm.DateTimeOffset" Nullable="true" Precision="7" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="LastChangeDateTime" Type="Edm.DateTimeOffset" Nullable="true" Precision="7" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskPriorityDescription" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskPriority" Type="Edm.String" Nullable="true" MaxLength="1" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionRootSLTaskPriorityCollection"/>
<NavigationProperty Name="SiteLogisticsTaskDataCollectionSLTaskItems" Relationship="cust.SiteLogisticsTaskDataCollectionRoot_SiteLogisticsTaskDataCollectionSLTaskItems" FromRole="SiteLogisticsTaskDataCollectionRoot" ToRole="SiteLogisticsTaskDataCollectionSLTaskItems"/>
</EntityType>
<EntityType Name="SiteLogisticsTaskDataCollectionSLTaskItems">
<Key>
<PropertyRef Name="ObjectID"/>
</Key>
<Property Name="ObjectID" Type="Edm.String" Nullable="false" MaxLength="70" FixedLength="true" sap:creatable="false" sap:updatable="false" sap:filterable="true"/>
<Property Name="ParentObjectID" Type="Edm.String" Nullable="true" MaxLength="70" FixedLength="true" sap:creatable="true" sap:updatable="false" sap:filterable="true"/>
<Property Name="SLTaskItemSourceLogisticsID" Type="Edm.String" Nullable="true" MaxLength="40" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemSourceLogisticsSiteID" Type="Edm.String" Nullable="true" MaxLength="20" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefSOItemUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemPlannedQuantity" Type="Edm.Decimal" Nullable="true" Precision="31" Scale="14" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="unitCode" Type="Edm.String" Nullable="true" MaxLength="3" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionSLTaskItemsunitCodeCollection"/>
<Property Name="SLTaskItemRefSOItemQuantity" Type="Edm.Decimal" Nullable="true" Precision="31" Scale="14" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="unitCode1" Type="Edm.String" Nullable="true" MaxLength="3" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode1Collection"/>
<Property Name="SLTaskItemTotalConfirmedQuantity" Type="Edm.Decimal" Nullable="true" Precision="31" Scale="14" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="unitCode2" Type="Edm.String" Nullable="true" MaxLength="3" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode2Collection"/>
<Property Name="SLTaskItemRefSLRequestItemQuantity" Type="Edm.Decimal" Nullable="true" Precision="31" Scale="14" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="unitCode3" Type="Edm.String" Nullable="true" MaxLength="3" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode3Collection"/>
<Property Name="SLTaskItemOpenQuantity" Type="Edm.Decimal" Nullable="true" Precision="31" Scale="14" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="unitCode4" Type="Edm.String" Nullable="true" MaxLength="3" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" c4c:value-help="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode4Collection"/>
<Property Name="SLTaskItemProductDescription" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemIDStock" Type="Edm.String" Nullable="true" MaxLength="20" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefSOItemID" Type="Edm.String" Nullable="true" MaxLength="10" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskLotMatOutputUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemMatUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskLotMatInputUUID" Type="Edm.Guid" Nullable="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemProductID" Type="Edm.String" Nullable="true" MaxLength="40" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefItemSOID" Type="Edm.String" Nullable="true" MaxLength="35" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefItemSORequestedDeliveryDate" Type="Edm.DateTime" Nullable="true" Precision="0" sap:creatable="true" sap:updatable="true" sap:filterable="true" sap:display-format="Date"/>
<Property Name="SLTaskItemRefItemSOStoreID" Type="Edm.String" Nullable="true" MaxLength="10" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefItemSOFMFID" Type="Edm.String" Nullable="true" MaxLength="20" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefItemSOFMFName" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<Property Name="SLTaskItemRefItemSOStoreName" Type="Edm.String" Nullable="true" FixedLength="false" sap:creatable="true" sap:updatable="true" sap:filterable="true"/>
<NavigationProperty Name="SiteLogisticsTaskDataCollectionRoot" Relationship="cust.SiteLogisticsTaskDataCollectionRoot_SiteLogisticsTaskDataCollectionSLTaskItems" FromRole="SiteLogisticsTaskDataCollectionSLTaskItems" ToRole="SiteLogisticsTaskDataCollectionRoot"/>
</EntityType>
<EntityType Name="CodeList">
<Key>
<PropertyRef Name="Code"/>
</Key>
<Property Name="Code" Type="Edm.String" Nullable="false" FixedLength="false" sap:creatable="false" sap:updatable="false" sap:filterable="true"/>
<Property Name="Description" Type="Edm.String" Nullable="false" FixedLength="false" sap:creatable="false" sap:updatable="false" sap:filterable="true"/>
</EntityType>
<Association Name="SiteLogisticsTaskDataCollectionRoot_SiteLogisticsTaskDataCollectionSLTaskItems">
<End Type="cust.SiteLogisticsTaskDataCollectionRoot" Multiplicity="1" Role="SiteLogisticsTaskDataCollectionRoot"/>
<End Type="cust.SiteLogisticsTaskDataCollectionSLTaskItems" Multiplicity="*" Role="SiteLogisticsTaskDataCollectionSLTaskItems"/>
</Association>
<EntityContainer Name="readpicktasksdatalatst" m:IsDefaultEntityContainer="true">
<EntitySet Name="SiteLogisticsTaskDataCollectionRootActivityTypeCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootCollection" EntityType="cust.SiteLogisticsTaskDataCollectionRoot" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLRequestLifeCycleStatusCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLRequestProcessTypeCodeCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLRequestProcessingTypeCodeCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLRequestReleaseStatusCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLRequestTypeCodeCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLTaskPriorityCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionRootSLTaskStatusCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsCollection" EntityType="cust.SiteLogisticsTaskDataCollectionSLTaskItems" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode1Collection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode2Collection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode3Collection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsunitCode4Collection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<EntitySet Name="SiteLogisticsTaskDataCollectionSLTaskItemsunitCodeCollection" EntityType="cust.CodeList" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:semantics="fixed-values"/>
<AssociationSet Name="SiteLogisticsTaskDataCollectionRootCollection_SiteLogisticsTaskDataCollectionSLTaskItemsCollection" Association="cust.SiteLogisticsTaskDataCollectionRoot_SiteLogisticsTaskDataCollectionSLTaskItems" sap:creatable="true" sap:updatable="false" sap:deletable="false">
<End EntitySet="SiteLogisticsTaskDataCollectionRootCollection" Role="SiteLogisticsTaskDataCollectionRoot"/>
<End EntitySet="SiteLogisticsTaskDataCollectionSLTaskItemsCollection" Role="SiteLogisticsTaskDataCollectionSLTaskItems"/>
</AssociationSet>
<FunctionImport Name="SiteLogisticsTaskDataCollectionRootQueryByElements" ReturnType="Collection(cust.SiteLogisticsTaskDataCollectionRoot)" EntitySet="SiteLogisticsTaskDataCollectionRootCollection" m:HttpMethod="GET">
<Parameter Name="NumberOfRows" Type="Edm.String" Mode="In"/>
<Parameter Name="StartRow" Type="Edm.String" Mode="In"/>
<Parameter Name="SysAdminData_LastChangeDateTime" Type="Edm.DateTimeOffset" Mode="In" Precision="0"/>
<Parameter Name="ActivityType" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="RefSOID" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="RefSOFMFID" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLTaskStatus" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLRequestLifeCycleStatus" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLRequestReleaseStatus" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLRequestProcessingTypeCode" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLRequestProcessTypeCode" Type="Edm.String" Mode="In" Precision="0"/>
<Parameter Name="SLRequestTypeCode" Type="Edm.String" Mode="In" Precision="0"/>
</FunctionImport>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Regards
Hanumath K
Hi Hanumath,
the following URL should do the job:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootQueryByElements?SLTaskStatus='2'
You can use the http-header-parameter "Accept=application/json" to get a json response ($format=json does not work for function imports).
Thanks, Knut Heusermann . This works. As said earlier our need to use a filter is to get two status-related records at a time. i.e.we would like to look at the data records that consist of both status 1 and 2 from the list.
we tried the below URLs to get the records accordingly but had no luck in getting the desired result.
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootQueryByElements?SLTaskStatus='2' or '1'
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootQueryByElements?SLTaskStatus='2'&SLTaskStatus='1'
In both the above formats the data records are only showing in the result set that has the status 2 but not the records that have 1.
This is our main purpose to use the filter and see if the filter can achieve the desired result in one call rather than doing and getting the result in two different calls.
Is there a format or way that we can use the URL to filter the records having both 1 and 2 as statuses?
Please help here.
Regards,
Hanumath K
Then using entity SiteLogisticsTaskDataCollectionRootCollection and the filter would be the better fit:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootCollection?$format=json&$filter=SLTaskStatus eq '1' or SLTaskStatus eq '2'
Thanks, Knut Heusermann . This worked and this helps a lot.
A couple more clarifications in this regard, in the above URL we can even add other params along with the SLTaskStatus in the filter right?
I mean we wanted to add the Last Changed DateTime as an additional filter and our format is as below and hope this URL will work without issues.
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootCollection?$format=json&$filter=SLTaskStatus eq '1' or SLTaskStatus eq '2' and LastChangeDateTime ge datetime '2022-11-01T00:00:00'
Thanks once again for your responses and guidance on this issue Knut.
Regards
Hanumath K
Hi Knut Heusermann
It would be helpful if you can help with my last comment? For your reference, I am posting the same again below here
_____________________________
A couple more clarifications in this regard, in the above URL we can even add other params along with the SLTaskStatus in the filter right?
I mean we wanted to add the Last Changed DateTime as an additional filter and our format is as below I hope this URL will work without issues.
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/readpicktasksdatalatst/SiteLogisticsTaskDataCollectionRootCollection?$format=json&$filter=SLTaskStatus eq '1' or SLTaskStatus eq '2' and LastChangeDateTime ge datetime '2022-11-01T00:00:00'
Thanks once again for your responses and guidance on this issue Knut.
Regards
Hanumath K
Hi Hanumath,
In general the filter format depends on the property attributes "Type" and "sap:filterable" provided in the OData metadata. In Custom OData Services for business objects the LastChangeDateTime has the data type "Edm.DateTimeOffset" in most cases.
For materials you can for example request all products that has been changed since March 17th using the filter LastChangeDateTime ge datetimeoffset'2022-03-17T00:00:00Z'.
GET https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/vmumaterial/MaterialCollection?$filter=InternalID eq 'P100401' and LastChangeDateTime ge datetimeoffset'2022-03-17T00:00:00Z'&$format=json
If the data type is "Edm.DateTime", then a filter like PARA_CAL_DAY ge datetime'2019-01-01T00:00:00' does the job; for example for report "Invoice Volume":
GET https://myXXXXXX.sapbydesign.com/sap/byd/odata/crm_customerinvoicing_analytics.svc/RPCRMCIVIB_Q0001QueryResults?$format=json&$inlinecount=allpages&$filter=PARA_CAL_DAY ge datetime'2019-01-01T00:00:00'&$top=600
For your specific example, please check the metadata of your custom OData service and test your request in some API test tool such as Postman.
Thanks for all your help and guidance Knut Heusermann . So far everything worked as expected and we are able to continue with the work for the client as required.
Appreciate all your support here in the community and helping the people.
Regards
Hanumath K
Update of master data and sales order samples:
Custom OData service changes:
Postman collection and Postman environment Master Data changed:
=> Check the documentation of the Postman collection Master Data for more details about address snapshots and business document specific address information.
Postman collection Sales and Commerce Scenarios changed:
Hi Knut,
thanks for this great summary!
We are looking for a way to build our organizational structure in another system via ODATA by using the parent-child information. For costcenters this information is available in Data Source: Cost Center Master Data. Is there a way to get such information for the whole org-structure?
We tried to achieve this with khfunctionalunit, khcompany, khbusinessresidence, khcostcentre and khprofitcentre, but couldn't find the superordinate org-unit for all of these.
Thank you & kind regards,
Melanie
Hi Melanie,
Using custom OData services you can read organizational structures along specific roles such as cost centers, reporting line units, functional units, ... only, because the public solution model is designed to deliver the organization structure that serves specific functional areas of a company. Basically, you can include all kind of superordinate org units and with that information re-assemble the org structures as displayed in work center view "Organizational Management - Org Structures".
Additionally, if you can make specific assumption on the org structure (e.g. the number of levels, ...) and adapt the custom OData service to simplify the response structure.
However, to overcome these complexities we are planning a standard OData service in release 23.02 to read ByD organizational structures across org unit roles and functions similar to the representation in work center view "Organizational Management - Org Structures".
An API to create or change ByD organizational structures is not planned as of now.
Best regards,
Knut
Hi Knut,
Thank you for all your work in the API's documentation and examples.
We are looking into use this new introduced organizationalmanagement Odata API.
We can get all the OrgUnits objects but when we try to utilize the AssignedManager.__deferred.uri of the OrgUnits we do not get the actual assigned manager that we see on the Org Unit Details screen under General - Org Unit Manager. For the most we do not get any data
Example uri: https://xxxxxx.sapbydesign.com/sap/byd/odata/v1/organizationalmanagement/OrgUnitCollection('00163E0DDA7F1ED694EDCE017099E53B')/AssignedManager
For all the other __deferred.uri's like Definition, Function and Employee we do get the correct data
Is this not yet implemented in the API or could this be a bug?
Regards,
Ronald van Herk
Hi Ronald,
this looks like a bug; please report the issue via incident.
Best regards,
Knut
Hello @knut.heusermann ,
We are trying to integrate SAP ByDesign with our system. We managed to build a event notification pipeline. Now are receiving UUID of customer invoice but we couldn't find any soap or rest services to fetch invoice. Do you have a API for it?
Also I tried to use one of your APIs but I am getting authorization issues. Where do you set user for these APIs?
Thank you very much in advance.
Best Regards
Hi Emrah,
you can retrieve ByD customer invoices using custom OData services (see example service khcustomerinvoice) or the SOAP service QueryCustomerInvoiceIn.
Your question sounds like you want to retrieve the customer invoice triggered by the event notification message, isn't it?
In this case I would recommend to use a communication user (technical user) to call the custom OData service: Configure a communication arrangement for communication scenario “OData Services for Business Objects” and select the Custom OData Service for customer invoices. In result the communication user configured in the communication arrangement gets the authorization for the Custom OData Service.
Best regards,
Knut
Hi Knut,
This method worked flawlessly thank you very much for the help and your prompt reply.
Best Regards
Hi Knut,
I am trying to do Post Goods Receipt using khinbounddelivery in SAP Data services.
Postman works fine like this:
In SAP Data services, as with Postman, I'm trying to post using a token after taking it, but it doesn't work.
Would you like to give me some advices for creating REST API POST in SAP Data services?
Best regards,
Hi Mikiichi,
maybe you need to fetch additionally the x-csrf-token in the GET-request and add it to the http-header of the POST-request (compare http-headers of the request- and response headers as well as the Test-scripts in my Postman collections).
Do you have some detailed error message in SAP Data services?
Hi Knut,
Thank you for your reply.
I can get the token, but there are two error messages.
One is Malformed URI Literal syntax, and the other is HTTP erro 400.
Could you please give me some advices?
Best regards,
Hi Mikiichi,
The http-code 400 means that the error is on consumer side. The error message "Malformed URI ..." means that the http-request is not correctly formatted from a syntax point of view. I would suggest that you compare the URI used by Postman with the URI used in your SAP Data service flow. This may guide you to the root cause. In case this does not help as well, then please open an incident for SAP Data services.
Hi Knut,
Thank you very much for your quickly reply. I create a new WADL via SOAPUI following your advice and I set it data services. It works well without some error messages.
Some issues remain yet, but they are caused by data services, so I will open an incident for data services.
Best regards,
Hi Knut,
Thanks for your blog.
We have a customer ByD project ongoing, where the scope is to connect the advanced planning & scheduling system (APS) with SAP ByD integration. In detail to the production area.
Could you please confirm, is it possible for SAP ByD to perform a resource exchange for an already existing production order using the web service of the integrations?
I have browsed several SOAP services without success. I've tried building Odata but I can't find the record to edit.
The function should be exactly the same as your colleague in the blog below. But the need would be to use either SOAP or Odata service.
https://blogs.sap.com/2022/02/04/change-resources-in-production-orders/
Br. Niko
Hello Knut,
Thank you for this important information. We are using OData APIS for Reports (analytics).
Following is the url.
https://myXXXXXX.sapbydesign.com/sap/byd/odata/CRM_WOC_SALESORDERS_analytics.svc/RPZ2DD19FB7D50D3D7B22EEA4QueryResults
This url worked in 2022 but now we are facing login error when we are trying to access the report through power BI. Following is the error:
"The credentials provided for the OData are invalid."
I tried by resetting the pwd and relogging in but still facing the same issue. Do we need specific access to get the data? (Developer access) User has sales order reports and analytics access.
Thank you.
Hi Knut,
thank you for this great blog post.
However, I'm trying to get the documents attached to an employee's record, but using the khemployee request, all I get for AttachmentFolder is an empty array. What am I missing?
Hi Gerhard,
the attachment folder in my example "khemployee" refers to the business partner attachment such as for example the employee image.
If you want to get the attachments which you see in work center view "Personnel Administration - Employees" on sheet "Personnel File - Attachments", then you need to create a custom OData service for business object "Employment" and include the employment attachment folder.
Example request:
https://myXXXXXX.businessbydesign.cloud.sap/sap/byd/odata/cust/v1/kh_test/EmploymentCollection?$format=json&$filter=EmployeeID eq 'E0210'&$expand=EmploymentAttachmentFolder
Example response:
Hi Knut,
thank you for pointing me at the "Employment" BO. After fiddling out the required attributes I finally got what I need.
Hi Knut
great work so far! Esp. because ByD needs more and more interaction with other SAP Systems. I'm wondering if it would be possible to create time records based on EmployeeID (not an WorkAgreement) and also directly as approved? We search for a solution for the synchronization from time off periods from our HR system SAP SuccessFactors to ByD and don't need and further approve in ByD. And unfortunately SAP SuccessFactors is only able to make a one Call for each Event. Right now we plan to user the SOAP webservice and Middleware because SAP SuccessFactors only can work with response on a REST (not SOAP) outgoing calls.
Any Idea?
Best
Dimitrij