Ansicht
Dokumentation
BAL_DB_SAVE_PREPARE - Application Log: Database: Preparation (replace temp. numbers)
CL_GUI_FRONTEND_SERVICES - Frontend Services General Material DataThis documentation is copyright by SAP AG.
Functionality
Application Log message variables or contexts can sometimes still contain temporary data.
For example document numbers. When a document is created, it has a temporary number (e.g. $0001). A permanent number is only issued from a number range interval when the document is saved.
If messages are created for such a document, the message variables could contain temporary numbers. These temporary values should be replaced by permanent ones when you save (e.g. $0001 by 0000123456), otherwise the log is of no value.
The function module BAL_DB_SAVE_PREPARE performs this substitution.
You pass a replacement pattern
(table type BAL_T_RPLV) which specifies, for example that message variables with old
contents $0001 (field OLD_VALUE) are to be replaced by the new value 12345 (field NEW_VALUE), $0002 by 67890, etc.
You can also define replacements for context information (table type BAL_T_RPLC). For example, the data in the field VBELN (FIELDNAME) is to be replaced in all contexts which have the DDIC structure MY_STRUC (TABNAME); $0001 (OLD_VALUE) by 1234 (NEW_VALUE), etc.
I_REPLACE_IN_ALL_LOGS = 'X' specifies that the replacement be made in all logs in memory. If you only want to replace in certain logs, set I_REPLACE_IN_ALL_LOGS = ' ' and put the log handle in I_T_REPLACE_IN_THESE_LOGS.
- Note
When replacing message variables you cannot be completely sure that e.g. the message variable MSGV1 in a particular message really contains an order number. It could also be a (coincidentally identical) temporary number of a different document which was created in the background and for which messages were also created.
You can avoid such ambiguities by specifying the source of a message variable when a message is sent, in the fields MSGV1_SRC, ..., MSGV4_SRC in the structure BAL_S_MSG. You can refer to these values (field MSGV_SRC) when you replace the message variables with BAL_DB_SAVE_PREPARE.
Example
Report SBAL_DEMO_05 (==>Run ==>Coding) simulates a settlement run for all flights on a specified date. You can choose:
- Simulate settlement.
The documents are only collected in memory with temporary numbers, which are logged.
- Perform settlement.
A log is saved in the database after the temporary document numbers have been replaced by permanent ones in the log.
- Display logs.
Related function modules
Save and load logs
Delete logs
Further information
Overview of the most important function groups
Application Log: Technical documentation
Parameters
I_REPLACE_IN_ALL_LOGSI_T_REPLACE_CONTEXT_FIELDS
I_T_REPLACE_IN_THESE_LOGS
I_T_REPLACE_MESSAGE_VARIABLES
Exceptions
LOG_NOT_FOUNDFunction Group
SBAL_TOOLBOXGeneral Data in Customer Master Fill RESBD Structure from EBP Component Structure
This documentation is copyright by SAP AG.
Length: 4275 Date: 20240520 Time: 190548 sap01-206 ( 74 ms )