Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
AlwinPut
Active Participant
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:
    REPORT zsd_sales_order_p.


  • Business Object Class interface name:
    INTERFACE zsd_sales_order_boi.




  • 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.



ABAP naming


You have two options

  • DSAG 2016 short naming

  • Long naming


Examples:






































Variable type DSAG 2016 short naming Long naming
Local structure  _sales_order_crea_s ls_sales_order_crea
Local reference  _sales_order_bo lr_sales_order_bo
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.
4 Comments