This is a test message to test the length of the message box.
Login
ABAP BOPF Helper methods
Created by Software-Heroes

ABAP - BOPF Helper methods

The framework provides you with various methods and objects that are intended to simplify use.

Advertising

In today's article we want to show you briefly what methods and helps from BOPF are available that support you in development and save you time when you reuse them. In some places you should also use them, otherwise problems or errors can occur.

 

Framework Factory

You get some help methods available via the framework's factory class /BOBF/CL_FRW_FACTORY. These are general methods for handling the data.

 

GET_MESSAGE

Return of a new message object for the transfer of error messages in the event of problems with data determination or processing. The current error status can also be determined via the object.

 

GET_NEW_KEY

Generation of a new unique key to save the data in the database. Usually a key is generated if none is handed over. However, if you want to create data with associations, you already need the key of the previous dataset for the association.

 

GET_NEW_TRANSIENT_KEY

Creates a new transient key and returns it. These keys can be created for disposable records if, for example, entire nodes in the model are transient but need a key for identification.

 

GET_CONFIGURATION

Reading in the configuration for a BOPF model (key of the data model from the constant interface) and returning an object of the type /BOBF/CL_CONFRT_COMPLETE.

 

DATA(lo_config) = /bobf/cl_frw_factory=>get_configuration( zif_tst_bopf_c=>sc_bo_key ).

lo_config->get_node(
  EXPORTING
    iv_node_key = zif_tst_bopf_c=>sc_node-conditions
  IMPORTING
    es_node     = DATA(ls_node)
).

 

The structure of LS_NODE then contains information about the selected node in the example above. This makes it easy to find the data types or tables for the selected node.

 

Constant Interface

The generated constant interface is an important access point to the generated keys and nodes and connects them with meaningful names. As you have already seen in the example above, you can read the configuration for the data model in a readable form without having to remember the technical identifier.

Hint: With new nodes or changes in the model, the constant interface is regenerated, so it is best practice to only access the constants, as these do not change as long as the node names do not change.

 

As an example, an extract from the interface for our data model:

INTERFACE zif_tst_bopf_c
  PUBLIC .


  INTERFACES /bobf/if_lib_constants .

  CONSTANTS:
    BEGIN OF sc_action,
      BEGIN OF conditions,
        create_conditions   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0558383898007',
        delete_conditions   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA055838416C007',
        save_conditions     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA055838493C007',
        update_conditions   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0558383D70007',
        validate_conditions TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0558384568007',
      END OF conditions,
      BEGIN OF contract,
        create_contract   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525CBC3E8006',
        delete_contract   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525CBF46C006',
        lock_contract     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525B61750006',
        partner_sign      TYPE /bobf/act_key VALUE '42D85ED56C0A1EEA82BB08B1DA099376',
        save_contract     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525CBFCF0006',
        unlock_contract   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525B89214006',
        update_contract   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525CBC8C0006',
        validate_contract TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0525CBF8E0006',
      END OF contract,
      BEGIN OF notes,
        create_notes   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA058A5C783400A',
        delete_notes   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA058A5C85CC00A',
        save_notes     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA058A5C8DD800A',
        update_notes   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA058A5C81BC00A',
        validate_notes TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA058A5C89F000A',
      END OF notes,
      BEGIN OF partners,
        create_partners   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0576054AC800A',
        delete_partners   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057605583800A',
        save_partners     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057605638C00A',
        update_partners   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057605527000A',
        validate_partners TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA0576055DD800A',
      END OF partners,
      BEGIN OF price_scale,
        create_price_scale   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA05A0EE35D800A',
        delete_price_scale   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA05A0EE453C00A',
        save_price_scale     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA05A0EE511C00A',
        update_price_scale   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA05A0EE3F6000A',
        validate_price_scale TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA05A0EE4B6800A',
      END OF price_scale,
      BEGIN OF rules,
        create_rules   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057BD6EDBC00A',
        delete_rules   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057BD6F94C00A',
        save_rules     TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057BD7014400A',
        update_rules   TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057BD6F2E400A',
        validate_rules TYPE /bobf/act_key VALUE '42D85ED56C0A1ED9AEA057BD6FD5C00A',
      END OF rules,
    END OF sc_action .

 

Conclusion

The framework already provides you with many methods and classes that help you to access the data, the configuration and the content. With the objects provided, you should actually have everything you need to work with BOPF.


Included topics:
BOPFHelper methods
Comments (0)
Advertising

ABAP - BOPF Quick Guide (Update)

Category - ABAP

A little update to our book that we published. For all people who find the paperless office boring.

10/23/2020

ABAP - BOPF Quick Guide

Category - ABAP

You need a quick introduction to the SAP Business Object Processing Framework (BOPF), we have the right guide for you here.

09/11/2020

ABAP - BOPF Eclipse

Category - ABAP

Can you also develop BOPF in Eclipse? Here we show you how well the search and navigation works in the system.

03/20/2020

ABAP - BOPF Performance

Category - ABAP

What about the performance when accessing BOPF? We want to investigate this question today.

03/13/2020

ABAP - BOPF Custom Query

Category - ABAP

Do you need your own high-performance selection for your BOPF data? Then write your own query for it today.

02/07/2020