Considerations for BOPF-based development in the S/4HANA context
Victor Ionescu
msg systems, Technical Guidance Unit
About me
- Technical Guidance Unit @ msg systems
- organizer and speaker at #itconsapcj, now at it's 5th edition. www.itconferencesap.com
- Interests:
- #ABAP, #BOPF, #S4HANA
- #CloudNative, #CloudFoundry
https://people.sap.com/victor.ionescu
@ivictor88
BOPF Basics
Business Object Processing Framework
Design Time
Runtime
-
Business Object Model & various other artifacts:
- validations
- actions
- determinations
- etc.
API
IDEs
Persistency
BOPF
Nodes
Associations
Determinations
Actions
Validations
Transaction Handling
Authorization Handling
API
IDEs
A. Multiple flavors of SAP GUI Transactions:
- (/BOBF/CONF_UI)
- BOBX
- BOB
IDEs
B. BOPF in Eclipse:
- Simplified developer experience
- Not always 1:1 with legacy IDEs
Example: Validation Handling with BOPF in Eclipse
Validation flavors in classical BOPF development:
- Action Check (triggered by action)
- Consistency Checks (triggered by modification)
Cross-node validation through "Consistency Groups"
action
action
commit
Action Check
Check after Modify
Check before Save
consistency group
!Change!
Example: Validation Handling with BOPF in Eclipse
Example: Validation Handling with BOPF in Eclipse
- Simplified developer experience via Eclipse:
- Single consistency group: means validations are execute at every save
The S/4 Programming Model
i.e. "ABAP Programming Model for SAP Fiori"
The Stack
Database
BOPF
CDS
SADL
Gateway
UI5
Database
BOPF
CDS
SADL
Gateway
UI5
What does SADL do?
/**
* SADL = Abstraction layer between
* OData and underlying business
* entities
*/
function SADL()
{
interpret_OData_request();
if ( action == READ )
{
build_query_and_push_to_database();
}
else // action == C/U/D
{
forward_to_transactional_engine(); //i.e. BOPF
}
map_result_to_OData();
}
Database
BOPF
SADL
Gateway
UI5
Several integration "flavors"
Database
CDS
SADL
Gateway
UI5
Database
BOPF
CDS
SADL
Gateway
UI5
S/4 Prog. Model
Database
BOPF
CDS
SADL
Gateway
UI5
Implications
- CDS models are the "driving force"
- BOPF models generated (via CDS annotations)
- several aspects of BOPF development change
BOPF development in the S/4 Context
Disclaimer
- Most experience gathered on Netweaver 7.50 environment
- Enhancements to the programming model are constantly being delivered
- Depending on your Netweaver release (<7.50/7.50/7.51/7.52) some functionality might differ
=> Will try to cover all angles..
BOPF & OData - bridging the Gap
OData | BOPF |
---|---|
nouns | |
Entity(Set) | Node |
Navigation Property | Association |
Function Import | Action |
verbs | |
HTTP GET /Entity(id) | Node.query(id) |
HTTP POST /Entity | Node.create() |
HTTP PUT /Entity(id) | Node.update(id) |
Database
BOPF
SADL
Gateway
UI5
BOPF & OData - bridging the Gap (cont'd)
OData | BOPF |
---|---|
$expand | ? |
$batch | ? |
Deep Insert | ? |
Database
BOPF
CDS
SADL
Gateway
UI5
...SADL!
BOPF & OData - implementation options
Database
BOPF
CDS
SADL
Gateway
UI5
< 7.50 SP5: Data Source Mapping
>= 7.50 SP5: "OData Exposure" for CDS/BOPF Models
Implications on BOPF-based development
Implications: Node Keys
- Any OData entity must be uniquely identifiable by a key
- BOPF uses generated GUIDs
- Use a human-readable alternative key instead, (e.g. based on a number range)
GET SampleODataEntity('00505692515B1ED58EA9C9E0FD67DB41')
GET SampleODataEntity(1001)
Implications: Transient fields
- BOPF transient fields are not accesible, as the SADL engine pushes queries directly to the DB
- New in NW 7.51 SP03: Virtual Elements in CDS Views
Implications: Use of queries
- BOPF artifacts used for performing queries on the underlying persistency layer
- Still used internally in the framework, but replaced for developers and "consumers" by CDS-based queries
Implications: Associations
- BOPF Associations are crucial, as they are the basis for OData Navigation Properties
- Only modelled associations, not implemented
Database
BOPF
SADL
Gateway
UI5
Database
BOPF
CDS
SADL
Gateway
UI5
- CDS Associations are used for OData Navigation
Authorization Handling
BOPF Model
"Classical" Authorization Handling with BOPF
Authorization Object (SU21)
Role (PFCG)
STUDENT_GRADE: {
ACTVT: integer
CLASS_NAME: string
}
ROLE MATH_TEACHER: [
STUDENT_GRADE: {
ACTVT = 01(READ) or 02(WRITE)
CLASS_NAME = "MATH"
}
]
mapping
read/write
BOPF Model
Authorization Handling in the S/4 Prog. Model
Authorization Object (SU21)
Role (PFCG)
STUDENT_GRADE: {
ACTVT: integer
CLASS_NAME: string
}
ROLE MATH_TEACHER: [
STUDENT_GRADE: {
ACTVT = 01(READ) or 02(WRITE)
CLASS_NAME = "MATH"
}
]
mapping
query condition provider
Database
SADL
Gateway
SELECT ... WHERE CLASS_NAME = "MATH"
CDS
Implications: Auth. Handling
- Auth. Handling changes within the new prog. model, but works out-of-the-box for regular use-cases
- Complex Auth. checks require double implementation:
- Note: Netweaver 7.52 enhances authorization API further for draft-capability
Operation | How |
---|---|
Write | Redefine BOPF Auth. Checks |
Read | A. CDS DCL (Preferred) B. Redefine Query condition provider |
What about the UI?
- Depending on authorization:
- disable actions
- set fields read-only
- Classical BOPF development: Property Determinations
- UI5-based Front-End: ?
Dynamic Action & Field Control
- Available since NW 7.51 SP02
- Driven by CDS model, but use the clasical BOPF property determinations
- Fully integrated into SADL
define view <SAMPLE> ..
{
...
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
viewField
...
}
Testing
Testing Recommendations for the BOPF Developer
- Get comfortable with OData ($expand, $batch, deep inserts)
- Manual dev.-tests:
- Gateway client preferred over BOBT
- Multiple choices for automated tests:
- Framework support for Unit Tests
- CDS Test Double Framework
- eCATT OData E2E Tests
Further Reading:
In Conclusion
In the S4 Programming Model:
- BOPF is still there, and does the heavy lifting (but moves towards the background)
- Understanding of CDS, OData etc. is a must
Thank you for you attention!
https://people.sap.com/victor.ionescu
@ivictor88 (Look for slides here)
Victor Ionescu
msg systems, Technical Guidance Unit
BOPF-based Development in the S/4HANA Context
By Victor Ionescu
BOPF-based Development in the S/4HANA Context
- 5,680