Here, we are going to explain the creation of draft capable custom SAP UI5 application.
Prerequisite: Please visit my previous blog post for overview of the functionality and to know the steps that you need to follow for backend designing.
Let’s start the backend development:
- Since we have taken sales order scenario, so first we have created two custom ZTable for Header and line item details.
- Next, we have created Basic CDS view on top of the both tables.
- On top of the above created CDS views we have created an interface view in which, we have enabled the draft functionality and the transactional processing and also, we have provided association of item CDS to header CDS.
Here, @ObjectModel annotations is used to provide the draft & transactional capabilities to the CDS view. This view is having the draft capabilities and the draft table will be auto generated when the view is activated.
To check BO object has been created or not, just hover on the header CDS view, where the “transactionalProcessingEnabled” is set as true.
Then click on the Business Object, which will navigate to the Business Object Overview Page.
After this, click on the “Go to the ROOT node”.
Inside the draft class, we have redefined one method.
In this method we have written logic to convert draft data into active data(database).
In our previous blog post, we have mentioned that at root node level some actions will get generated to implement draft functionality and there we can write our own logic too.
So, to implement delete functionality (Delete instances of the active document), we have redefined one of the methods in the delete class.
How to find delete class name?
In the node overview page, Go to the action tab.
To implement locking mechanism in our app, we have redefined one of the methods of the lock class.
- Now the next step, we have created consumption view on top of the header interface view and provide OData annotation, which will automatically create OData service.
- Then, the last step is to register the OData service in your system.
Transaction : /n/IWFND/MAINT_SERVICE
Using the above mentioned tcode, we have registered our OData service and then the service will be available to be used by the webide to generate the application.
So, this is how we have developed our backend.
For more information regarding back-end creation, please visit the below link: