Friday 30 June 2023

SAP S/4HANA Cloud, public edition, ABAP Environment Case 5: Purchase Requisition Mass Upload

This is a detailed step-by-step technical guide document to introduce a Developer Extensibility case followed by this blog.

1. Case Background:


In this case, we create an custom Fiori application, which can create multiple purchase requisitions from an Excel file template. Furthermore, you can define the upload template based on your own requirement.

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials

2. Backend Service Development:


2.1 Create Database Table

To save the data uploaded from the Excel file, we first create a database table:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Define a new table to save the data uploaded from Excel file

2.2 Create CDS Data Model

Create CDS view on top of the database table, as the first layer to interact with database, configure different functions for the required fields through Annotations.

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Create new data definition

Then we create a projection view on top of the interface CDS View created from the previous step, as an independent functional layer, we can filter specific fields.

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Projection View

2.3 Create Behavior Definition

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Behavior Definition

And then create behavior implementation class. When user clicks on “Create Purchase Requisition” button, it will trigger event CREATE_PR, and create the purchase requisition through EML.

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Implementation Class

2.4 Create Service Definition and Service Binding

Right click the Projection View, we create a new service definition. We can choose which entity will be exposed to the service. As we only have one entity, so we use the system generated code.

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
New Service Definition

Then create service binding by right clicking on the service definition:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
New Service Binding

After publishing, we can preview the service:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials

3. Frontend App Development


Open SAP Business Application Studio service:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
SAP Business Application Studio

Choose SAP Fiori Worklist Application:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
SAP Fiori Worklist Application

Choose the service we created earlier:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials

And here is the file structure created for the App:

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials

SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials
Excel file upload function

It’s also worthwhile to mention that, we have a pre-delivered package on SAP Intelligent Robotic Process Automation Store, which also create purchase requisition from local Excel files.

However, the technical implementations are different for these two approaches, In our case, we use the Business Object Interface only released for Developer Extensibility; for iRPA, it use the public release API. We can’t say one approach is better than the other, we will have to choose the suitable one based on circumstances we have.


SAP ABAP, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Materials

No comments:

Post a Comment