Introduction: This Blog is to show S/4 hana fiori transactional app data validations with FIORI ELEMENT Template and CDS -BOPF framework.This covers CDS creation, app crud operations(transactional behaviour), Odata Publish withannotations and Odata registration to be used in front end. Required SAP landscape prerequisites are Eclipse ADT, WebIDE, S/4 HANA On-Premise with SAP_GWFND and SAP_UI components.
Main Part : The below steps are required to perform data validations with BOPF framework in S/4 HANA app.
Step 1 ) In Eclipse ADT, Create consumption and interface CDS on existing database table and publish consumption CDS as Odata service with Odata annotation to be used in fiori app.In this scenario, ztfitx_tier is esixting table in S/4 HANA.
@OData.publish: true annotation takes care of publishing CDS as a Odata service.
BOPF annotations : Enables create, delete and modify operations in fiori element app and needs to be used as below in CDS.
@ObjectModel.transaction Processing Delegated: true
Step 2): Maintain Odata service with transaction code /IWFND/MAINT_SERVICE with below steps:
Step 3): Test Odata service with sap gateway client button with transaction code /IWFND/MAINT_SERVICE as below.
Objectmodel annotations(@ObjectModel in CDS) generates bopf object as below in eclipse adt under bopf node and can see with BOBX transaction code.
Step 4): Next step is creating fiori element application the above registered odata service in web ide.
Test the application with fiori sandbox.
The below screen shows list report with crud opetaions, that is the magic with BOPF annotations.
Step 5)Making Data validations with BOPF Validations: Cretae new method under validations tab of generated BOPF object as below.
Write custom code in /BOBF/IF_FRW_VALIDATION~EXECUTE to trigger validations as below.
Step 6)Testing Data validations with BOPF Validations: Create new entry and save, BOPF validation method gets triggered and does validation as per custom code as below.