Ansicht
Dokumentation

BAL_CH_TRANSACTION -

BAL_CH_TRANSACTION -

ABAP Short Reference   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

|---------------------------------------------------------------------|
| Transaction call |
|---------------------------------------------------------------------|

Overview
=======================================================================

Application function modules are called in various contexts:

  • Dialog
  • Bulk processing
  • EDI incoming processing
  • ...

Messages are handled differently in different contexts.

  • In dialog, messages may have to be output immediately.
  • In bulk processing, messages are first collected and output as a log at the end.
  • There are possible mixed forms: if 100 order items are changed in dialog a message is not output for each item, a popup appears at the end with the messages.
  • The function module caller may want to decide how messages are handled: do not collect the messages of the called function module because they are too technical, or only collect important messages.

The called function module should ideally not know how its messages are handled. It sends the messenges to the Application Log and the CALLER decides how to handle them (e.g. directly output or collect).

The Application Log can therefore be configured at the start of the transaction. The configuration can be protected from overwriting during the program.
Function modules
BAL_GLB_CONFIG_SET Configure
BAL_GLB_CONFIG_GET Read configuration
BAL_GLB_AUTHORIZATION_GET Authorize
BAL_GLB_AUTHORIZATION_RESET Reset authorization
BAL_GLB_MEMORY_REFRESH (Partially) initialize memory
BAL_MSG_DISPLAY_ABAP Output message as ABAP-MESSAGE
Types
BAL_S_CONF Configuration data
BALAUTH Authorization

Set and read configuration
=======================================================================

You can configure the application log at the start of the transaction with the function module BAL_GLB_CONFIG_SET.
For this purpose, you have to transfer the import parameter I_S_CONFIGURATION, which has the structure BAL_S_CONF, to the function module.

You can get existing configurations with BAL_GLB_CONFIG_GET.

BAL_S_CONF specifies the messages which Application Log is to collect (component COLLECT) and which are to be output as soon as they are sent (component DISPLAY):

  • COLLECT-INACTIVE
    COLLECT-INACTIVE = 'X' completely deactivates message collection.
    COLLECT-ACTIVE = ' ' activates message collection.
  • COLLECT-MSG_FILTER, COLLECT-CON_FILTER
    Specifies which messages are to be collected by Application Log. These filter criteria refer to the message data, where COLLECT-MSG_FILTER filters by message attributes and COLLECT-CON_FILTER by message context.
    These filters have no effect if COLLECT-INACTIVE = 'X' is set.
  • DISPLAY-INACTIVE
    DISPLAY-INACTIVE = 'X' prevents any messages being displayed when they are sent to the Application Log.
    DISPLAY-INACTIVE = ' ' displays the messages with the callback routine specified in DISPLAY-CALLBACK. If DISPLAY-CALLBACK is empty, DISPLAY-INACTIVE = ' ' has no effect.
  • DISPLAY-MSG_FILTER, DISPLAY-CON_FILTER
    Specifies, analogously to collect, which messages are to be displayed (if DISPLAY-INACTIVE = ' ' and a callback routine was specified).
  • DISPLAY-CALLBACK
    This is the message display callback routine which is called when DISPLAY-INACTIVE = ' ' and a message satisfies the specified filter (see also here). This routine can only be used for T100 messages and not for exceptions.

Example 1
The parent program calls BAL_GLB_CONFIG_SET to ensure that the application log collects error messages and warnings only. All other message types are ignored.

Example 2
Important error messages should be displayed as an ABAP-MESSAGE as soon as they are sent (as well as normal log output at the end of the transaction).

Only one display routine is currently delivered in the standard system (function module BAL_DSP_MSG_DISPLAY_ABAP). This is useful if a check module is called as a background job and in dialog mode. You configure background processing in such a way that all messages are collected. In dialog mode, however, nothing is collected, but is output directly. A corresponding error message, for example, is then displayed in the PAI of a screen.

Other output routines may be developed in future releases (routines for displaying a message list in an amodal window, for example).

==>Note
Application log performance can deteriorate considerably if you use complex filters, because each message sent has to be checked to see whether it should be collected or displayed. For this reason, keep filters as simple as possible.
Do not use filters to implement customer-defined controls. (These are controllable error messages: The customer can specify conditions in Customizing that determine whether a message is to be collected, and with which message type). These conditions lead to complex filters.

==>Note
The message data, including defaults is used to check whether a message is collected or displayed.

The configuration affects the following function modules:
BAL_LOG_MSG_ADD Add message to log
BAL_LOG_EXCEPTION_ADD Add exception to log
BAL_LOG_MSG_CUMULATE Add message cumulatively
BAL_LOG_MSG_REPLACE Replace last message
BAL_LOG_MSG_ADD_FREE_TEXT Add message as free text

Authorization
=======================================================================

Critical functions such as configuration (function module BAL_GLB_CONFIG_SET) and initialization (function module BAL_GLB_MEMORY_REFRESH) should normally only be performed by the mother program. Lower level routines should not perform these global activities.

Problems can occur when a lower-level routine calls the initialization module, for example because this routine was not originally intended to be called in this context.

You can avoid such effects with authorizations:
The mother program (the first program to have control) can get an authorization at the start with the function module BAL_GLB_AUTHORIZATION_GET, which returns a unique key in E_AUTHORIZATION.

The critical functions can only be performed by specifying the key I_AUTHORIZATION. If I_AUTHORIZATION is not specified, or has the wrong value, the action (e.g. initialize memory) is refused. BAL_GLB_AUTHORIZATION_GET can not be repeated, so you cannot get a second key.

You can return the key with BAL_GLB_AUTHORIZATION_RESET (specifying the key).
All the above function modules can then be called without authorization.

The following function modules require authorization:
BAL_GLB_AUTHORIZATION_GET
BAL_GLB_AUTHORIZATION_RESET
BAL_GLB_CONFIG_SET
BAL_GLB_MEMORY_REFRESH
BAL_GLB_MSG_DEFAULTS_SET
BAL_STATISTICS_GLB_SET

==>Note
To remove the data of a single log from memory use the function module BAL_LOG_REFRESH, which does not require authorization as it only affects one log and not the entire function group memory.

==>Note
Your programs should allow for the fact that an action can be refused and not assume successful performance.

  • ==>Example
    It is common to initialize memory, call a function and then look for errors in the log. This shifts program exception handling to the log tool, which is not its purpose.
    You should not do this because the messages collected by the Application Log and memory reset can be controlled externally, so you cannot control which messages are in the log.





Addresses (Business Address Services)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 10247 Date: 20240509 Time: 235004     sap01-206 ( 148 ms )