2

SAP Business ByDesign - OData API Examples

 7 months ago
source link: https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/sap-business-bydesign-odata-api-examples/ba-p/13400614
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎02-27-2019 9:34 AM

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 GitHubSAP 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)":
  1. 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.
  2. Open the Postman Runner and select the collection "Master Data", the collection folder "Service Product (write)" and the environment "Master Data":
    2019-09-27_11-29-30.png
  3. Click on "Run Service Product (write)" and see the process flow:
    2019-09-27_11-31-49.png
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

112 Comments
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎03-05-2019 10:08 AM

Update of API sample package "End-to-End Scenarios":
  • Sample OData service tmserviceorder.xml enhanced by service order lifecycle status
  • Scenario "Drop Shipment": SOAP request to create third-party delivery notification replaced by corresponding OData request.
  • Scenario "Procure to Stock": Request "Accept supplier invoice exception" removed (not needed after ByD update to SP02)

‎03-05-2019 1:16 PM

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.
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎03-06-2019 3:08 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎03-06-2019 3:31 PM

Update of API sample package “Projects”: Added a sample Custom OData Service and corresponding Postman OData requests to create and read project time recordings.

‎04-04-2019 4:51 PM

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.
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎04-08-2019 4:05 PM

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
greg_neilson

greg_neilson

Explorer

‎04-30-2019 4:04 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎05-02-2019 1:04 PM

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:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:glob1="http://sap.com/xi/AP/Globalization">
    <soapenv:Header/>
    <soapenv:Body>
        <glob:CustomerInvoiceRequestBundleMaintainRequest_sync>
            <BusinessDocumentBasicMessageHeader>
                <!-- Enter message header UUID for idem potency! -->
                <!-- <UUID>?</UUID> -->
            </BusinessDocumentBasicMessageHeader>
            <CustomerInvoiceRequest actionCode="01" itemListCompleteTransmissionIndicator="false">
                <ObjectNodeSenderTechnicalID>HDR_1</ObjectNodeSenderTechnicalID>
                <BaseBusinessTransactionDocumentID>{{CustomerInvoiceRequestID}}</BaseBusinessTransactionDocumentID>
                <Name>My customer invoice with external payment</Name>
                <!-- SettlementPriorityCode: 
                 1 = Immediate - create custom invoice, 
                 2 = Urgent - stop if a down payment exists
                 3 = Normal - save invoice request with status "to be invoiced" -->
                <SettlementPriorityCode>1</SettlementPriorityCode>
                <ReferenceBusinessTransactionDocumentID>{{InvoiceRequestExternalReference}}</ReferenceBusinessTransactionDocumentID> <!-- External Reference -->
                <BuyerParty>
                    <InternalID>{{CustomerID}}</InternalID>
                </BuyerParty>
                <SalesUnitParty>
                    <InternalID>{{SalesUnitID}}</InternalID>
                </SalesUnitParty>
                <CashDiscountTerms>
                    <!-- 1001 = immediately net; 1006 = 10 days 5% -->
                    <Code>1001</Code>
                    <!-- <FullPaymentEndDate>2019-05-30</FullPaymentEndDate> -->
                </CashDiscountTerms>
                <PaymentControl>
                    <!-- PaymentFormCode: 04 = Direct Debit, 20 = External Payment -->
                    <PaymentFormCode>20</PaymentFormCode>
                    <PaymentReferenceID>{{PaymentReferenceID}}</PaymentReferenceID>
                    <!-- used to clear the payment -->
                    <PaymentReferenceTypeCode>5</PaymentReferenceTypeCode>
                    <PaymentServiceSubscriberID>{{CompanyID}}</PaymentServiceSubscriberID>
                    <PaymentServiceCustomerID>{{CustomerID}}</PaymentServiceCustomerID>
                    <ExternalPayment actionCode="01">
                        <!-- <UUID>?</UUID> -->
                        <!-- Bank Account ID from UI screen My Bank >> View All >> Bank Accounts -->
                        <HouseBankAccountKeyInternalID>{{HouseBankAccountID}}</HouseBankAccountKeyInternalID>
                        <!-- House bank: 1000644 - ABN AMRO Bank -->
                        <PaymentTransactionReferenceID>{{PaymentTransactionReferenceID}}</PaymentTransactionReferenceID>
                        <DocumentDate>{{DocumentDate}}</DocumentDate>
                        <ValueDate>{{ValueDate}}</ValueDate>
                        <Amount currencyCode="USD">220</Amount>
                    </ExternalPayment>
                </PaymentControl>
                <PricingTerms>
                    <!-- PricingProcedureCode: PPGP02 = Standard Gross Procedure, PPSTD1 = Standard Procedure -->
                    <PricingProcedureCode>PPGP02</PricingProcedureCode>
                    <CurrencyCode>USD</CurrencyCode>
                </PricingTerms>
<!-- Invoice item | service product | tax code derived by system -->
                <Item>
                    <BaseBusinessTransactionDocumentItemID>10</BaseBusinessTransactionDocumentItemID>
                    <!-- ReceivablesPropertyMovementDirectionCode: 1 = Invoice item, 2 = Credit memo item -->
                 <ReceivablesPropertyMovementDirectionCode>2</ReceivablesPropertyMovementDirectionCode>
                    <!-- <Description languageCode="EN">My invoice item</Description> -->
                    <CashDiscountDeductibleIndicator>false</CashDiscountDeductibleIndicator>
                    <Product>
                        <InternalID>{{ServiceProductID2}}</InternalID>
                        <TypeCode>2</TypeCode>
                    </Product>
                    <Quantity unitCode="HUR">10</Quantity>
                    <QuantityTypeCode>TIME</QuantityTypeCode>
                    <PriceAndTax>
                        <!-- List Price -->
                        <PriceComponent>
                            <!-- TypeCode: 8PR1 = Gross list price, 7PR1 = Net list price -->
                            <TypeCode>8PR1</TypeCode>
                            <Rate>
                                <DecimalValue>120</DecimalValue>
                                <CurrencyCode>USD</CurrencyCode>
                                <BaseDecimalValue>10</BaseDecimalValue>
                                <BaseMeasureUnitCode>HUR</BaseMeasureUnitCode>
                            </Rate>
                        </PriceComponent>
                    </PriceAndTax>
                    <ObjectNodeSenderTechnicalID>ITM_1</ObjectNodeSenderTechnicalID>
                </Item>
<!-- Invoice item | free text -->
                <Item>
                    <BaseBusinessTransactionDocumentItemID>20</BaseBusinessTransactionDocumentItemID>
                    <ReceivablesPropertyMovementDirectionCode>2</ReceivablesPropertyMovementDirectionCode>
                    <Description languageCode="EN">My free text invoice item</Description>
                    <CashDiscountDeductibleIndicator>false</CashDiscountDeductibleIndicator>
                    <Quantity unitCode="EA">1</Quantity>
                    <QuantityTypeCode>EA</QuantityTypeCode>
                    <PriceAndTax>
                        <!-- List Price -->
                        <PriceComponent>
                            <TypeCode>8PR1</TypeCode>
                            <Rate>
                                <DecimalValue>100.00</DecimalValue>
                                <CurrencyCode>USD</CurrencyCode>
                            </Rate>
                        </PriceComponent>
                    </PriceAndTax>
                    <ProductTaxDetails>
                        <ProductTaxationCharacteristicsCode listID="US">500</ProductTaxationCharacteristicsCode>
                    </ProductTaxDetails>
                    <AccountingCodingBlockAssignment>
                        <AccountingCodingBlock>
                            <AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode>
                            <GeneralLedgerAccountAliasCode>A-1700</GeneralLedgerAccountAliasCode>
                        </AccountingCodingBlock>
                    </AccountingCodingBlockAssignment>
                    <ObjectNodeSenderTechnicalID>ITM_2</ObjectNodeSenderTechnicalID>
                </Item>
            </CustomerInvoiceRequest>
        </glob:CustomerInvoiceRequestBundleMaintainRequest_sync>
    </soapenv:Body>
</soapenv:Envelope>

Best regards,
Knut
greg_neilson

greg_neilson

Explorer

‎07-29-2019 2:47 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎07-31-2019 9:27 AM

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
greg_neilson

greg_neilson

Explorer

‎08-19-2019 10:33 AM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎08-26-2019 9:07 AM

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
jasmin_schaad

jasmin_schaad

Explorer

‎09-10-2019 4:01 PM

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?
2019-09-10-17_00_10-Service-Order_-781-SAP-Business-ByDesign.png
Thank you and best regards
Jasmin
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-12-2019 8:14 AM

Hi Jasmin,

please do the following:

  1. Add the node Root/TextCollection/Text to the service order OData service. As result you get a collection “ServiceOrderText” (I renamed it to “Text”) in the OData service.
  2. Now you can create, update and read the incident description using this collection. The text referring to the incident description has TypeCode “10006”.

Text TypeCodes:

  • Incident description: 10006
  • Customer Information: 10024
  • Internal Comment: 10011

Best regards,
Knut

knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-12-2019 8:27 AM

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 🙂
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-26-2019 3:54 PM

Update: Today I uploaded a new version of API sample packages to the GitHub repository:

  • I restructured the repository to simplify installation and configuration.
  • Refactored and new sample OData services for master data incl. organisational structures, employees, business partners, customer, suppliers, employees, positions, materials and service products
  • Enhanced sample OData services for sales order, customer invoice request, customer invoices, …
  • New examples to order services and procure services
  • New examples to sell products from stock with external payment
  • New examples to process customer returns
  • New examples to pre-confirm payments using clearing house statements
  • New examples to confirm payments and clear open items using bank statements
  • New examples to create and process invoices with external payment
  • New examples to create sales orders with external prices, discounts and surcharges
  • New examples to access the payment monitor
  • Correction of supplier invoice examples to post invoices
opaavola

opaavola

Explorer

‎11-04-2019 1:04 PM

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
former_member605786

former_member605786

Participant

‎11-18-2019 8:16 AM

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
CustomerInvoiceRequestBundleMaintainRequest_sync

Thanks,

Chester
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎11-22-2019 9:11 AM

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
opaavola

opaavola

Explorer

‎12-17-2019 8:47 AM

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
former_member635722

former_member635722

Discoverer

‎01-13-2020 12:58 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎01-13-2020 4:51 PM

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
opaavola

opaavola

Explorer

‎02-04-2020 9:00 AM

Hi Knut,

it seems that SAP development team is not able to open required BO object:
"We have analyzed the issue and discussed the issue with our Development team and due to technical reasons we cannot write enabled the BO".
This is quite an issue here as electronical banking is business as usual in nordic countries. Could we maybe have a sit down regarding this issue?

‎02-04-2020 9:58 AM

Hi Knut,

We are currently implementing mass data upload with ODATA.

We create Custom BO and Custom Odata Service.
2020-02-04-164456-1.jpg
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

‎02-06-2020 4:10 AM

We solved this issue.

We changed some contents in body.
ronald_vanherk

ronald_vanherk

Explorer

‎05-06-2020 1:13 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎05-07-2020 3:27 PM

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:
  • Mandatory elements are PlannedCostAmount and PlannedPeriod.
  • Make sure you added task plan data (e.g. planned expenses) before adding period plans because otherwise the period plans cannot be propagated and aggregated to upper levels correctly.
    Take into account that you have to schedule the task as well.
  • The sum (total amount) of all task expense period plan items needs to match the task expense amount. If this is not the case, then the system creates an additional period plan item with the remaining amount (this item is marked by the element Indicator - so I would suggest to add this element to the OData service as well).
  • The Description of period plans is not mandatory, but might be important from a business semantics point of view.
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
ronald_vanherk

ronald_vanherk

Explorer

‎05-13-2020 3:47 PM

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
ronald_vanherk

ronald_vanherk

Explorer

‎05-15-2020 9:53 AM

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
avanoyen

avanoyen

Explorer

‎06-24-2020 10:00 AM

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

‎08-04-2020 5:57 AM

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.
1596515817310.jpg
This is the Error message from K2 software.
1596516124373.jpg
Could you have any idea? Or Is it possible we can fix metadata of OData API for Reports?

Thanks & Regards

Warut
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎08-17-2020 9:45 PM

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
kla-btk

kla-btk

Discoverer

‎10-19-2020 3:42 PM

Hallo Knut,

is there a chance to get an example for creating a customer invoice in the Github-Repo?
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-26-2020 5:47 PM

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
pascal_markwald

pascal_markwald

Explorer

‎03-26-2021 12:43 PM

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
YanGerzon

YanGerzon

Participant

‎08-21-2021 10:28 AM

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:

<ContactPerson actionCode="01" workplaceTelephoneListCompleteTransmissionIndicator="true">
                <DefaultContactPersonIndicator>true</DefaultContactPersonIndicator>
                <FamilyName>name</FamilyName>
                <GivenName>lastname</GivenName>
                <WorkplaceEmailURI>[email protected]</WorkplaceEmailURI>
                <WorkplaceFacsimileFormattedNumberDescription>fax number</WorkplaceFacsimileFormattedNumberDescription>
                <WorkplaceTelephone>
                    <FormattedNumberDescription>phonenumber</FormattedNumberDescription>
                </WorkplaceTelephone>
            </ContactPerson>

Like i wrote above, this all works except the email.
thank you.

knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-02-2021 10:38 AM

Hi Yan,

thanks for bringing up this - looks like a bug. Could you please raise a ByD incident?

Thanks and best regards,
Knut
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-02-2021 10:47 AM

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
YanGerzon

YanGerzon

Participant

‎09-09-2021 6:05 AM

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

knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-09-2021 7:58 AM

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.
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎09-10-2021 4:26 PM

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".

carlonnheim

carlonnheim

Participant

‎10-03-2021 3:11 PM

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".
postman.jpg
We have noticed that adding a note to the account before running this request makes the problem disappear, like this.
addnote.jpg
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.
textcollection.jpg
Have you seen this issue before, any advice?

Thanks!

//Carl
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-04-2021 1:32 PM

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
docly

docly

Explorer

‎10-04-2021 8:24 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-06-2021 5:28 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-06-2021 5:33 PM

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.
docly

docly

Explorer

‎10-07-2021 3:05 PM

PriceAndTaxCalculation.jpg
ItemPriceAndCalculation nodes

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

knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-07-2021 3:31 PM

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
former_member765205

former_member765205

Discoverer

‎10-19-2021 1:24 PM

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
knutheusermann

Product and Topic Expertknutheusermann

Product and Topic Expert

‎10-20-2021 10:02 AM

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

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK