Ansicht
Dokumentation
BAL_CH_SEARCH_READ -
Fill RESBD Structure from EBP Component Structure ROGBILLS - Synchronize billing plansThis documentation is copyright by SAP AG.
|---------------------------------------------------------------------|
| Find and read messages |
|---------------------------------------------------------------------|
Overview
======================================================================
How to find and read messages in memory (not in the database).
Function modules:
BAL_GLB_SEARCH_LOG Find logs in memory
BAL_GLB_SEARCH_MSG Find messages in memory
BAL_LOG_HDR_READ Read log header and data
BAL_LOG_MSG_READ Read message and data
BAL_LOG_EXCEPTION_READ Read exception and data
Types
BAL_S_LFIL Log header data filter criteria
BAL_S_MFIL Message data filter criteria
BAL_T_CFIL Context data filter criteria
BAL_T_LOGH Log handle table
BAL_T_MSGH Message handle table
Example programs
SBAL_DEMO_03 creates several logs in memory, searches for messages and logs, and reads data.
==>SBAL_DEMO_03 execute
==>SBAL_DEMO_03 coding
Report SBAL_DEMO_08 creates several logs in the main memory, searches for exceptions or logs, and reads data.
==>SBAL_DEMO_08 execute
==>SBAL_DEMO_08 coding
Find and read logs in memory
=======================================================================
If the application program has no handle to access a log in the Application Log, it can get one with BAL_GLB_SEARCH_LOG, which searches for logs in memory.
This function module gets various log header data search criteria as Importing parameters:
- I_S_LOG_FILTER
Log header filter criteria (structure BAL_S_LFIL)
- I_S_LOG_CONTEXT_FILTER
Log header context data filter criteria (type BAL_T_CFIL)
- I_T_LOG_HANDLE
Log handle set to be searched (type BAL_T_LOGH)
If several parameters are specified, they are related by a logical AND.
The result E_T_LOG_HANDLE is a table of log handles.
You can read the header data of a log using BAL_LOG_HDR_READ with a log handle. This function module returns the log header data in E_S_LOG and other data such as:
- E_EXISTS_ON_DB E_IS_MODIFIED
Does the log exist in the database?
If so, has it been changed?
- E_LOGNUMBER
Internal log number (if the log has not yet been saved, this is only a temporary number beginning with '$')
- E_STATISTICS
Statistical log data (120 messages, of which 13 errors, 4 warnings, etc.)
- E_TXT_OBJECT, E_TXT_SUBOBJECT, E_TXT_ALMODE, etc.
Texts for various log header fields (e.g. E_TXT_ALMODE = 'Batch Input', if ALMODE = 'I')
Find and read messages in memory
=======================================================================
If the application program has no handle to access an Application Log message, it can get one with BAL_GLB_SEARCH_MSG, which searches memory for logs.
This function module gets various message or log header data search criteria as Importing parameters:
- I_S_LOG_FILTER
Log header filter criteria (structure BAL_S_LFIL)
- I_S_LOG_CONTEXT_FILTER
Log header context data filter criteria (type BAL_T_CFIL)
- I_T_LOG_HANDLE
Set of log handles to be searched (type BAL_T_LOGH)
- I_S_MSG_FILTER
Message data filter criteria (structure BAL_S_MFIL)
- I_S_MSG_CONTEXT_FILTER
Log header context data filter criteria (type BAL_T_CFIL)
- I_T_MSG_HANDLE
Set of message handles to be searched (type BAL_T_MSGH)
If several parameters are specified, they are related by a logical AND.
The result E_T_MSG_HANDLE is a table of the set of message handles of the messages found.
Read messages
=======================================================================
You can read message data with BAL_LOG_MSG_READ using a message handle. This function module returns the message data in E_S_MSG and additional data such as:
- E_EXISTS_ON_DB
Does the message already exist in the database?
- E_TXT_MSGTY, E_TXT_MSGID, etc.
Texts for various message fields (e.g. E_TXT_MSGTY = 'Error', if MSGTY = 'E')
Read exceptions
=======================================================================
Using a message handle, you can read the data for an exception with BAL_LOG_EXCEPTION_READ. The function module returns the exception data in E_S_EXC.Other returned data includes:
- E_EXISTS_ON_DB
Does the message already exist on the database?
- E_TXT_MSGTY, E_TXT_DETLEVEL, etc.
Texts for different fields of the exception (for example, E_TXT_MSGTY = 'Error' if MSGTY = 'E')
Log header filter criteria
=======================================================================
This structure contains log header filter criteria, mainly field RANGES such as:
- LOG_HANDLE
- EXTNUMBER
- OBJECT
- SUBOBJECT
- ALDATE
- ALTIME
- ALPROG
- ALTCODE
- ALUSER
- ALMODE
- PROBCLASS
You can also search for the internal log number LOGNUMBER.
For a time interval, use DATE_TIME which contains the:
- from time (DATE_TIME-DATE_FROM DATE_TIME-TIME_FROM and the
- to time (DATE_TIME-DATE_TO DATE_TIME-TIME_TO)
==>Note
If you specify several criteria, they are related by a logical AND.
- Example
Search for all logs of object 'BCT1' with external number '12345' or '67890' which were created by transaction 'XY01' this morning
================================================================
DATA:
l_s_log_filter TYPE bal_s_lfil,
l_r_object TYPE bal_s_obj,
l_r_extnumber TYPE bal_s_extn,
l_r_altcode TYPE bal_s_tcde.
* define object
l_r_object-option = 'EQ'.
l_r_object-sign = 'I'.
l_r_object-low = 'BCT1'.
append l_r_object to l_s_log_filter-object.
* define external numbers
l_r_extnumber-option = 'EQ'.
l_r_extnumber-sign = 'I'.
l_r_extnumber-low = '12345'.
append l_r_extnumber to l_s_log_filter-extnumber.
l_r_extnumber-low = '67890'.
append l_r_extnumber to l_s_log_filter-extnumber.
* transaction code
l_r_altcode-option = 'EQ'.
l_r_altcode-sign = 'I'.
l_r_altcode-low = 'XY01'.
append l_r_altcode to l_s_log_filter-altcode.
* time interval
l_s_log_filter-date_time-date_from = sy-datum.
l_s_log_filter-date_time-time_from = '000000'.
l_s_log_filter-date_time-date_to = sy-datum.
l_s_log_filter-date_time-time_to = '120000'.
===============================================================
Message filter criteria
=======================================================================
This structure contains message filter criteria, mainly message field RANGES such as:
- MSGNUMBER Message number in Application Log
- MSGID Message class (or work area)
- MSGNO Message number in message class
- MSGTY Message type
- DETLEVEL Level of detail
- PROBCLASS Problem class
You can also specify a combination of message class and message number (field MSGIDMSGNO).
Filter criteria for the following RANGES can be combined for the search for exceptions:
- EXCLS Name of exception class
- EXTXT Label for exception class
- MSGTY Message type
- DETLEVEL Level of detail
- PROBCLASS Problem class
==>Note
If several criteria are specified, they are related by a logical AND.
- Example
Search for all serious and very serious errors.
================================================================
DATA:
l_s_msg_filter TYPE bal_s_mfil,
l_r_msgty TYPE bal_s_msty,
l_r_probclass TYPE bal_s_prcl.
* define message type
l_r_msgty-option = 'EQ'.
l_r_msgty-sign = 'I'.
l_r_msgty-low = 'E'. "Error
append l_r_msgty to l_s_msg_filter-msgty.
* define problem class
l_r_probclass-option = 'EQ'.
l_r_probclass-sign = 'I'.
l_r_probclass-low = '1'. "very serious messages
append l_r_probclass to l_s_msg_filter-probclass.
l_r_probclass-low = '2'. "serious messages
append l_r_probclass to l_s_msg_filter-probclass.
===============================================================
Context filter criteria
=======================================================================
Context filter criteria; context field RANGES.
Internal table with the structure:
- TABNAME context DDIC structure name
- FIELDNAME field whose RANGE follows
- T_RANGE RANGE table with SIGN, OPTION, LOW and HIGH
- Example
Search for airlines 'SF' and 'AB':
================================================================
DATA:
l_t_context_filter TYPE bal_t_cfil,
l_s_context_filter TYPE bal_s_cfil,
l_s_range TYPE bal_rfield.
* define field
l_s_context_filter-tabname = 'BAL_S_EX01'.
l_s_context_filter-fieldname = 'CARRID'.
* define airlines
l_s_range-option = 'EQ'.
l_s_range-sign = 'I'.
l_s_range-low = 'SF'.
append l_s_range to l_s_context_filter-t_range.
l_s_range-low = 'AB'.
append l_s_range to l_s_context_filter-t_range.
* put result in filter table
append l_s_context_filter to l_t_context_filter.
...
===============================================================
Log and message handle tables
=======================================================================
Log handle table.
==>Note
Sorted table. Make entries with INSERT ... INTO TABLE, not APPEND.
Message handle table.
==>Note
Sorted table. Make entries with INSERT ... INTO TABLE, not APPEND.
TXBHW - Original Tax Base Amount in Local Currency General Material Data
This documentation is copyright by SAP AG.
Length: 13768 Date: 20240510 Time: 170622 sap01-206 ( 108 ms )