For detail information about archiving for external log, please refer to the following document.
SAP Custom Development |
Archiving/External Log |
Design |
|
| | |
- 0.1
| Draft | 2013/11/25 |
|
Confidential |
Contents
- 1...... Organization. 4
- 1.1 Document Administration. 4
- 1.1.1 Authors. 4
- 1.1.2 History. 4
- 1.2 Document Reference. 4
- 1.3 Glossary. 4
- 2...... Overview and Architecture. 5
- 2.1 Assumptions. 5
- 2.2 Architecture. 5
- 2.3 Reusable Components. 5
- 3...... Detailed Design. 6
- 3.1 Archiving Object 6
- 3.1.1 Function. 6
- 3.1.2 Data Model 6
- 3.1.3 Customizing. 6
- 3.2 Preprocessing Program.. 7
- 3.2.1 Flow Chart 7
- 3.2.2 Selection Screen. 8
- 3.2.3 Authorization check for archiving. 8
- 3.2.4 Get Data for archiving preprocess. 8
- 3.2.5 Preprocessing Logs. 9
- 3.2.6 Further notes about preprocess program.. 9
- 3.3 Write Program.. 10
- 3.3.1 Flow Chart 10
- 3.3.2 Overview. 10
- 3.3.3 Selection Screen. 11
- 3.3.4 Further notes about write program.. 12
- 3.4 Delete Program.. 13
- 3.4.1 Flow Chart 13
- 3.4.2 General Information. 13
- 3.4.3 Selection Screen. 13
- 3.4.4 Authorization check. 14
- 3.4.5 Check ARO current DB archiving status. 14
- 3.4.6 Delete Methods. 14
- 3.4.7 Further notes about delete-program.. 14
- 3.5 Read Program.. 15
- 3.5.1 Archive File Filter 15
- 3.5.2 Archived External Log Filter 15
- 3.5.3 Display of Archive Data Result 15
- 3.5.4 Processing Logic. 16
- 3.5.5 Read Archive file. 16
- 3.5.6 Data conversion. 17
- 3.5.7 Data Display. 17
- 3.6 Reload Program.. 18
- 3.6.1 Flow Chart 18
- 3.6.2 General Information. 18
- 3.6.3 Selection Screen. 18
- 3.6.4 Authorization check. 19
- 3.6.5 Check EXTERNAL LOG current DB archiving status. 19
- 3.6.6 Reload Methods. 19
- 3.7 Accessing archived data. 19
- 3.8 Implementation Guide for External Log Archiving. 20
- 4...... Verification of Constraints. 21
- 4.1 Data Volumes. 21
- 4.2 Performance. 21
- 4.3 Data Protection. 21
- 4.4 Data Security. 21
- 4.5 Globalization. 21
- 4.6 Portability. 21
- 4.7 Compatibility to Previous Versions. 21
- 5...... Appendix. 21
- 5.1 Alternative Design Ideas. 21
- 5.2 Overview of Classification. 21
- 5.3 Overview of Modifications. 21
- 5.4 Out of Scope. 21
- 6...... Points for Clarification. 21
1 Organization
1.1 Document Administration
1.1.1 Authors
| | |
Weiss Zhao | SAP China | Author |
| | |
| | |
1.1.2 History
| | | | | |
2013/11/25 | V01 | All | | First version | |
| | | | | |
1.2 Document Reference
Not relevant.
1.3 Glossary
Not relevant.
2 Overview and Architecture
2.1 Assumptions
Not relevant.
2.2 Architecture
The product standard archiving describes 4 scenarios. We will follow the recommended scenario 2 which contains three steps: preprocessing, writing and deletion.
2.3 Reusable Components
Not relevant.
3 Detailed Design
3.1 Archiving Object
3.1.1 Function
Archiving object /LOGWIN/ET will be created to archive the data of the external log of UI logging data.
3.1.2 Data Model
Not relevant.
3.1.3 Customizing
Archiving object /LOGWIN/ET will be defined in transaction AOBJ, the details is as below:
3.1.3.1 General information:
Text: Archiving for External Log
Application Area: BC
Application Component: ABA0000103 (Cross-Application Objects in Project System)
Preprocessing Program: /LOGWIN/EXT_LOG_ARCHIVE_SEARCH
Write Program: /LOGWIN/EXT_LOG_ARCHIVE_WRITE
Delete Program: /LOGWIN/EXT_LOG_ARCHIVE_DELETE
Reload Program: /LOGWIN/EXT_LOG_ARCHIVE_RELOAD
3.1.3.2 Defining the Structure of an Archiving Object
- 1) Defining the structure for common part
Record No. | Parent Segment | Segment |
10 | | /LOGWIN/EXT_LOG |
20 | /LOGWIN/EXT_LOG | /LOGWIN/ENC_HD |
30 | /LOGWIN/EXT_LOG | /LOGWIN/EXTLDATA |
- 1) Defining the structure for SAPGUI
Add following structures into the implementing class /LOGWIN/CL_ARC_EXT_LOG_SAPGUI:
/LOGWIN/LOG_NV_H
/LOGWIN/LOG_NV_D
/LOGWIN/SG_ENC_H
/LOGWIN/SG_ENC_D
- 2) Defining the structure for WDA
Add following structures into the implementing class /LOGWIN/CL_ARC_EXT_LOG_WDA:
/LOGWIN/WDA_NV_H
/LOGWIN/WDA_NV_D
/LOGWIN/WD_ENC_H
/LOGWIN/WD_ENC_D
- 3) Defining the structure for CRM
Add following structures into the implementing class /LOGWIN/CL_ARC_EXT_LOG_CRM:
/LOGWIN/CRM_NV_H
/LOGWIN/CRM_NV_D
/LOGWIN/CM_ENC_H
/LOGWIN/CM_ENC_D
3.1.3.3 Archiving Object Specific Customizing Settings
Logical File Name: /FOM/ARCHIVE_DATA_FILE
- Archive File Size
Maximum Size in MB: 30
Maximum Number of Data Object: Initial
- Setting for Delete Program
Commit Counter: 500 (Number of Data Objects per Commit in Program)
Variant of Program for Test Mode: TEST MODE
Variant of Program for Production Mode: PROD MODE
- Delete Jobs
The background jobs for delete program can be scheduled.
3.2 Preprocessing Program
3.2.1 Flow Chart
3.2.2 Selection Screen
Preprocessing program name: /LOGWIN/EXT_LOG_ARCHIVE_SEARCH
Selection Screen Title: Preprecessing: Archiving Program for UI Logging
The only criteria for selection:
User Name
Date of Data Logging
Time of Data Logging
Logged Entity
Client IP in Log.
Use the standard include: ‘ARCH_PREPROC_PRG_STANDARD2’ in the program to:
1. Provide the 2 processing choices: production and test mode.
2. Enable the preprocessing log.
3.2.3 Authorization check for archiving
Authorization object: /LOGWIN/DC
Authorization ID /LOGWIN/KR FIELD 01
3.2.4 Get Data for archiving preprocess
3.2.4.1 Get External Log of Common Part and Technology Part
Method: /LOGWIN/CL_EXT_LOG_ACCESS=>SEARCH_DATA_FOR_ARCHIVING
Parameter name | Parameter text | Type | Source value |
IS_SELECT_OPTIONS | Selection options for external log (Extended Data Model) | /LOGWIN/EXT_LOG_SEL_COM_H_S | Input on selection screen |
IV_SET_STATUS | | ABAP_BOOL | |
IV_HEADER_ONLY | | ABAP_BOOL | |
ET_RESULT | | /LOGWIN/EXT_LOG_ARCH_INFOREC_T | |
ET_ERRORS | Standard table for BAPIRET1 | /LOGWIN/BAPIRET1_T | |
This method searches the external log of common part and technology part including encrypted data and EDM data which will be archived. The field ARCH_STATUS of table /LOGWIN/EXT_LOG will be set as ‘Selected for archiving’, if the data has been retrieved successfully
3.2.5 Preprocessing Logs
3.2.5.1 General information
Providing your users with information on the progress and/or the results of data archiving programs is mandatory since this enables them to trace back or prevent problems that may occur during archiving.
3.2.5.2 Selection screen
Use standard include ‘ARCH_PREPROC_PRG_STANDARD2’ in the program to enable the selection screen parameters P_PROT and P_PROT_O for preprocessing log.
3.2.5.3 Initialize Object Log
Initialize the object log using the function module ARCHIVE_PROTOCOL_INIT, according to the user input given in parameters P_PROT and P_PROT_O.
3.2.5.4 Build Object Log
Call function module ARCHIVE_PROTOCOL_COLLECT once for each ARO object to build the preprocessing logs.
3.2.5.5 Output Standard Log
Call function module ARCHIVE_PROTOCOL_WRITE to output the archiving object log at the end of the preprocessing phase. It outputs standard logs according to the selection screen parameters P_PROT and P_PROT_O.
3.2.6 Further notes about preprocess program
- Set five fixed values for domain: /LOGWIN/ARCH_STATUS_D of archive status field: ARCH_STATUS in table: /LOGWIN/EXT_LOG
1) ‘00’ not archived
- 2) ‘10’ selected for archiving
- 3) ‘20’ selected for write
- 4) ‘30’ archived
- 5) ‘50’ reloaded
- After archive preprocess program runs, set field: ARCH_STATUS = 10
- After archive write program runs, set field: ARCH_STATUS = 30
- After archive reload program runs, set field: ARCH_STATUS = 50
3.3 Write Program
3.3.1 Flow Chart
3.3.2 Overview
3.3.2.1 General infomation
- Method GET_DATA_FOR_ARCHIVING of class /LOGWIN/CL_EXT_LOG_ACCESS will be used to trigger the archiving process of external log. The archiving status of all the external log should be set as ‘20’ (selected for write).
Parameter name | Parameter text | Type | Source value |
IV_TEST_MODE | | ABAP_BOOL | Input on selection screen |
IV_NUM_RECS | Number of Records to be archived | /LOGWIN/ARCH_NUM_E | Input on selection screen |
IV_HEADER_ONLY | | /LOGWIN/ARCH_NUM_E | |
ET_RESULT | Table type for /LOGWIN/EXT_LOG_STRTAB_DB_S | /LOGWIN/EXT_LOG_ARCH_INFOREC_T | |
EV_SUCCESS | | ABAP_BOOL | |
ET_ERRORS | Standard table for BAPIRET1 | /LOGWIN/BAPIRET1_T | |
- Method UPDATE_ARCH_STAT_AFTER_WRITE of class /LOGWIN/CL_EXT_LOG_ACCESS will be used to update the status of the external log as ‘30’ (archived), if the external log has been archived successfully.
Parameter name | Parameter text | Type | Source value |
IT_ARCH_RECORD | Table type for /LOGWIN/EXT_LOG_ARCH_RECORD_S | /LOGWIN/EXT_LOG_ARCH_RECORD_T | |
IT_GUID | table type for guid_16 | /LOGWIN/GUID_T | |
IV_COMMIT | | ABAP_BOOL | |
EV_SUCCESS | | ABAP_BOOL | |
ET_ERRORS | Standard table for BAPIRET1 | /LOGWIN/BAPIRET1_T | |
3.3.2.2 Archive Run Mode
External Logs that fulfill following condition will all be archived:
Indicator ‘ARCH_STATUS’ on /LOGWIN/EXT_LOG has been set as selected for archiving.
3.3.3 Selection Screen
Write Program Name: /LOGWIN/EXT_LOG_ARCHIVE_WRITE
Selection Screen Title: Write Program: Archiving Program for UI Logging
The criterion for selection:
- of Records Archive(default 10,000)
Use the standard include: ‘ARCH_PREPROC_PRG_STANDARD2’ in the program to:
1. Provide the 2 processing choices: production and test mode.
2. Enable the detail log.
3. ILM parameters.
3.3.4 Further notes about write program
3.3.4.1 Function ‘ARCHIVE_OPEN_FOR_WRITE‘
Function ‘ARCHIVE_OPEN_FOR_WRITE’ should be called with following import parameters:
Parameter name | Parameter text | Type | Source value |
CALL_DELETE_JOB_IN_TEST_MODE | Run Delete Program in Test Mode Only | | 'X' |
CREATE_ARCHIVE_FILE | Create or Do not Create Archive File | | 'X' |
OBJECT | Archiving Object Name | ARCH_OBJ-OBJECT | '/FOM/ARO' |
COMMENTS | Comment Line For Archiving Session | | Input from selection screen |
3.4 Delete Program
3.4.1 Flow Chart
3.4.2 General Information
Authorization check should be taken in consideration to prevent un-authorized user from operation.
3.4.3 Selection Screen
Delete Program Name: /LOGWIN/EXT_LOG_ARCHIVE_DELETE
Selection Screen Title: Delete Program: Archiving Program for UI Logging
Include standard archiving selection options and parameters by adding include ‘ARCH_DELETE_PRG_STANDARD2’.
3.4.4 Authorization check
Authorization object: /LOGWIN/CR
Authorization fields: SRV_NAME = (Program, transaction or function module name for current External log)
Activity = ‘24’ (Archive)
If the authorization does not pass, you have no authorization to delete the archive data.
3.4.5 Check ARO current DB archiving status
Check External Log status against current database /logwin/ext_log. If the GUID does not exist or the archiving status is not ‘30’ (archived), then ignore this External Log and go on to process the next one.
GUID-not-exist may happen when first delete run is not successful and current run is a re-run session. In this situation, some records may have already been deleted.
External Log status may be changed in the interval of write program and delete program execution. Thus, External Log status check is necessary.
3.4.6 Delete Methods
Detail information about calling deletion methods:
Method: /LOGWIN/CL_EXT_LOG_ACCESS=>DELETE_RECORD
Description: Delete a single record from the external rep.
Parameter name | Parameter text | Type | Source Value |
IV_GUID | Removal Requirement Basic Data | GUID_16 | Initial |
IV_TEST | Removal Requirement Basic Data | ABAP_BOOL | Check box on selection screen |
IV_TEST_ARCH_STATUS | Removal Requirement Basic Data | ABAP_BOOL | ABAP_FALSE |
CT_ARCH_STA | Table For the Transfer of Statistics Data to Archiving | ARCH_T_STA | Get from Log object in archiving file |
3.4.7 Further notes about delete-program
Delete commit counter should be retrieved by accessing the External Log archiving object configuration. In delete program, database commit work will be executed according to this commit counter.
3.5 Read Program
Processing program name: /LOGWIN/EXT_LOG_ARCHIVE_READ
Selection screen title: Read UI Logging Archiving
3.5.1 Archive File Filter
Creation date means the date when archived file was generated.
Archive file could be viewed in Archive File Browser (Transaction AS_AFB).
3.5.2 Archived External Log Filter
This part of the selection screen is identical with show external log program (/LOGWIN/SHOW_EXT_LOG_2), user could filter the external log records in archived file to be displayed.
3.5.3 Display of Archive Data Result
Result should be identical with show external log program(/LOGWIN/SHOW_EXT_LOG_2).
3.5.4 Processing Logic
Following is an external log archived file in Archive File Browser. All the external log file will be archived in object /LOGWIN/ET.
3.5.5 Read Archive file
Program will read all archived files which belongs to object ‘/LOGWIN/ET’ and archived file creation date should fulfill selection screen.
Then, will read each data record in each data object, convert data record into an internal table which has the following type: (structure could be extended for each technology)
3.5.6 Data conversion
/LOGWIN/CL_EXT_LOG_ACCESS~CONVERT_ARCHIVE_TO_DISPLAY will convert archived data.
For each record in /LOGWIN/EXT_LOG_ARCH_RECORD_T Convert /LOGWIN/EXT_LOG_ARCH_RECORD_S to:
/LOGWIN/EXT_LOG_STRTAB_DB_S~EDM_DATA /LOGWIN/EXT_LOG_STRTAB_DB_S~EDM_DATA_ENC | If the object has a EDM data model |
/LOGWIN/EXT_LOG_STRTAB_DB_S~INPUT_DATA_TAB /LOGWIN/EXT_LOG_STRTAB_DB_S~OUTPUT_DATA_TAB | If the object doesn’t have a EDM data model |
After data is converted, there is an authority object /LOGWINDC/ to check if data is to be decrypted, method ARCHIVE_DISPLAY_DECRYPT will be used to decrypt the data.
After all, the converted data will be filtered by the External Log Filter in the selection screen.
Extra customer BAdI /LOGWIN/EXT_LOG_BADI called at the very last of method CONVERT_ARCHIVE_TO_DISPLAY, customer could do their own conversion in method CONVERT_ARCHIVE_TO_DISPLAY.
3.5.7 Data Display
After conversion, data will be passed to a general show external log data interface.
3.6 Reload Program
3.6.1 Flow Chart
3.6.2 General Information
Authorization check should be taken in consideration to prevent un-authorized user from operation.
In the reloading process, program would insert corresponding EXTERNAL LOGS in LOGWIN DB which were Deleted before.
3.6.3 Selection Screen
Reload Program Name: /LOGWIN/EXT_LOG_ARCHIVE_RELOAD
Selection Screen Title: Reload Program: Reload Program for UI Logging
Include standard archiving selection options and parameters by adding include ‘arch_reload_prg_standard2’.
3.6.4 Authorization check
Authorization object: /LOGWIN/CR
Authorization fields: SRV_NAME = (Program, transaction or function module name for current EXTERNAL LOG)
Activity = ‘24’ (Archive)
3.6.5 Check EXTERNAL LOG current DB archiving status
Check EXTERNAL LOG status against current database /logwin/ext_log. If the corresponding external log is still existing. it will take no action and give a hint message.
3.6.6 Reload Methods
Detail information about calling deletion methods:
Method: /LOGWIN/CL_EXT_LOG_ACCESS=>RELOAD_DATA_FROM_ARCHIVE
Description: Write data back to the database from the archive
Parameter name | Parameter text | Type | Source Value |
IS_ARCHIVE_DATA | Removal Requirement Basic Data | /LOGWIN/EXT_LOG_ARCH_RECORD_S | Initial |
IV_TEST | Removal Requirement Basic Data | ABAP_BOOL | Check box on selection screen |
ES_RELOADED_DATA | Removal Requirement Basic Data | /LOGWIN/EXT_LOG_ARCH_RELOAD_S | ABAP_FALSE |
CT_ARCH_STA | Table For the Transfer of Statistics Data to Archiving | ARCH_T_STA | Get from EXTERNAL LOG object in archiving file |
3.7 Accessing archived data
Following are the approaches to access the archived external log.
- Standard ADK functions
Archiving file browser (T-code AS_AFB) is available to browse contents of all archived files. From the left tree of transaction main screen, archived file can be selected.
Note: Current solution does not include the read program. Therefore, it is not possible to read the archived file from transaction SARA.
3.8 Implementation Guide for External Log Archiving
Item no. | Step | Tcode | Comments |
1 | Create archiving object and maintain the related customizing | Tcode: AOBJ | For customizing details, please refer to 3.1 |
2 | Create archiving field catalogs and Infostructure | Tcode: SARJ ( Menu: Environment -> Field Catalogs ) | For customizing details, please refer to 3.2 |
3 | Assign archive authorization | Tcode: PFCG | Assign the auth. object: /LOGWIN/DC, /LOGWIN/CR with activity:24 |
4 | Execute archiving preprocessing program | Tcode: SARA (Click button: ) | |
6 | Execute archiving write program to create archive files | Tcode: SARA (Click button: ) | |
7 | Execute archiving delete program to delete data from database | Tcode: SARA (Click button: ) | |
8 | Access archived data | Tcode: AS_AFB | For details, please refer to 3.5 |
4 Verification of Constraints
4.1 Data Volumes
Not relevant.
4.2 Performance
Not relevant.
4.3 Data Protection
Not relevant.
4.4 Data Security
Not relevant.
4.5 Globalization
Not relevant.
4.6 Portability
Not relevant.
4.7 Compatibility to Previous Versions
Not relevant.
5 Appendix
5.1 Alternative Design Ideas
Not relevant.
5.2 Overview of Classification
Not relevant.
5.3 Overview of Modifications
No modifications on standard objects (objects in SAP namespace).
5.4 Out of Scope
Not relevant.
6 Points for Clarification