ABAP BAPI BO Class Code Generator – Business Object parameters
This blog post is a follow-up blog post of https://blogs.sap.com/2019/08/27/abap-bapi-bo-class-generator/.
In this post is explained what effect the Business object class parameters have on the generated code.
The example below will be used to explain the Business Object class selection screen parameters.
Business Object name
The Business Object name is used in messages to the user.
- Existence check
"Sales Order &1 does not exist. MESSAGE e001(zsd_sales_order) WITH key INTO DATA(lv_dummy) ##NEEDED.
In test class, for example...
WRITE: / 'sales order instantiated. '. WRITE: / 'sales order not instantiated. Error: '.
Module name abbreviation and the ABAP object name
These are used in:
- Report name:
- Business Object Class interface name:
- Business Object class name:
CLASS zsd_sales_order_bo DEFINITION.
- Test class name:
CLASS zsd_sales_order_bo_tt DEFINITION.
- Variable names
DATA(_sales_order_bo) = zsd_sales_order_bo=>create_instance_bo( _sales_order_crea_s ).
- Message class name:
MESSAGE e001(zsd_sales_order) WITH key INTO DATA(lv_dummy) ##NEEDED.
You have two options
- DSAG 2016 short naming
- Long naming
|Variable type||DSAG 2016 short naming||Long naming|
|Local Exception variable||_return_exc||lr_return_exc|
|Global class element||key||gs_key|
|Global structure type||tcreate_data_s||gts_create_data|
BO main DB table
The database table is used for
The existence check
- METHOD check_existance.
SELECT SINGLE 'X' AS exist_ind FROM vbak INTO @DATA(lv_exist_ind) WHERE vbak~vbeln = @gs_key. IF sy-subrc <> 0.
- It is also used for the key fields if the BOR object type is empty.
BOR object type
The BOR object type is used for determining the key fields.
Generate class interface indicator
This checkbox indicates whether a BO Class interface should be generated.
If not, than the data types and method declarations will be done in het BO Class definition.
Example of BO class interface
Example of BO class with class interface reference
Keep following the upcoming blog posts for more detailed information about the tool.
Nice blog. I really like pictures. Combined with the last blog it makes it very effective.
Hi thank you for the blog, between part1 and this blog, it has stirred quite some interest among my colleagues, since we often have to find ways to encapsulate certain "business object" abstractions into a simple to use format.
So far we used function modules and some very timid use of Objects, but with your approach it is clear there are advantages for programs that interface with external systems or within custom workflow actions.
And for the record, we prefer the long naming, DSAG is often too rigid for what we aim for.
I must say a great blog. Infact i missed to read the earlier one and thanks to this blog i was able to understand the concept in detail. Adding an interface i think is great the signatures are uniform then. Thanks
Thank you. Version 1.2 is now available and generates also the class interface.