Skip to Content
Author's profile photo Former Member

E2E: BOPF-SADL-GW-SAPUI5 – Introduction

What a nasty title! Welcome the happy few keeping at it.

This series is about the creation of the ABAP backend based on Business Object Processing Framework (BOPF), Service Adaptation Description Language (SADL) and SAP Gateway (GW) for an UI application. As it describes also the creation of a SAPUI5 application it is an end to end (E2E) scenario. The latter one targets ABAP developers who are curious to see how their service is used in an UI. Experienced UI developers will rather be bored by this part and should just skip it.

Jens showed in his blog series ** TEAM FPM ** – How to Create Beautiful Apps on BOPF Objects: Simple, without Code and Deploying Latest Features (I) how easy it is to create FPM Applications if you are using the service adaptation engine with a BOPF model. Jens’ sample is more or less the application we are targeting for but using SAPUI5.

Tired of all those frameworks and buzz words, why should you read this blog about just another end to end example? This blog describes a construction area in 7.40 – a productive one. In the next release you will see a tighter integration of CDS and BOPF and the stack then must read BOPF/CDS-SADL-GW-SAPUI5. So it is not only interesting for the confirmed fans of BOPF but for all who are planning a new ABAP based project. ABAP and the Suite are going this way.

Agenda

  1. Introduction – describing which application I want to build
  2. Mapping an Entity Set – describing how to create an entity set based on a CDS view related to the BOPF model
  3. Implicit View Building – describing how to create an entity set based on a BOPF node taking advantage of the BOPF 0…1 associations
  4. Mapping Associations – describing how to use BOPF associations to link entity sets
  5. Modifying associated data – describing how to create and update data related via associations
  6. Enhancing Entity Types – describing how to add new properties to an entity type
  7. Back and Forth – resuming the most important topics and looking ahead

Prerequisites and Limitations

To follow this series it is advantageous to have a basic understanding of BOPF and Gateway. In addition some knowledge about Java Script and SAPUI5 is not an obstacle. This is not an introduction to none of them.

I’m also not going to discuss service modelling issues. You may question the granularity of the service or the entity sets I’m going to use. There is certainly a lot to argue. But I want to show the advantages of the BOPF – GW integration using the Service Adaptation Engine. A reasonable understandable example answers my purpose.

I’m using features available in NetWeaver 7.40 SP11 and the related Business Suite EHP support package. The example requires the SAPUI5 libraries 1.26.2 minimum.

Introduction

OData services should be built with an application in mind. The application I’m targeting for is the maintenance of products. The UI should be alike the sketch below:

TargetUI.png

We start with a list of categories. Selecting a category searches all products assigned to the selected category. Selecting a product displays the product details including information about the supplier of the product. On the detail page you can edit product or supplier details. So more or less the same application, Jens has built in his blog.

The video shows our target application.

The BOPF – EPM data model

The UI application requires the Product and Business Partner business objects. I will use the demo business objects  /BOBF/EPM_PRODUCT and /BOPF/EPM_BP. Let’s just have look on what they are offering.

The following video introduces the BOPF data model as well.

dataModel.png

We have two business objects: the product and business partner. The product has two nodes, the ROOT and the PRODUCT_NAME nodes. The product root node consists of attributes like ID, category, supplier ID, price and so on. The product name and description is language dependent, so we find a language composition. This is a special kind of composition: it is a 1:0..n relationship, but during runtime it is filtered by the logon language per default. So it appears to be a 1: 0 ..1 relationship.

languageAssoc.PNG

The business partner ROOT node consists of attributes like ID, company name, legal form. As a company may have several addresses we have a composition to addresses. In the ADDRESS node we find attributes like country, city, e-mail address and so on.

In the UI application we do not want to display all addresses of a supplier, but only one. Fortunately the model offers a foreign key association to the main address: exactly what we are looking for.

addrAssoc.PNG

Both BOs are linked via a foreign key association from the product ROOT to the business partner ROOT

BPAssoc.PNG

So overall this is the cutaway from the BOPF EPM data model we are going to use in this blog.

Want to learn more about BOPF? Go to the BOPF SCN Sitemap. To create the BOPF objects see the tutorials Getting Started with Business Object Processing Framework and Defining Associations with Business Object Builder eXpert.

The Gateway Entity Sets

Knowing the target UI and having an idea to which objects the request can be mapped, we deduce following entity sets for the OData service:

UIModel.png

The category list will be provisioned by an entity set Categories. The product list and product details work with an entity set Products and last but not least the supplier details are using the BusinesPartner entity set.

Now we have to bring these models together with the BOPF one. This is the target of the next step: Mapping an Entity Set.

Need for some background, visit the spaces BOPF Application Framework, SAP Gateway or SAPUI5 Developer Center.

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Christian Drumm
      Christian Drumm

      Hi Thea,

      nice tutorial.

      Do you know in which releases the BOPF-EPM model is available? I couldn't find it in the systems I've got access to (NW 7.40 SP9).

      Christian

      Author's profile photo Tilmann David Kopp
      Tilmann David Kopp

      Hello Christian,

      the EPM model is available in all future relases. Apart from that we're intending to deliver it via upcoming SP, more information will be announced on the SCN.

      Best regards

      Tilmann

      Author's profile photo Joseph Manjiyil
      Joseph Manjiyil

      Hi Thea,

      I created custom gateway service on business object (/SCMTMS/TOR) from SEGW transaction using GBI. I'm on TM 9.2 NW 740 SP10. I'm able to see the metadata of service on /IWFND/GW_CLIENT. I followed the 3 SIMPLE STEPS TO EXPOSE ANY BOPF BO AS ODATA SERVICE to create gateway service. But I'm not able to perform the entity testing. I get the error 'resource not found for segment'. Is there any guide which tells how to call the service created using GBI and test the same? Most blogs found online, tells how to test gateway service created on abap tables. I was able to create and test the same successfully. But I need guidance on testing service created using GBI. Any help is greatly appreciated.

      Regards,

      Joseph M

      Author's profile photo Former Member
      Former Member

      Hi Joseph,

      You get this error because: the service entry maintained for ur odata service in table: /bopf/gbi_cust table is different than your odata technical external name.So, check in the table: what data is maintained. If it is different, overwrite the data model again with version other previous(2 if its 1 before). Put the debugger in service: DPC superclass: get_entityset method where it reads service name and select query. You will understand why it dint fetch any segment for your service.  i guess it will help you.

      Author's profile photo Attila Berencsi
      Attila Berencsi

      Dear  Thea, Community members.

      Could you please tell, what is the way of managing drafts using BOPF and OData? When User switch to edit mode within a UI5 application to edit a BO, a draft version is to be created of the BO. How this can be achived using the above intergartion process ? Do we manage two different entities Product and ProductDraft ? How is the draft managed by BOPF ?

      Thank you, Attila

      Author's profile photo Tilmann David Kopp
      Tilmann David Kopp

      Hello Attila,

      we're currently working on that topic and we will release more information about that in the near future. So please check the BOPF SCN page for updates (http://scn.sap.com/community/abap/bopf).

      Best regards
      Tilmann

      Author's profile photo Attila Berencsi
      Attila Berencsi

      Hello Tilmann,

      thank you. Will that feature provided by the BOPF itself, or managed within the confines of the GateWay Business Object Integration ?
      At the moment as workaround being on NW GW 74 sp11 and SAP Basis 740 sp5, I'm using the class /BOFU/CL_GBI_ADAPTER, which manage CRUDQ operations.

      But to switch the BO to edit mode through UI5 apps and GateWay(with no ABAP session memory between user interactions) I need to copy or create a snapshot of the BO before the user starts changing, to be able to restore it, when the user decides to cancel.

      Is there a feature provided by BOPF to copy existing BO instances, or snapshots, which can be restored? Of course  saving the transaction is necessary, because everything is stateless between user interacions due Odata and REST.

      Thank you, Attila

      Author's profile photo Tilmann David Kopp
      Tilmann David Kopp

      Hello Attila,

      we do not have delivered a reuse functionality to copy a BO instance yet, however it is possible to implement a generic instance copy function that would work generically for all BOPF BOs. In principle, you have to use the BOPF configuration object to get all compositions of the desired BO and traverse them by the help of a recursion. If you need help for developing that, please contact me.

      Best regards

      Tilmann

      Author's profile photo Ivo Vollrath
      Ivo Vollrath

      Hello Attila,

      in addition to Tilmann's reply I would like to point out that the draft support of 7.50 is based on the following runtime stack:

      Gateway -> generic SADL data provider -> BOPF.

      The primary design time is CDS, but currently there is still some SEGW and BOBX/BOPF-in-Eclipse modelling involved.

      In particular (and I think this relates to your question) there is no GBI involved. Maybe someone from GBI can tell more about drafts with GBI.

      With regard to your initial question: Product and ProductDraft would not be seperate entities. There is only one entity and there are indicators identifying drafts and active documents.

      Draft instances are strictly managed by BOPF while there are ways to delegate to legacy APIs for active instances (for which a BOPF does not have to exist). This is where the copy functionality which Tilmann mentioned comes into the game.

      Some first information about the Draft programming model was shown on TechEd 2015. In the post ABAP@SAP TechEd 2015 look for DEV106. Following the links to the Las Vegas session you might be able to access the session PDFs. (Requires registration - I have not tried it on my own.)

      Kind Regards,

      Ivo

      Author's profile photo Simon Gaudek
      Simon Gaudek

      Hi Ivo,

      Draft instances are strictly managed by BOPF while there are ways to delegate to legacy APIs for active instances (for which a BOPF does not have to exist).

      So this means, that the draft mechanism is also available for BOs which are stored in a custom table and are accessed with a custom data access class?

      Author's profile photo Ivo Vollrath
      Ivo Vollrath

      Hi Simon,

      Simon Perstorfer wrote:

      So this means, that the draft mechanism is also available for BOs which are stored in a custom table and are accessed with a custom data access class?

      sort of.

      It does not make much sense to selectively go into implementation details here. Please refer to Tilmann's first reply and be patient for more information to become available.

      Attila wanted to know how his current "workaround" relates to the upcoming draft infrastructure. I tried to answer this question because I felt it might have an influence on his current development. However, we cannot start explaining more details via Q&A without first having some self-contained information available for reference.

      Kind Regards,

      Ivo

      Author's profile photo Attila Berencsi
      Attila Berencsi

      Hello Tilmann, Hello Ivo,

      thanks for your supporting answers. I've checked the TecheEd slides. I'm working on a development on our custom data model, and use database tables generated by BOPF. All logic is implemented within the BO by the interfaces provided by the framework. The upcoming Draft concept by BOPF can reduce the implementation time in such cases, which is good news to be able to use it via SADL. At customer side, we need to save the data into our custom data model managed by BOPF in advance, to be able to drive the standard good old BAPIs with the data saved, when we execute an action like, submit, post etc. For development perspective having the BO structure dispalyed is very transparent, and it is easy to get an overview and access each entity in the BO in design time simply jumping into the hook methods and put our logic. I understood how-to build our custom BO based on the slides, to be nearest to the upcoming draft concept released. I see the requirements technically,like considerations when implementing checks etc.  At the moment I'll define an alternative key for our BO including the Darft flag and the document ID, and access the data through OData using the alternative key. Such way I can have drafts of the same document having one BO and one OData entity. I'll copy the BO recursively externally, but with the upcoming draft concept and BOPF interfaces and draft tables it can be internally within the BO lateron. That is great. Thank you for your proposals and help!

      Attila