diff --git a/S4HANA-demo/dataclasses/com/axon/market/s4/hana/demo/demoHANAData.ivyClass b/S4HANA-demo/dataclasses/com/axon/market/s4/hana/demo/demoHANAData.ivyClass index bf1b25e..d57c653 100644 --- a/S4HANA-demo/dataclasses/com/axon/market/s4/hana/demo/demoHANAData.ivyClass +++ b/S4HANA-demo/dataclasses/com/axon/market/s4/hana/demo/demoHANAData.ivyClass @@ -1,3 +1,4 @@ demoHANAData #class com.axon.market.s4.hana.demo #namespace businessPartners java.util.List #field +totalCount Integer #field diff --git a/S4HANA-demo/pom.xml b/S4HANA-demo/pom.xml index d72b8b2..3f23bfd 100644 --- a/S4HANA-demo/pom.xml +++ b/S4HANA-demo/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.axonivy.connector.s4hana s4-hana-demo - 10.0.0-SNAPSHOT + 10.0.19-SNAPSHOT iar diff --git a/S4HANA-demo/processes/demoHANA.p.json b/S4HANA-demo/processes/demoHANA.p.json index 8331414..c65539f 100644 --- a/S4HANA-demo/processes/demoHANA.p.json +++ b/S4HANA-demo/processes/demoHANA.p.json @@ -11,28 +11,27 @@ "config" : { "output" : { "code" : [ - "import java.util.Arrays;", "import com.axon.market.s4hana.client.APIBUSINESSPARTNERAAddressEmailAddressType;", "import com.axon.market.s4hana.client.APIBUSINESSPARTNERABPContactToAddressTypeToEmailAddress;", "import com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerAddressType;", "import com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType;", - "int i =0;", + "import java.util.Arrays;", + "ivy.log.info(\"Total count: {0}\", in.totalCount);", + "int i = 0;", "for (APIBUSINESSPARTNERABusinessPartnerType bp: in.businessPartners) {", - " ivy.log.info(\"BusinessPartners(\"+i+\"):{0}\",String.join(\",\", Arrays.asList(bp.getBusinessPartnerFullName() , bp.getBusinessPartnerCategory() , bp.getBusinessPartnerGrouping() )));", + " ivy.log.info(\"BusinessPartners(\"+i+\"): {0}\", String.join(\",\", Arrays.asList(bp.getBusinessPartnerFullName(), bp.getBusinessPartnerCategory(), bp.getBusinessPartnerGrouping())));", " for (APIBUSINESSPARTNERABusinessPartnerAddressType add: bp.toBusinessPartnerAddress.results) {", + " ivy.log.info(\"Address City {0}: \", add.cityName);", + " if (add.toEmailAddress.results.isEmpty()) {", + " ivy.log.info(\"Empty email\");", + " }", + "", + " for (APIBUSINESSPARTNERAAddressEmailAddressType em: add.toEmailAddress.results) {", + " ivy.log.info(\"Email {0}\",em.emailAddress);", + " }", "", - " ivy.log.info(\" Address {0}\",add.cityName);", - " if (add.toEmailAddress.results.isEmpty()){ ivy.log.info(\" empty email \");}", - " for (APIBUSINESSPARTNERABPContactToAddressTypeToEmailAddress em: add.toEmailAddress.results) {", - " ", - " for (APIBUSINESSPARTNERAAddressEmailAddressType email: em.results) {", - " ivy.log.info(\" email {0}\",(email.emailAddress));", - " }", - " }", - " ", " }", " i++;", - " ", "}" ] } @@ -41,15 +40,17 @@ "at" : { "x" : 400, "y" : 160 }, "size" : { "width" : 128, "height" : 60 } }, - "connect" : { "id" : "f12", "to" : "f10" } + "connect" : { "id" : "f1", "to" : "f0" } }, { "id" : "f8", "type" : "RequestStart", - "name" : "getBusinessPartnersWithEmailAndBank.ivp", + "name" : "getBusinessPartners.ivp", "config" : { - "callSignature" : "getBusinessPartnersWithEmailAndBank", + "callSignature" : "getBusinessPartners", "outLink" : "getBusinessPartnersWithEmailAndBank.ivp", - "tags" : "demo" + "startName" : "Get a list of business partners", + "tags" : "demo", + "case" : { } }, "visual" : { "at" : { "x" : 96, "y" : 160 }, @@ -65,7 +66,8 @@ "output" : { "map" : { "out" : "in", - "out.businessPartners" : "result.businessPartners" + "out.businessPartners" : "result.businessPartners", + "out.totalCount" : "result.totalCount" } }, "call" : { @@ -74,6 +76,7 @@ ], "map" : { "param.request.query.expand" : "[\"to_BusinessPartnerAddress/to_EmailAddress\",\"to_BusinessPartnerBank\",\"to_BuPaIdentification\",\"to_BusinessPartnerContact\",\"to_BusinessPartnerRole\",\"to_Customer\",\"to_Supplier\"]", + "param.request.query.topCount" : "50", "param.request.sapClient" : "200" } } @@ -87,7 +90,28 @@ "id" : "f10", "type" : "TaskEnd", "visual" : { - "at" : { "x" : 528, "y" : 160 } + "at" : { "x" : 720, "y" : 160 } } + }, { + "id" : "f0", + "type" : "DialogCall", + "name" : "BusinessPartnerView", + "config" : { + "dialogId" : "com.axon.market.s4.hana.demo.BusinessPartnerView", + "startMethod" : "start(List)", + "call" : { + "params" : [ + { "name" : "businessPartners", "type" : "List" } + ], + "map" : { + "param.businessPartners" : "in.businessPartners" + } + } + }, + "visual" : { + "at" : { "x" : 585, "y" : 161 }, + "size" : { "width" : 146, "height" : 63 } + }, + "connect" : { "id" : "f2", "to" : "f10" } } ] } \ No newline at end of file diff --git a/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.rddescriptor b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.rddescriptor new file mode 100644 index 0000000..ae605f0 --- /dev/null +++ b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.rddescriptor @@ -0,0 +1,7 @@ + + + + viewTechnology + JSF + + diff --git a/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.xhtml b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.xhtml new file mode 100644 index 0000000..55d7e66 --- /dev/null +++ b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerView.xhtml @@ -0,0 +1,59 @@ + + + + Business Partner View + + +

List of Business Partner

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewData.ivyClass b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewData.ivyClass new file mode 100644 index 0000000..fca15ce --- /dev/null +++ b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewData.ivyClass @@ -0,0 +1,4 @@ +BusinessPartnerViewData #class +com.axon.market.s4.hana.demo.BusinessPartnerView #namespace +businessPartners List #field +businessPartners PERSISTENT #fieldModifier diff --git a/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewProcess.p.json b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewProcess.p.json new file mode 100644 index 0000000..e6c30ed --- /dev/null +++ b/S4HANA-demo/src_hd/com/axon/market/s4/hana/demo/BusinessPartnerView/BusinessPartnerViewProcess.p.json @@ -0,0 +1,52 @@ +{ + "format" : "10.0.0", + "id" : "18FDC5AB53AFDA15", + "kind" : "HTML_DIALOG", + "config" : { + "data" : "com.axon.market.s4.hana.demo.BusinessPartnerView.BusinessPartnerViewData" + }, + "elements" : [ { + "id" : "f0", + "type" : "HtmlDialogStart", + "name" : "start(List)", + "config" : { + "callSignature" : "start", + "input" : { + "params" : [ + { "name" : "businessPartners", "type" : "List" } + ], + "map" : { + "out.businessPartners" : "param.businessPartners" + } + }, + "guid" : "18FDC5AB53C99122" + }, + "visual" : { + "at" : { "x" : 96, "y" : 64 } + }, + "connect" : { "id" : "f2", "to" : "f1" } + }, { + "id" : "f1", + "type" : "HtmlDialogEnd", + "visual" : { + "at" : { "x" : 224, "y" : 64 } + } + }, { + "id" : "f3", + "type" : "HtmlDialogEventStart", + "name" : "close", + "config" : { + "guid" : "18FDC5AB53F884AF" + }, + "visual" : { + "at" : { "x" : 96, "y" : 160 } + }, + "connect" : { "id" : "f5", "to" : "f4" } + }, { + "id" : "f4", + "type" : "HtmlDialogExit", + "visual" : { + "at" : { "x" : 224, "y" : 160 } + } + } ] +} \ No newline at end of file diff --git a/S4HANA-demo/webContent/layouts/frame-10.xhtml b/S4HANA-demo/webContent/layouts/frame-10.xhtml new file mode 100644 index 0000000..caee274 --- /dev/null +++ b/S4HANA-demo/webContent/layouts/frame-10.xhtml @@ -0,0 +1,60 @@ + + + + + + + + + + <ui:insert name="title">Ivy Html Dialog</ui:insert> + + + + + + + + + +
+ + default content + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/S4HANA-demo/webContent/layouts/includes/exception-details.xhtml b/S4HANA-demo/webContent/layouts/includes/exception-details.xhtml new file mode 100644 index 0000000..a4979dc --- /dev/null +++ b/S4HANA-demo/webContent/layouts/includes/exception-details.xhtml @@ -0,0 +1,109 @@ + + + + + + +

+ +

+ + +

Error id

+

#{errorPage.exceptionId}

+

Error Timestamp

+

#{errorPage.createdAt}

+
+ + + + +

Attributes

+
+ + + + + + + + + + + + + + + +
NameValue
+
+
+

Thrown by

+

Process: + +
Element: + +

+
+ + +

Process call stack

+ +
#{caller.callerElement}
+
+
+ +

Technical cause

+
#{causedBy.class.simpleName}: #{causedBy.message.trim()}
+
+
+ +

Request Uri

+

#{errorPage.getRequestUri()}

+
+

Servlet

+

#{errorPage.getServletName()}

+
+ +

Application

+

#{errorPage.applicationName}

+
+ + +

Thread local values

+
+ + + + + + + + + + + + + + + +
KeyValue
+
+
+
+ +

Stack-Trace

+
#{errorPage.getStackTrace()}
+
+ diff --git a/S4HANA-demo/webContent/layouts/includes/exception.xhtml b/S4HANA-demo/webContent/layouts/includes/exception.xhtml new file mode 100644 index 0000000..2303e7c --- /dev/null +++ b/S4HANA-demo/webContent/layouts/includes/exception.xhtml @@ -0,0 +1,47 @@ + + + + + + + + + +
+
+ + +
+ + + + + + + + + +
+ + \ No newline at end of file diff --git a/S4HANA-demo/webContent/layouts/includes/footer.xhtml b/S4HANA-demo/webContent/layouts/includes/footer.xhtml new file mode 100644 index 0000000..3eb052b --- /dev/null +++ b/S4HANA-demo/webContent/layouts/includes/footer.xhtml @@ -0,0 +1,18 @@ + + + +
+ + #{ivyAdvisor.applicationName} + + +
+
+ + \ No newline at end of file diff --git a/S4HANA-demo/webContent/layouts/includes/progress-loader.xhtml b/S4HANA-demo/webContent/layouts/includes/progress-loader.xhtml new file mode 100644 index 0000000..0d68a75 --- /dev/null +++ b/S4HANA-demo/webContent/layouts/includes/progress-loader.xhtml @@ -0,0 +1,15 @@ + + + + +
+
+
Loading...
+
+
+ + + +
+
\ No newline at end of file diff --git a/S4HANA-product/README.md b/S4HANA-product/README.md index 49640f3..49dba3f 100644 --- a/S4HANA-product/README.md +++ b/S4HANA-product/README.md @@ -1,18 +1,33 @@ -# S4HANA +# SAP S/4HANA -This connector shows an easy way to connect to the SAP S4HANA database. - -The focus here is on the business partner domain. In the example, a connection to the database is established and all business partners are listed together with their email addresses. -Please note: In the example, a connection to [SAP Demo API](https://api.sap.com/api/BusinessPartner_APIs/tryout) is established, i.e. it is necessary that you first create an account here. +The SAP S4/HANA connector easily connects to a SAP S/4HANA database. This connector: +- Focuses on the business partner domain +- Establishes a connection to its database to show all business partners together with their email addresses +- Needs a tryout account for the [SAP Demo API](https://api.sap.com/api/API_BUSINESS_PARTNER/tryout) +- Supports you with an easy-to-copy demo implementation to reduce your integration effort ## Demo -Demo tries to connect to SAP and gets list of business partners +This demo example connects to the database of all business partners in SAP S/4HANA. + +1. Start the process "Get list of business partners" +![get-a-list-of-business-partners](images/get-a-list-of-business-partners.png) +2. A list of business partners are displayed in the table +![list-of-business-partners](images/list-of-business-partners.png) ## Setup -Please set the global variables to the SAP needs. Maybe you need to add a certificate to connect to SAP via SSL. +1. Set up a test environment for SAP S/4HANA Business Partner API to get an account containing the host(baseUrl), username, and password. + +2. Set the global variables to SAP's needs. You may need to add a certificate to connect to SAP via SSL. +Add the following `Variables` to your `variables.yaml`: + +- `Variables.s4HanaConnector.baseUrl` +- `Variables.s4HanaConnector.username` +- `Variables.s4HanaConnector.password` + +and replace the values with your given setup. ``` @variables.yaml@ diff --git a/S4HANA-product/images/get-a-list-of-business-partners.png b/S4HANA-product/images/get-a-list-of-business-partners.png new file mode 100644 index 0000000..fa12a1c Binary files /dev/null and b/S4HANA-product/images/get-a-list-of-business-partners.png differ diff --git a/S4HANA-product/images/list-of-business-partners.png b/S4HANA-product/images/list-of-business-partners.png new file mode 100644 index 0000000..5ae41b1 Binary files /dev/null and b/S4HANA-product/images/list-of-business-partners.png differ diff --git a/S4HANA-product/pom.xml b/S4HANA-product/pom.xml index fd8107a..115caa7 100644 --- a/S4HANA-product/pom.xml +++ b/S4HANA-product/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.axonivy.connector.s4hana s4-hana-product - 10.0.0-SNAPSHOT + 10.0.19-SNAPSHOT pom diff --git a/S4HANA-test/pom.xml b/S4HANA-test/pom.xml index 34b89c7..a432afd 100644 --- a/S4HANA-test/pom.xml +++ b/S4HANA-test/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.axonivy.connector.s4hana s4-hana-test - 10.0.0-SNAPSHOT + 10.0.19-SNAPSHOT iar diff --git a/S4HANA/config/rest-clients.yaml b/S4HANA/config/rest-clients.yaml index bdade02..4f1a003 100644 --- a/S4HANA/config/rest-clients.yaml +++ b/S4HANA/config/rest-clients.yaml @@ -1,12 +1,15 @@ RestClients: - HANA_BUSINESS_PARTNER_ (Service for namespace API_BUSINESS_PARTNER): + #This service enables you to create, display, update, and delete data related to Business Partner, Supplier, and Customer with the data provided in a payload, in an API call. This service also supports create deep entity operation and batch processing. + HANA_BUSINESS_PARTNER_ (Business Partner (A2X)): UUID: 319c4c35-df80-4f51-b63e-ade0e8f60a9a - Url: https://{URI}/sap/opu/odata/SAP/API_BUSINESS_PARTNER + Url: https://${ivy.var.s4HanaConnector.baseUrl}/sap/opu/odata/SAP/API_BUSINESS_PARTNER Features: - ch.ivyteam.ivy.rest.client.mapper.JsonFeature - ch.ivyteam.ivy.rest.client.authentication.HttpBasicAuthenticationFeature Properties: JSON.Deserialization.FAIL_ON_UNKNOWN_PROPERTIES: 'false' + username: ${ivy.var.s4HanaConnector.username} + password: ${ivy.var.s4HanaConnector.password} OpenAPI: SpecUrl: file:///C:/Users/hb/git/S4HANA/S4HANA/lib/generated/rest/openapi.json Namespace: com.axon.market.s4hana.client diff --git a/S4HANA/config/variables.yaml b/S4HANA/config/variables.yaml index a486297..1b17e4c 100644 --- a/S4HANA/config/variables.yaml +++ b/S4HANA/config/variables.yaml @@ -1,6 +1,9 @@ # == Variables == Variables: - #first part of URI for Rest Service - SAP4HANA_CONNECTOR_URL: "" - - \ No newline at end of file + s4HanaConnector: + # The first part of URI for Rest Service. E.g. https://${your base Url}/sap/opu/odata/SAP/API_BUSINESS_PARTNER + baseUrl: "" + # The username for Rest Service Authentication + username: "" + # The password for Rest Service Authentication + password: "" \ No newline at end of file diff --git a/S4HANA/dataclasses/com/axon/market/s4/hana/getHANAData.ivyClass b/S4HANA/dataclasses/com/axon/market/s4/hana/getHANAData.ivyClass index 2ec9ab7..5f7a37f 100644 --- a/S4HANA/dataclasses/com/axon/market/s4/hana/getHANAData.ivyClass +++ b/S4HANA/dataclasses/com/axon/market/s4/hana/getHANAData.ivyClass @@ -3,4 +3,4 @@ com.axon.market.s4.hana #namespace businessPartnerRequest hana.bo.BusinessPartnerRequest #field businessPartners java.util.List #field messages List #field -uriPath String #field +totalCount Integer #field diff --git a/S4HANA/lib/generated/rest/jaxRsClient_319c4c35-df80-4f51-b63e-ade0e8f60a9a.jar b/S4HANA/lib/generated/rest/jaxRsClient_319c4c35-df80-4f51-b63e-ade0e8f60a9a.jar index 5f4c723..11019bb 100644 Binary files a/S4HANA/lib/generated/rest/jaxRsClient_319c4c35-df80-4f51-b63e-ade0e8f60a9a.jar and b/S4HANA/lib/generated/rest/jaxRsClient_319c4c35-df80-4f51-b63e-ade0e8f60a9a.jar differ diff --git a/S4HANA/pom.xml b/S4HANA/pom.xml index 47affe5..91e8f20 100644 --- a/S4HANA/pom.xml +++ b/S4HANA/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.axonivy.connector.s4hana s4-hana-connector - 10.0.0-SNAPSHOT + 10.0.19-SNAPSHOT iar diff --git a/S4HANA/processes/getHANA.p.json b/S4HANA/processes/getHANA.p.json index 7b5fd58..0e12309 100644 --- a/S4HANA/processes/getHANA.p.json +++ b/S4HANA/processes/getHANA.p.json @@ -8,6 +8,7 @@ "elements" : [ { "id" : "f7", "type" : "RestClientCall", + "name" : "Get list of business partners", "config" : { "path" : "/A_BusinessPartner", "headers" : { @@ -28,12 +29,10 @@ }, "statusErrorCode" : "ivy:error:rest:client", "responseMapping" : { - "out.businessPartners" : "result.d.results as List" + "out.businessPartners" : "result.d.results as List", + "out.totalCount" : "Integer.parseInt(result.d.count)" }, - "templateParams" : { - "URI" : "in.uriPath" - }, - "resultType" : "com.axon.market.s4hana.client.Wrapper9" + "resultType" : "com.axon.market.s4hana.client.Wrapper23" }, "visual" : { "at" : { "x" : 352, "y" : 192 } @@ -50,9 +49,9 @@ } }, "visual" : { - "at" : { "x" : 384, "y" : 224 } + "at" : { "x" : 408, "y" : 226 } }, - "connect" : { "id" : "f12", "to" : "f9", "via" : [ { "x" : 480, "y" : 224 }, { "x" : 496, "y" : 192 } ] } + "connect" : { "id" : "f12", "to" : "f9", "via" : [ { "x" : 560, "y" : 226 } ] } } ], "connect" : { "id" : "f13", "to" : "f9" } }, { @@ -66,16 +65,17 @@ { "name" : "request", "type" : "hana.bo.BusinessPartnerRequest" } ], "map" : { - "out.businessPartnerRequest" : "param.request", - "out.uriPath" : "ivy.var.SAP4HANA_CONNECTOR_URL" + "out.businessPartnerRequest" : "param.request" } }, "result" : { "params" : [ - { "name" : "businessPartners", "type" : "java.util.List" } + { "name" : "businessPartners", "type" : "java.util.List" }, + { "name" : "totalCount", "type" : "Integer" } ], "map" : { - "result.businessPartners" : "in.businessPartners" + "result.businessPartners" : "in.businessPartners", + "result.totalCount" : "in.totalCount" } } }, diff --git a/pom.xml b/pom.xml index 298ddbd..0a77131 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.axonivy.market S4HANA s4-hana-modules - 10.0.0-SNAPSHOT + 10.0.19-SNAPSHOT pom