Ansicht
Dokumentation
BAL_CH_SIMPLE -
ABAP Short Reference Addresses (Business Address Services)This documentation is copyright by SAP AG.
|---------------------------------------------------------------------|
| Simple call |
|---------------------------------------------------------------------|
Overview
======================================================================
How to collect messages and display them as a log most simply.
Function modules:
BAL_LOG_CREATE Create log with header data
BAL_LOG_MSG_ADD Add a message to a log
BAL_LOG_EXCEPTION_ADD Add an exception to a log
BAL_DSP_LOG_DISPLAY Display message in memory
Types:
BAL_S_LOG Contains log header data
BAL_S_MSG Contains message data
BAL_S_EXC Contains exception data
BALLOGHNDL Log handle
BALMSGHNDL Message handle
Example programs
SBAL_DEMO_01 simulates a flight check and outputs a result log.
==>SBAL_DEMO_01 execute ==>SBAL_DEMO_01 coding
Like report SBAL_DEMO_01, report SBAL_DEMO_07 simulates a flight check. Errors are added to the log using exceptions.
==>SBAL_DEMO_07 execute
==>SBAL_DEMO_07 coding
Open log
======================================================================
The function module BAL_LOG_CREATE opens the Application Log whose header data is in the Importing parameter I_S_LOG_HEADER, which has the structure BAL_S_LOG.
The function module BAL_LOG_CREATE returns the log handle (LOG_HANDLE, CHAR22).
The LOG_HANDLE is a
GUID (globally unique identifier) which uniquely identifies a log. You can access this log with this handle, for example, to subsequently change the header data (
BAL_LOG_HDR_CHANGE) or to add a message
(BAL_LOG_MSG_ADD) or an exception text
(BAL_LOG_EXCEPTION_ADD) to the log.
The LOG_HANDLE has its permanent value straight away, so it remains valid after saving.
==>Note:
Logs in memory and in the database are referred to in the new Application
Log by the log handle (LOG_HANDLE), but the previous LOGNUMBER, which is assigned from number range
interval 01 of number range object APPL_LOG when you save, still exists. A lot of applications have
a reference to this LOGNUMBER in their structures, so it is still supported. The LOGNUMBER is also more understandable for users than the LOG_HANDLE. There is a 1:1 relationship between LOG_HANDLE and LOGNUMBER.
Add a message to a log
======================================================================
Functionality
A message is added to the log with the (log handle) I_LOG_HANDLE
The message data is passed to the function module BAL_LOG_MSG_ADD in the IMPORTING parameter I_S_MSG (structure BAL_S_MSG).
A message handle which uniquely identifies this message is returned in E_S_MSG_HANDLE.
This data is mostly the T100 information (message type, work area, message number, the 4 message variables), but can be other information such as application-specific data (context) or extended long text or callback routine parameters.
The function modules BAL_LOG_MSG_ADD, BAL_LOG_MSG_CUMULATE, etc. return the message handle (E_S_MSG_HANDLE).
The message handle comprises the log handle of the log to which the message belongs and an internally-assigned sequential number
(MSGNUMBER). The handle uniquely identifies a message and you can access a message with it, e.g. to change (BAL_LOG_MSG_CHANGE) or read (BAL_LOG_MSG_READ) it.
Add exceptions to a log
======================================================================
Functionality
An exception text is added to the log identified with I_LOG_HANDLE (log handle).
The exception class, error severity, problem class, and level of detail are given to the function module BAL_LOG_EXCEPTION_ADD using the IMPORTING parameter I_S_EXC (structure BAL_S_EXC).
Context information for exceptions and cumulated addition of exceptions are not supported.
A message handle that uniquely identifies this message is returned with E_S_MSG_HANDLE.
=> Note: This function module replaces the function module BAL_LOG_EXC_ADD.
Display log
======================================================================
BAL_DSP_LOG_DISPLAY displays the collected messages. It can be called without parameters, in which case all messages in memory are displayed in a standard format (this standard format is also used in the transaction SLG1).
==>Note
The log handle is optional for function modules such as BAL_LOG_MSG_ADD, BAL_LOG_MSG_CUMULATE, BAL_LOG_MSG_ADD_FREE_TEXT, etc.
If it is not specified, the default log, which can be set, with other default data, with BAL_GLB_MSG_DEFAULTS_SET is used. If no default log is defined, it is set automatically by BAL_LOG_CREATE (see
here).
CL_GUI_FRONTEND_SERVICES - Frontend Services CL_GUI_FRONTEND_SERVICES - Frontend Services
This documentation is copyright by SAP AG.
Length: 6972 Date: 20240510 Time: 171819 sap01-206 ( 92 ms )