Your Record to Report - Period Close & Reconciliation Data Template
Your Record to Report - Period Close & Reconciliation Data Template
- Recommended attributes to collect
- Key activities to track
- Extraction guidance
Record to Report - Period Close & Reconciliation Attributes
| Name | Description | ||
|---|---|---|---|
| Financial Period FinancialPeriod | A unique identifier for the financial reporting cycle, typically combining the fiscal year and posting period. | ||
| Description The Financial Period serves as the primary case identifier, grouping all activities related to closing and reconciling accounts for that specific reporting cycle, such as '2023-12' for December 2023. This allows for a comprehensive analysis of the entire period close process from beginning to end for each distinct period. In analysis, it enables tracking the end-to-end cycle time for each close, comparing performance across different periods, and identifying trends or anomalies. By defining each financial period as a unique case, it's possible to visualize and measure the efficiency, bottlenecks, and variations in the close process over time. Why it matters It is the essential case identifier that frames the analysis, allowing for period-over-period comparisons of close cycle times, workloads, and process compliance. Where to get This attribute is typically derived by concatenating the Fiscal Year (GJAHR) and the Posting Period (MONAT) from financial document headers, for example, from the BKPF table. Examples 2023-122024-032023-Q4 | |||
| Activity ActivityName | The name of the specific business event or task performed during the period close process. | ||
| Description This attribute records the distinct steps undertaken within the Record to Report cycle, such as 'Adjusting Journal Entry Posted' or 'Financial Statements Generated'. It forms the backbone of the process map, showing the sequence of events that constitute the period close. Analyzing activities is fundamental to process mining. It helps visualize the process flow, identify the sequence of tasks, discover process variations, and measure the frequency and duration of each step. This is crucial for pinpointing bottlenecks, non-standard process paths, and opportunities for standardization or automation. Why it matters This attribute is mandatory for constructing the process map, allowing for the visualization and analysis of the sequence of tasks in the period close. Where to get This is derived from a combination of SAP transaction codes (TCODE), document types (BLART), or specific program executions (e.g., FAGL_FCV for Foreign Currency Valuation). Examples Adjusting Journal Entry PostedAccount Reconciliation StartedPeriod Closed For Posting | |||
| Event Time EventTime | The timestamp indicating when an activity or event occurred. | ||
| Description The Event Time provides the precise date and time for each activity in the process, serving as the chronological foundation for the analysis. It is typically a combination of the document creation date and time. This timestamp is essential for ordering events correctly to reconstruct the process flow. It is used to calculate all duration-based metrics, including cycle times between activities, waiting times, and the overall period close duration. Analyzing timestamps helps identify delays and understand the temporal distribution of work. Why it matters As a mandatory attribute, it provides the chronological order of events, which is necessary for calculating cycle times and discovering process bottlenecks. Where to get This is typically sourced from the document entry date (CPUDT) and entry time (CPUTM) in the BKPF table for financial documents. Examples 2023-12-28T14:30:15Z2024-01-02T09:05:00Z2024-01-05T17:21:45Z | |||
| Last Data Update LastDataUpdate | The timestamp when the data was last refreshed or extracted from the source system. | ||
| Description This attribute indicates the freshness of the data being analyzed. It shows the date and time the data pipeline last ran, providing context for the recency of the process insights. For dashboards, especially those tracking real-time progress, this timestamp is vital for users to understand if they are looking at up-to-the-minute information or data from a previous day. It manages user expectations and is crucial for interpreting the analysis correctly. Why it matters Informs users about the freshness of the data, which is critical for ensuring that analyses and dashboards are timely and relevant. Where to get This timestamp is generated and added by the data extraction or ETL tool at the end of each data loading process. Examples 2024-05-21T04:00:00Z2024-05-20T04:00:00Z2024-05-19T04:00:00Z | |||
| Source System SourceSystem | The identifier of the source system from which the data was extracted. | ||
| Description This attribute specifies the origin of the event data, such as the specific SAP ECC instance name or ID. In organizations with multiple ERPs or financial systems, this field is critical for distinguishing data from different sources. Even in a single-system landscape, it serves as a crucial piece of metadata for data governance, auditing, and troubleshooting. It confirms the provenance of the data, which is essential for building trust in the analysis and ensuring data lineage is clear. Why it matters Provides essential data lineage, confirming the origin of the data for governance, and is critical in multi-system landscapes to differentiate processes. Where to get This is typically a static value added during the data extraction process, identifying the specific SAP client and system ID (e.g., from table T000). Examples ECC_PROD_100SAP_E74_200ECC_FINANCE | |||
| Amount In Local Currency DMBTR | The financial value of a transaction line item, expressed in the company code's local currency. | ||
| Description This attribute represents the monetary value associated with a financial posting. It is the core quantitative measure of a transaction's impact on the general ledger. Analyzing the amount is crucial for prioritizing issues and understanding financial risk. For instance, the 'Adjusting Entries Volume Analysis' dashboard becomes much more powerful when it can distinguish between a high volume of low-value adjustments and a low volume of high-value adjustments. It helps focus attention on transactions that are financially material. Why it matters Quantifies the financial impact of transactions, allowing for analysis based on materiality, such as identifying high-value adjusting entries. Where to get Available in the document line item table, BSEG (DMBTR). Examples 1500.75-25000.00123456.00 | |||
| Company Code BUKRS | The organizational unit representing a legal entity for which financial statements are generated. | ||
| Description The Company Code is a fundamental organizational unit in SAP Financials. It represents an independent company with its own set of balanced books. All financial transactions are posted at the company code level. In process mining, filtering by Company Code is essential for comparing the period close process across different legal entities within a corporation. This allows for identifying best practices in high-performing entities and pinpointing entities that struggle with delays, high adjustment volumes, or process deviations. It is a key dimension for segmenting the analysis. Why it matters Allows for the comparison of period close performance and compliance across different legal entities, which is crucial for group-level financial analysis. Where to get This field is available in almost all financial document tables in SAP, primarily BKPF (Header) and BSEG (Line Item). Examples 10002000US01DE01 | |||
| Document Number BELNR | The unique identifier for an accounting document within a fiscal year and company code. | ||
| Description The Accounting Document Number is the primary key for financial postings in SAP. Each journal entry, invoice, or payment document is assigned a unique number. While not typically used for high-level process analysis, the document number is invaluable for drill-down capabilities. From a process mining dashboard, analysts can use the document number to navigate directly back to the specific transaction in SAP for detailed investigation of anomalies, such as a large adjusting entry or a delayed reconciliation item. It provides a direct link from the insight to the source transaction. Why it matters Provides a direct link to the source transaction in SAP, enabling detailed drill-down analysis from the process view into specific accounting entries. Where to get Located in the BKPF table (BELNR) as the primary key. Examples 100000456719000001233000008901 | |||
| Document Type BLART | A code that classifies different types of accounting documents. | ||
| Description The Document Type is used in SAP to distinguish between various business transactions, such as vendor invoices (KR), customer payments (DZ), and general ledger postings (SA). It also controls properties like the document number range. For period-end close analysis, the document type is a powerful filter. It can be used to isolate specific types of activities, such as accruals, provisions, or reversal entries. This helps in analyzing the volume and financial impact of different close-related transactions and can be used to define specific activities in the process model. Why it matters Helps classify and filter transactions, making it possible to isolate and analyze specific activities like accruals, reversals, or intercompany postings. Where to get Located in the document header table, BKPF (BLART). Examples SAABKR | |||
| GL Account HKONT | The General Ledger account number to which a line item is posted. | ||
| Description The General Ledger (GL) Account is a core master data element in finance that classifies transactions. Every financial posting is assigned to one or more GL accounts. In the context of period close, analyzing activities by GL account is essential for the 'Account Reconciliation Bottlenecks' and 'Adjusting Entries Volume Analysis' dashboards. It helps identify which accounts are most difficult to reconcile, which ones require the most adjustments, and where the risk of material misstatement may be highest. This focus allows teams to prioritize their efforts on problematic accounts. Why it matters Allows for targeted analysis of reconciliations and adjusting entries, helping to identify problematic accounts that cause delays or require frequent corrections. Where to get Available in the financial document line item table, BSEG (HKONT). Examples 113100400500750000 | |||
| Journal Entry Type JournalEntryType | A classification of journal entries, such as 'Standard', 'Adjusting', 'Accrual', or 'Reversal'. | ||
| Description This is a derived attribute that categorizes financial documents based on their business purpose within the close process. It is often determined by a combination of Document Type (BLART), Reversal Reason (STGRD), or specific GL accounts being used. This classification is fundamental for the 'Adjusting Entries Volume Analysis' dashboard and related KPIs. By explicitly identifying adjusting or accrual entries, analysts can measure their volume and value, track trends over time, and investigate the root causes for their necessity. It helps differentiate routine operational postings from period-end adjustments. Why it matters Categorizes postings for targeted analysis, enabling the tracking and measurement of key entry types like adjustments and accruals, which are indicators of process health. Where to get This is a derived field. Logic needs to be defined based on business rules, typically using fields like Document Type (BLART) from BKPF. Examples AdjustingAccrualReversalStandard | |||
| Responsible User USNAM | The SAP user ID of the person who created or executed the transaction. | ||
| Description This field captures the user who posted a document, ran a report, or executed a close-related program. It identifies the individual responsible for a given activity. Analyzing by user is critical for understanding workload distribution, identifying training needs, and investigating process deviations. Dashboards showing activities per user can highlight overburdened team members or individuals who may be following non-standard procedures. It also helps in performance management and resource allocation within the finance team. Why it matters Enables analysis of workload distribution, team performance, and identification of process deviations tied to specific individuals. Where to get Available in the BKPF table (USNAM) for document creation. For batch jobs, it can be found in TBTCO (SDLUNAME). Examples JSMITHRDOEFIN_ADMIN | |||
| Department Department | The functional department or cost center responsible for the activity or transaction. | ||
| Description This attribute identifies the business department, such as 'Finance', 'Sales', or 'Logistics', associated with a transaction. This is often derived from the Cost Center master data linked to a posting or the user's master data. Analyzing by department supports the 'Close Team Workload Distribution' dashboard. It helps to understand how different business functions contribute to the period-end workload, particularly in terms of initiating transactions that may require adjustments or reconciliations later. It can highlight areas outside of the core finance team that impact the close process. Why it matters Helps analyze workload and process adherence across different business functions, revealing how various departments impact the efficiency of the financial close. Where to get Often derived from the Cost Center (KOSTL) in BSEG or from the responsible user's HR master data. This may require joining multiple tables. Examples Corporate FinanceAccounts PayableFP&A | |||
| Fiscal Year GJAHR | The fiscal year in which the transaction was posted. | ||
| Description The Fiscal Year is a fundamental element for organizing financial data. It is a key component of the Financial Period case ID and provides essential context for all transactions. While often part of the case ID, having Fiscal Year as a separate attribute is useful for long-term trend analysis. It allows for year-over-year comparisons of close cycle times, adjustment volumes, or other KPIs, helping to identify improvements or degradations in performance over multiple years. Why it matters Provides essential temporal context and allows for year-over-year performance comparisons of the closing process. Where to get Available in the document header table, BKPF (GJAHR). Examples 202320242022 | |||
| Is Automated IsAutomated | A flag indicating whether an activity was performed by a human user or an automated system. | ||
| Description This boolean attribute distinguishes between manual tasks and those executed automatically by the system, such as a scheduled batch job for foreign currency valuation or a bot posting recurring entries. This is often determined by analyzing the user name associated with the transaction (e.g., 'BATCHUSER'). Understanding the level of automation is key to identifying opportunities for efficiency gains. Analyzing this attribute helps visualize which parts of the process are manual and potentially ripe for automation. It also helps in accurately assessing human workload by excluding system-generated activities. Why it matters Distinguishes between manual and system-driven activities, which is critical for identifying automation opportunities and accurately measuring manual workloads. Where to get This is a derived attribute. The logic is typically based on the User Name (USNAM), where a list of known system or batch user IDs indicates an automated task. Examples truefalse | |||
| Is Overdue IsOverdue | A calculated flag indicating if an activity was completed after its planned target date. | ||
| Description This boolean attribute compares the actual completion time of an activity (EventTime) with its planned deadline (TargetCompletionDate). If the event time is later than the target, the flag is set to true. This attribute directly supports the 'Close Compliance & Overdue Tasks' dashboard and the 'On-Time Period Close Rate' KPI. It provides a clear and immediate signal of schedule deviations, allowing managers to quickly identify late tasks, understand the impact on the overall timeline, and hold teams accountable for meeting deadlines. Why it matters Provides a clear indicator of non-compliance with schedules, allowing for quick identification of late tasks and measurement of on-time performance. Where to get This is a calculated attribute, computed in the process mining tool by comparing the EventTime to the TargetCompletionDate. Examples truefalse | |||
| Is Rework IsRework | A calculated flag that identifies activities that represent rework, such as a reversal or a rejected reconciliation. | ||
| Description This boolean attribute flags events or sequences of events that indicate inefficient loops or corrections in the process. For example, a 'Reconciliation Reviewed' activity followed by another 'Adjusting Journal Entry Posted' on the same account could be flagged as rework. This attribute is essential for quantifying process waste and supports the 'Reconciliation Rework Instances' dashboard and the 'Reconciliation Rework Rate' KPI. By isolating rework, teams can investigate the root causes, measure the impact on cycle time, and track the effectiveness of process improvement initiatives aimed at getting it right the first time. Why it matters Quantifies process inefficiency by flagging activities that are corrections or repetitions, helping to measure and reduce wasted effort. Where to get This is a calculated attribute. The logic is defined in the process mining tool based on specific activity sequences (e.g., loops) or attributes (e.g., ReversalReason is not null). Examples truefalse | |||
| Period Close Cycle Time PeriodCloseCycleTime | The total time elapsed from the start to the end of the period close process for a single financial period. | ||
| Description This calculated metric measures the end-to-end duration of the entire period close for one financial period. It is typically calculated as the time difference between the first and last recorded activities within that period. This is a primary Key Performance Indicator (KPI) for the Record to Report process. It provides a high-level measure of the overall efficiency of the close. Dashboards visualizing this metric over time are essential for tracking progress towards strategic goals like accelerating the close. Why it matters This is a critical KPI that measures the overall efficiency and speed of the financial close, directly supporting strategic objectives to shorten closing cycles. Where to get This is a calculated metric, computed within the process mining tool by taking the difference between the maximum and minimum EventTime for each FinancialPeriod (CaseId). Examples 5 days 4 hours 30 minutes6.2 days120.5 hours | |||
| Reconciliation Status ReconciliationStatus | The current status of an account reconciliation, such as 'Open', 'In Review', or 'Approved'. | ||
| Description This attribute tracks the state of an account reconciliation as it moves through its workflow. It indicates whether a reconciliation has been started, submitted for review, approved, or rejected. This is a key attribute for monitoring the progress of reconciliation activities in real-time. It helps identify which reconciliations are stuck and for how long, supporting KPIs like 'Account Reconciliation Cycle Time'. It provides visibility into the approval process and is crucial for dashboards that track reconciliation bottlenecks and team workload. Why it matters Provides visibility into the reconciliation workflow, enabling the tracking of progress, identification of bottlenecks, and measurement of review and approval times. Where to get This information often resides in a separate reconciliation tool (e.g., SAP Account Substantiation and Automation by BlackLine) or a custom status field. It is not typically a standard field in BKPF/BSEG. Examples Not StartedIn ProgressApprovedRejected | |||
| Reversal Reason ReversalReason | A code indicating the reason why a financial document was reversed. | ||
| Description When a document is reversed in SAP, a reason code can be assigned to explain the purpose of the reversal, for example, 'Reversal in current period' or 'Incorrect entry'. This attribute provides critical context for why rework is occurring. Analyzing reversal reasons helps to identify patterns in errors, such as incorrect data entry or wrong dates. This insight can be used to implement preventative measures, improve training, or enhance system controls to reduce the number of errors and subsequent reversals, leading to a more efficient close. Why it matters Provides direct insight into the root causes of errors and rework, helping to identify opportunities for process improvement and error prevention. Where to get Located in the document header table, BKPF (STGRD). Examples 010205 | |||
| Target Completion Date TargetCompletionDate | The planned deadline or due date for an activity or the entire period close. | ||
| Description The Target Completion Date represents the schedule against which the period close process is measured. It is the deadline by which specific milestones or the final close should be completed. This attribute is essential for any performance or compliance-related analysis. It is used to calculate the 'On-Time Period Close Rate' KPI and to power the 'Close Compliance & Overdue Tasks' dashboard. By comparing the actual event time against this target date, the system can determine if tasks are on-track, late, or at risk of being late, enabling proactive management of the close process. Why it matters Enables compliance and performance monitoring by providing a baseline to measure if close activities are completed on time, supporting on-time delivery KPIs. Where to get This is typically master data maintained in a separate calendar, a closing cockpit tool (like SAP Financial Closing cockpit), or a spreadsheet. It is not part of transactional data. Examples 2023-12-29T23:59:59Z2024-01-03T17:00:00Z2024-01-02T12:00:00Z | |||
| Trading Partner VBUND | The identifier of the affiliated group company involved in an intercompany transaction. | ||
| Description The Trading Partner ID is used to identify the other company code participating in an intercompany transaction. This is essential for the reconciliation of accounts between related legal entities. This attribute directly supports the 'Intercompany Reconciliation Flow' dashboard and the 'Intercompany Recon. Cycle Time' KPI. By filtering for transactions where a Trading Partner is present, the analysis can focus specifically on the efficiency and timeliness of the intercompany reconciliation process, which is often a major pain point during the period close. Why it matters Specifically identifies intercompany transactions, enabling focused analysis on the often complex and time-consuming intercompany reconciliation process. Where to get Found in the document line item table, BSEG (VBUND). Examples 1000US013000 | |||
Record to Report - Period Close & Reconciliation Activities
| Activity | Description | ||
|---|---|---|---|
| Account Reconciliation Started | Represents the beginning of the reconciliation process for a set of GL accounts for the period. In standard SAP ECC, this is not a discrete event and is typically inferred from related activities, such as running a key report for the first time. | ||
| Why it matters This activity establishes a key milestone to measure the duration of the entire reconciliation phase. Understanding when reconciliation begins is essential for the Account Reconciliation Cycle Time KPI. Where to get This event is not explicitly logged. It must be inferred from other data sources, such as the system audit log (transaction STAD) for the first execution of a balance display report like FAGLB03 or FS10N. Capture Infer from first run of relevant report transactions (e.g., FAGLB03) in system logs. Event type inferred | |||
| Adjusting Journal Entry Posted | An adjusting journal entry is posted to correct account balances after initial transaction processing is complete for the period. This event is captured as a standard financial document posting in SAP. | ||
| Why it matters This is essential for the Adjusting Entries Volume Analysis. A high volume of adjustments suggests issues with upstream process accuracy and is a key target for process improvement initiatives. Where to get Found in tables BKPF and BSEG. These entries are typically identified by a specific document type (BKPF-BLART) reserved for adjustments, or by being posted in special closing periods, such as 13 through 16. Capture Filter BKPF for documents posted in special periods or with adjustment document types. Event type explicit | |||
| Financial Statements Generated | This represents the point in time when official financial statements, such as the Profit and Loss Statement and Balance Sheet, are generated. This activity is typically captured by tracking the execution of a specific reporting program. | ||
| Why it matters This is a major milestone that marks the end of data processing and the start of the final review and approval phase. The time from this event to approval is a key KPI. Where to get Inferred from system audit logs, such as STAD, that record the execution of the financial statement generation program, most commonly transaction F.01. Capture From system logs (STAD) tracking execution of financial statement transaction F.01. Event type inferred | |||
| Foreign Currency Valuation Run | This represents the execution of a program to revalue open items and balances recorded in foreign currencies using period-end exchange rates. This is typically run as a batch job as part of the period-end closing steps. | ||
| Why it matters This is a critical step for ensuring accurate financial reporting in multinational organizations. Analyzing its timing and duration helps identify automation and performance optimization opportunities. Where to get Captured from the execution logs of the foreign currency valuation program, such as FAGL_FCV or F.05. Batch job details from tables like TBTCO and TBTCP provide execution timestamps. Capture From batch job logs (table TBTCO) for program FAGL_FC_VALUATION or SAPF100. Event type explicit | |||
| Period Closed For Posting | Represents the formal closing of a posting period, which prevents further operational journal entries. This ensures the integrity of the financial data for the closed period and is an explicit configuration change. | ||
| Why it matters This is the definitive end event for the period close process. It is essential for accurately calculating the total Period Close Cycle Time and measuring on-time performance. Where to get The closing of periods via transaction OB52 is recorded. These changes can be found by analyzing the change documents (tables CDHDR and CDPOS) for the configuration table T001B. Capture Extract from change documents (CDHDR/CDPOS) for table T001B. Event type explicit | |||
| Period Opened For Posting | This marks the official start of a financial period, allowing transactions to be posted to the general ledger. This is an explicit configuration change performed by an authorized user to open a specific period for postings in one or more company codes. | ||
| Why it matters This activity serves as the definitive start event for the period close process case. Analyzing the time from this point helps in understanding the full lifecycle of the financial period. Where to get Changes to posting periods via transaction OB52 are logged. These changes can be extracted by analyzing the change documents for the underlying configuration table T001B, typically using tables CDHDR and CDPOS. Capture Extract from change documents (CDHDR/CDPOS) for table T001B. Event type explicit | |||
| Accrual Or Provision Posted | This represents the recording of a journal entry for an accrual, deferral, or provision, which are typically posted towards the end of a period. This is not a distinct event type in SAP but is inferred by identifying specific journal entries based on their characteristics. | ||
| Why it matters Isolating these entries helps analyze the sub-process for managing estimations. A high volume or frequent adjustments to accruals can indicate areas for process improvement. Where to get Inferred from the finance document tables BKPF and BSEG. Entries can be identified by filtering on a specific document type (BKPF-BLART), a unique GL account (BSEG-HKONT), or keywords in the header text (BKPF-BKTXT). Capture Filter BKPF/BSEG tables on document type, specific GL accounts, or text fields. Event type inferred | |||
| GR/IR Clearing Run Executed | The execution of the automated clearing program for the Goods Receipt/Invoice Receipt account. This program matches corresponding goods receipts and invoice receipts and clears the items against each other. | ||
| Why it matters The GR/IR account is a frequent source of reconciliation issues. Monitoring this activity ensures the automated step runs correctly and helps quantify the volume of exceptions requiring manual follow-up. Where to get Execution is captured in batch job logs (transaction SM37). The program is typically SAPF124, executed via transaction F.13. Job log tables like TBTCO provide the necessary timestamps. Capture From batch job logs (table TBTCO) for clearing program SAPF124. Event type explicit | |||
| Intercompany Document Cleared | This activity marks the clearing of an open item between two different company codes, signifying that an intercompany transaction has been settled or reconciled. This is recorded as an explicit financial posting in SAP, typically a clearing document. | ||
| Why it matters Delays in clearing intercompany items are a common bottleneck in the closing process. Tracking this activity is critical for measuring and improving the intercompany reconciliation cycle time. Where to get Identified from financial documents in BKPF and BSEG. A clearing document links to and closes open items, and its clearing date (BSEG-AUGDT) serves as the event timestamp. Intercompany transactions are identified by trading partner fields. Capture Identify clearing documents in BKPF/BSEG that involve items with trading partners. Event type explicit | |||
| Reconciliation Reviewed | Indicates that a reconciliation for a specific account or group of accounts has been reviewed and confirmed. In standard SAP ECC, this is not an explicitly logged event and is often managed through offline controls or custom solutions. | ||
| Why it matters Tracking the timing of reviews is important for understanding bottlenecks in the control and oversight stages of the closing process. It can highlight delays caused by management availability or rework. Where to get This information is not available in standard ECC tables. It would require a custom solution, such as a status field in a custom Z-table, a simple workflow, or integration with a specialized third-party reconciliation tool. Capture Capture status change from a custom workflow or Z-table if implemented. Event type inferred | |||
| Reversal Entry Posted | This activity captures the posting of a document that reverses a previously posted journal entry, often to correct an error. SAP creates an explicit link between the reversal document and the original document. | ||
| Why it matters A high number of reversals points to potential issues with data entry accuracy or process controls. Tracking these events helps measure first-time-right rates and identify areas needing improvement. Where to get Reversal documents are found in the BKPF table. They are often created with transaction FB08 and contain a reference to the reversed document number in the BKPF-STBLG field. Capture Identify documents where BKPF-STBLG is populated or created via reversal T-codes. Event type explicit | |||
| Trial Balance Report Generated | Marks the execution of a report to generate the trial balance. This is a key step to verify that total debits equal total credits before creating the official financial statements. | ||
| Why it matters This is a critical quality gate before final reporting. Repeated executions of this report may indicate that underlying data issues are being found and corrected, potentially causing delays. Where to get Inferred from system audit logs, like transaction STAD, which can record the execution of trial balance reporting transactions such as S_ALR_87012277 or F.01. Capture From system logs (STAD) tracking execution of reporting transaction codes. Event type inferred | |||
Extraction Guides
Steps
- Access SAP Query Tool: Log in to your SAP ECC system. Go to transaction code
SQVI(QuickViewer). 2. Create New Query: Enter a name for your query, for example,Z_R2R_PERIOD_CLOSE, and click 'Create'. In the pop-up, provide a descriptive title like 'Record to Report Period Close Extraction'. For the 'Data source', select 'Table join'. 3. Define Table Joins: Add the primary tableBKPF(Accounting Document Header). Then, add the tableBSEG(Accounting Document Segment). SAP will propose the join conditions automatically (MANDT, BUKRS, BELNR, GJAHR), which you should verify and accept. For period open and close activities, you will need a separate query joiningCDHDRandCDPOS. 4. Select Output Fields (List Fields): Navigate to the 'List fld. select.' tab. Select the fields required for the event log from the available tables. This includesBKPF-BUKRS,BKPF-BELNR,BKPF-GJAHR,BKPF-MONAT,BKPF-CPUDT,BKPF-CPUTM,BKPF-USNAM,BKPF-BLART,BSEG-HKONT,BSEG-DMBTR, and others as needed. 5. Define Input Parameters (Selection Fields): Navigate to the 'Selection fields' tab. Choose the fields that will be used to filter the data during execution. The most important fields areBKPF-BUKRS(Company Code) andBKPF-GJAHR(Fiscal Year). You may also addBKPF-MONAT(Posting Period) andBKPF-BLART(Document Type). 6. Create Variants for Each Activity: Because SQVI cannot combine different data selections (like a SQL UNION), you must run the query multiple times. For each activity (e.g., 'Accrual Or Provision Posted'), execute the query and enter specific filter values on the selection screen, such as a list of document types relevant to accruals. Save this set of selection criteria as a variant. Repeat this process for each extractable activity. 7. Execute and Extract Data: Execute the query for each variant you created. This will run the query with the specific filters for that activity. 8. Export Results: In the results screen, export the data to a local file. The most common format is 'Spreadsheet'. Repeat the export for each variant. 9. Combine and Transform Data: Open the exported files in a spreadsheet program or use a scripting tool. Manually combine the data from all files into a single master file. 10. Add Constant and Calculated Columns: In the combined file, add the columns that are not directly extracted from SAP tables. This includesActivityName(manually set this based on which variant the data came from),FinancialPeriod(by concatenating Fiscal Year and Period),EventTime(by combining date and time fields),SourceSystem, andLastDataUpdate. 11. Format for Upload: Ensure the final file is saved in a CSV or Excel format with the correct column headers as required for your process mining tool. Verify data types and formatting before uploading.
Configuration
- Data Source: Table Join in SAP Query (SQVI). Key tables are BKPF, BSEG, CDHDR, and CDPOS. * Date Range: It is recommended to extract data for a period of at least 3 to 6 full financial periods to identify patterns. Set the filter on
BKPF-GJAHR(Fiscal Year) andBKPF-MONAT(Period). * Company Code Filter: Always filter byBKPF-BUKRS(Company Code) to limit the data volume and focus the analysis on specific legal entities. Extracting for all company codes at once is not recommended. * Document Type Filter: Use filters onBKPF-BLART(Document Type) to isolate specific activities like accruals, adjustments, or reversals. You will need to get the relevant document types for your organization. * Prerequisites: The user running the extraction requires authorization to use theSQVItransaction and display access to the relevant financial tables (e.g., authorization object S_TABU_DIS). * Performance Considerations: Joining BKPF and BSEG can be resource-intensive. Run the extraction during off-peak hours. Avoid using very wide date ranges or leaving the Company Code filter open, as this can lead to memory issues or timeouts.
a Sample Query config
/*
LOGICAL REPRESENTATION FOR SAP QUERY (SQVI)
This is not a single executable script. Due to limitations in SQVI, you must create a base query joining BKPF and BSEG, then run it multiple times using different selection screen variants to extract each activity below. The results must be combined manually.
A separate query joining CDHDR and CDPOS is needed for period open/close activities.
*/
-- Activity 1: Period Opened For Posting
-- Required Query: Join CDHDR and CDPOS in SQVI.
SELECT
CONCAT(T001B.VONJ1, T001B.POPER) AS FinancialPeriod,
'Period Opened For Posting' AS ActivityName,
TO_TIMESTAMP(CONCAT(CDHDR.UDATE, CDHDR.UTIME), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
T001B.BUKRS AS BUKRS,
NULL AS BELNR,
CDHDR.USERNAME AS USNAM,
NULL AS HKONT,
NULL AS BLART,
NULL AS DMBTR,
NULL AS JournalEntryType
FROM CDHDR
JOIN CDPOS ON CDHDR.CHANGENR = CDPOS.CHANGENR
JOIN T001B ON SUBSTRING(CDPOS.TABKEY, 4, 4) = T001B.BUKRS
WHERE CDHDR.OBJECTCLAS = 'DEBI_BUKRS' AND CDPOS.TABNAME = 'T001B' AND CDPOS.FNAME = 'OFPER' AND CDPOS.VALUE_NEW > CDPOS.VALUE_OLD;
UNION ALL
-- Activity 2: Accrual Or Provision Posted
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'Accrual Or Provision Posted' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.BELNR AS BELNR,
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Accrual' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BKPF.BLART IN ('SA', '[Your Accrual Doc Type]'); -- Filter by document types used for accruals
UNION ALL
-- Activity 3: Intercompany Document Cleared
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'Intercompany Document Cleared' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.AUGBL AS BELNR, -- The clearing document number
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Clearing' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BSEG.AUGBL IS NOT NULL AND BSEG.VBUND IS NOT NULL; -- Identify cleared items with an intercompany trading partner
UNION ALL
-- Activity 4: Foreign Currency Valuation Run
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'Foreign Currency Valuation Run' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.BELNR AS BELNR,
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Valuation' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BKPF.TCODE IN ('FAGL_FCV', 'FBB1'); -- Filter by FCV transaction code
UNION ALL
-- Activity 5: GR/IR Clearing Run Executed
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'GR/IR Clearing Run Executed' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.BELNR AS BELNR,
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Clearing' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BKPF.TCODE IN ('F.13', 'F13E'); -- Filter by automated clearing transaction codes
UNION ALL
-- Activity 6: Account Reconciliation Started (Proxy)
-- This is a proxy. It takes the earliest adjusting journal entry timestamp for the period.
SELECT
A.FinancialPeriod,
'Account Reconciliation Started' AS ActivityName,
MIN(A.EventTime) AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
A.BUKRS,
NULL AS BELNR,
NULL AS USNAM,
NULL AS HKONT,
NULL AS BLART,
NULL AS DMBTR,
NULL AS JournalEntryType
FROM (
SELECT CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
BKPF.BUKRS
FROM BKPF
WHERE BKPF.BLART IN ('AB', '[Your Adjusting Doc Type]')
) AS A
GROUP BY A.FinancialPeriod, A.BUKRS;
UNION ALL
-- Activity 7: Adjusting Journal Entry Posted
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'Adjusting Journal Entry Posted' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.BELNR AS BELNR,
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Adjusting' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BKPF.BLART IN ('AB', '[Your Adjusting Doc Type]'); -- Filter by document types for adjustments
UNION ALL
-- Activity 8: Reversal Entry Posted
SELECT
CONCAT(BKPF.GJAHR, BKPF.MONAT) AS FinancialPeriod,
'Reversal Entry Posted' AS ActivityName,
TO_TIMESTAMP(CONCAT(BKPF.CPUDT, BKPF.CPUTM), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
BKPF.BUKRS AS BUKRS,
BKPF.BELNR AS BELNR,
BKPF.USNAM AS USNAM,
BSEG.HKONT AS HKONT,
BKPF.BLART AS BLART,
BSEG.DMBTR AS DMBTR,
'Reversal' AS JournalEntryType
FROM BKPF
JOIN BSEG ON BKPF.BUKRS = BSEG.BUKRS AND BKPF.BELNR = BSEG.BELNR AND BKPF.GJAHR = BSEG.GJAHR
WHERE BKPF.STBLG IS NOT NULL; -- STBLG (Reversed Document Number) is populated for reversals
UNION ALL
-- Activity 9: Period Closed For Posting
-- Required Query: Join CDHDR and CDPOS in SQVI.
SELECT
CONCAT(T001B.VONJ1, T001B.POPER) AS FinancialPeriod,
'Period Closed For Posting' AS ActivityName,
TO_TIMESTAMP(CONCAT(CDHDR.UDATE, CDHDR.UTIME), 'YYYYMMDDHH24MISS') AS EventTime,
'[SAP ECC SID]' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
T001B.BUKRS AS BUKRS,
NULL AS BELNR,
CDHDR.USERNAME AS USNAM,
NULL AS HKONT,
NULL AS BLART,
NULL AS DMBTR,
NULL AS JournalEntryType
FROM CDHDR
JOIN CDPOS ON CDHDR.CHANGENR = CDPOS.CHANGENR
JOIN T001B ON SUBSTRING(CDPOS.TABKEY, 4, 4) = T001B.BUKRS
WHERE CDHDR.OBJECTCLAS = 'DEBI_BUKRS' AND CDPOS.TABNAME = 'T001B' AND CDPOS.FNAME = 'OFPER' AND CDPOS.VALUE_NEW < CDPOS.VALUE_OLD;
/*
-- Activities Not Extractable via this Method
-- The following activities are not data postings and cannot be reliably extracted by querying finance tables BKPF/BSEG.
-- Extraction would require analyzing application logs (SLG1), system logs (STAT), or custom-built logging solutions.
-- Activity: Trial Balance Report Generated
-- Activity: Financial Statements Generated
-- Activity: Reconciliation Reviewed
*/ Steps
- Program Scoping and Design: Define the specific logic for identifying each of the 12 required activities. Consult with business process owners and SAP functional analysts to confirm the document types, G/L accounts, and program names associated with period-end closing activities in your specific SAP ECC environment.
- Create ABAP Program: Using transaction
SE38(ABAP Editor), create a new executable program, for example,Z_PM_R2R_EXTRACTION. Provide a descriptive title and set the program type to 'Executable Program'. - Define Selection Screen: In the program, define a selection screen using
PARAMETERSandSELECT-OPTIONS. This screen will allow users to specify the extraction scope, including Company Code (BUKRS), Fiscal Year (GJAHR), and Posting Period (MONAT). This is crucial for controlling the data volume. - Declare Data Structures: Define an internal table structure that will hold the final event log data. This structure must include all required and recommended attributes:
FinancialPeriod,ActivityName,EventTime,SourceSystem,LastDataUpdate,BUKRS,BELNR,USNAM,HKONT,BLART,DMBTR, andJournalEntryType. - Implement Data Extraction Logic: Write the core ABAP logic to select data for each of the 12 activities. For each activity, query the relevant SAP tables (e.g., BKPF, BSEG, TBTCO, CDHDR) and populate an intermediate internal table. Use the logic provided in the accompanying ABAP query section as a template.
- Identify Inferred Activities: For activities not explicitly logged in standard SAP, such as 'Account Reconciliation Started' or 'Reconciliation Reviewed', implement the agreed-upon inference logic. This may involve checking for the first run of a specific report or querying custom 'Z-tables' if they exist.
- Consolidate Event Data: After extracting data for all individual activities, append the records from each intermediate table into the final consolidated internal table. Ensure the
EventTimefield is populated correctly from the relevant source field, such as document posting date/time or job start date/time. - Standardize and Format Data: Before output, standardize key fields. Combine the fiscal year and period into the
FinancialPeriodidentifier. Set static values forSourceSystemandLastDataUpdate. Ensure timestamps are in a consistent format. - Develop Output Functionality: Add functionality to the program to export the final internal table. The most common method is to write the data to a CSV or tab-delimited file on the SAP Application Server (using
OPEN DATASET) or to allow the user to download it directly to their local machine (using function moduleGUI_DOWNLOAD). - Test and Validate: Thoroughly test the program with a representative dataset covering multiple company codes and periods. Use the validation steps to ensure data accuracy and completeness. Refine the selection logic based on feedback from functional experts.
- Schedule Execution (Optional): Once validated, the program can be scheduled to run as a background job via transaction
SM36. This allows for automated, periodic extraction of the event log without manual intervention.
Configuration
- Selection Criteria: The program should have a selection screen to filter the data. Key filters include:
Company Code (BUKRS): Mandatory to limit the scope to relevant legal entities.Fiscal Year (GJAHR): Mandatory to define the primary year for the extraction.Posting Period (MONAT): Mandatory to select the specific financial periods.
- Activity-Specific Configuration: Many selections depend on your specific SAP configuration. These should be configurable as parameters or constants within the program:
Accrual/Provision Document Types: A list of document types (BLART) used to identify accrual and provision postings.Adjusting Entry Document Types: A list of document types used to identify adjusting journal entries.Background Job/Program Names: The technical names of the programs used for Foreign Currency Valuation (e.g.,FAGL_FCV), GR/IR Clearing (e.g.,SAPF124), Trial Balance reports, and Financial Statement generation (e.g.,RFBILA00).
- Date Range: While the primary selection is by fiscal year and period, the underlying logic should consider the full date and time of events. For an initial analysis, extracting data for the last 3 to 6 completed financial periods is recommended.
- Performance: For large SAP environments, the program's performance is critical. Ensure database selections use index fields, especially on tables like
BKPFandBSEG. Avoid selecting all fields (SELECT *) and process data in manageable packages if necessary. - Authorizations: The user or service account running this program requires authorization to access all queried tables (
BKPF,BSEG,TBTCO,TBTCP,CDHDR,CDPOS) and to execute transactions likeSE38(for development) andSM37/SM36(for scheduling and monitoring).
a Sample Query abap
REPORT Z_PM_R2R_EXTRACTION.
" ====================================================================
" DATA DECLARATIONS
" ====================================================================
TYPES: BEGIN OF ty_event_log,
FinancialPeriod TYPE string,
ActivityName TYPE string,
EventTime TYPE timestamp,
SourceSystem TYPE string,
LastDataUpdate TYPE timestamp,
BUKRS TYPE bukrs,
BELNR TYPE belnr_d,
USNAM TYPE usnam,
HKONT TYPE hkont,
BLART TYPE blart,
DMBTR TYPE dmbtr,
JournalEntryType TYPE string,
END OF ty_event_log.
DATA: lt_final_log TYPE STANDARD TABLE OF ty_event_log,
ls_log_entry LIKE LINE OF lt_final_log.
DATA: lv_source_system TYPE string VALUE 'SAP ECC'.
GET TIME STAMP FIELD ls_log_entry-LastDataUpdate.
" ====================================================================
" SELECTION SCREEN
" ====================================================================
SELECT-OPTIONS: s_bukrs FOR ls_log_entry-bukrs OBLIGATORY,
s_gjahr FOR bkpf-gjahr OBLIGATORY,
s_monat FOR bkpf-monat OBLIGATORY.
PARAMETERS: p_accrl TYPE blart DEFAULT 'SA', " Example Doc Type for Accruals
p_adjst TYPE blart DEFAULT 'AJ', " Example Doc Type for Adjustments
p_fcv TYPE btcjob DEFAULT 'FAGL_FCV*', " Program for FC Valuation
p_grir TYPE btcjob DEFAULT 'SAPF124*', " Program for GR/IR Clearing
p_fs TYPE btcjob DEFAULT 'RFBILA00'. " Program for Fin. Statements
" ====================================================================
" MAIN LOGIC
" ====================================================================
START-OF-SELECTION.
" --- 1. Period Opened For Posting ---
" Note: This is complex. This example queries change documents for posting period config (T001B).
SELECT h~objectid, h~udate, h~utime, h~username
INTO TABLE @DATA(lt_period_open)
FROM cdhdr AS h
WHERE h~objectclas = 'V_T001B' AND h~change_ind = 'U'.
LOOP AT lt_period_open INTO DATA(ls_period_open).
" Further logic needed to parse OBJECTID and check CDPOS for opening a period.
" This is a simplified placeholder for a complex logic.
ls_log_entry-ActivityName = 'Period Opened For Posting'.
" Populate other fields... append to lt_final_log
ENDLOOP.
" --- 2. Accrual Or Provision Posted ---
SELECT h~bukrs, h~belnr, h~gjahr, h~monat, h~blart, h~usnam, h~cputm, h~cpudt, i~hkont, i~dmbtr
FROM bkpf AS h JOIN bseg AS i ON h~belnr = i~belnr AND h~bukrs = i~bukrs AND h~gjahr = i~gjahr
INTO CORRESPONDING FIELDS OF TABLE @DATA(lt_accrual)
WHERE h~bukrs IN @s_bukrs AND h~gjahr IN @s_gjahr AND h~monat IN @s_monat AND h~blart = @p_accrl.
LOOP AT lt_accrual INTO DATA(ls_accrual).
CLEAR ls_log_entry.
CONVERT DATE ls_accrual-cpudt TIME ls_accrual-cputm INTO TIME STAMP ls_log_entry-EventTime TIME ZONE sy-zonlo.
CONCATENATE ls_accrual-gjahr ls_accrual-monat INTO ls_log_entry-FinancialPeriod.
ls_log_entry-ActivityName = 'Accrual Or Provision Posted'.
ls_log_entry-BUKRS = ls_accrual-bukrs.
ls_log_entry-BELNR = ls_accrual-belnr.
ls_log_entry-USNAM = ls_accrual-usnam.
ls_log_entry-HKONT = ls_accrual-hkont.
ls_log_entry-BLART = ls_accrual-blart.
ls_log_entry-DMBTR = ls_accrual-dmbtr.
ls_log_entry-JournalEntryType = 'Accrual'.
GET TIME STAMP FIELD ls_log_entry-LastDataUpdate.
ls_log_entry-SourceSystem = lv_source_system.
APPEND ls_log_entry TO lt_final_log.
ENDLOOP.
" --- 3. Intercompany Document Cleared ---
SELECT h~bukrs, h~belnr, h~gjahr, h~monat, h~blart, h~usnam, h~cputm, h~cpudt, i~hkont, i~dmbtr
FROM bkpf AS h JOIN bseg AS i ON h~belnr = i~belnr AND h~bukrs = i~bukrs AND h~gjahr = i~gjahr
INTO CORRESPONDING FIELDS OF TABLE @DATA(lt_ic_clear)
WHERE h~bukrs IN @s_bukrs AND h~gjahr IN @s_gjahr AND h~monat IN @s_monat
AND h~blart = 'AB' AND i~vbund <> space.
LOOP AT lt_ic_clear INTO DATA(ls_ic_clear).
" Populate ls_log_entry and append to lt_final_log, setting ActivityName = 'Intercompany Document Cleared'
ENDLOOP.
" --- 4. Foreign Currency Valuation Run ---
SELECT j~jobname, j~sdlstrtda, j~sdlstrttm, j~sdluname
INTO TABLE @DATA(lt_fcv_jobs)
FROM tbtco AS j
WHERE j~jobname LIKE @p_fcv AND j~status = 'F'. " F = Finished
LOOP AT lt_fcv_jobs INTO DATA(ls_fcv_job).
" Populate ls_log_entry, deriving FinancialPeriod from date, setting ActivityName = 'Foreign Currency Valuation Run'
ENDLOOP.
" --- 5. GR/IR Clearing Run Executed ---
SELECT j~jobname, j~sdlstrtda, j~sdlstrttm, j~sdluname
INTO TABLE @DATA(lt_grir_jobs)
FROM tbtco AS j
WHERE j~jobname LIKE @p_grir AND j~status = 'F'.
LOOP AT lt_grir_jobs INTO DATA(ls_grir_job).
" Populate ls_log_entry, deriving FinancialPeriod from date, setting ActivityName = 'GR/IR Clearing Run Executed'
ENDLOOP.
" --- 6. Account Reconciliation Started (Inferred) ---
" Note: Inferring this by first run of a report, e.g., FAGLB03. Requires custom logging or complex logic.
" Placeholder: Query a custom log table if available.
" SELECT ... FROM zreco_log ...
" --- 7. Adjusting Journal Entry Posted ---
SELECT h~bukrs, h~belnr, h~gjahr, h~monat, h~blart, h~usnam, h~cputm, h~cpudt, i~hkont, i~dmbtr
FROM bkpf AS h JOIN bseg AS i ON h~belnr = i~belnr AND h~bukrs = i~bukrs AND h~gjahr = i~gjahr
INTO CORRESPONDING FIELDS OF TABLE @DATA(lt_adjust)
WHERE h~bukrs IN @s_bukrs AND h~gjahr IN @s_gjahr AND h~monat IN @s_monat AND h~blart = @p_adjst.
LOOP AT lt_adjust INTO DATA(ls_adjust).
" Populate ls_log_entry and append, setting ActivityName = 'Adjusting Journal Entry Posted', JournalEntryType = 'Adjusting'
ENDLOOP.
" --- 8. Reversal Entry Posted ---
SELECT h~bukrs, h~belnr, h~gjahr, h~monat, h~blart, h~usnam, h~cputm, h~cpudt, i~hkont, i~dmbtr
FROM bkpf AS h JOIN bseg AS i ON h~belnr = i~belnr AND h~bukrs = i~bukrs AND h~gjahr = i~gjahr
INTO CORRESPONDING FIELDS OF TABLE @DATA(lt_reversal)
WHERE h~bukrs IN @s_bukrs AND h~gjahr IN @s_gjahr AND h~monat IN @s_monat AND h~stblg <> space.
LOOP AT lt_reversal INTO DATA(ls_reversal).
" Populate ls_log_entry and append, setting ActivityName = 'Reversal Entry Posted', JournalEntryType = 'Reversal'
ENDLOOP.
" --- 9. Trial Balance Report Generated (Inferred from Job) ---
" Similar to other jobs, query TBTCO for Trial Balance report programs.
" SELECT ... FROM tbtco ... WHERE jobname LIKE '[Your Trial Balance Program]'.
" --- 10. Financial Statements Generated ---
SELECT j~jobname, j~sdlstrtda, j~sdlstrttm, j~sdluname
INTO TABLE @DATA(lt_fs_jobs)
FROM tbtco AS j
WHERE j~jobname LIKE @p_fs AND j~status = 'F'.
LOOP AT lt_fs_jobs INTO DATA(ls_fs_job).
" Populate ls_log_entry, deriving FinancialPeriod from date, setting ActivityName = 'Financial Statements Generated'
ENDLOOP.
" --- 11. Reconciliation Reviewed (Inferred) ---
" Note: This activity is almost always managed outside of SAP or in a custom solution.
" Placeholder: Query a custom approval/log table if available.
" SELECT ... FROM zreco_approval ...
" --- 12. Period Closed For Posting ---
" Note: Similar to 'Period Opened', this is very complex. Query change documents for T001B.
SELECT h~objectid, h~udate, h~utime, h~username
INTO TABLE @DATA(lt_period_close)
FROM cdhdr AS h
WHERE h~objectclas = 'V_T001B' AND h~change_ind = 'U'.
LOOP AT lt_period_close INTO DATA(ls_period_close).
" Further logic needed to parse OBJECTID and check CDPOS for closing a period.
ls_log_entry-ActivityName = 'Period Closed For Posting'.
" Populate other fields... append to lt_final_log
ENDLOOP.
" ... Code to display or download the lt_final_log internal table ...
ENDFORMS. Steps
- Gather Prerequisites: Obtain read-only access credentials for the underlying SAP ECC database. Identify the correct database schema, which is typically
SAPSR3or a similar name provided by your database administrator. - Identify System Configuration: Consult with your SAP Finance team to determine the specific
Company Codes(BUKRS) and the financial periods you need to analyze. Crucially, identify the specificDocument Types(BLART) used for 'Accrual Or Provision Posted', 'Adjusting Journal Entry Posted', and 'Intercompany' transactions in your system. - Verify Program and Job Names: Confirm the program names for key batch jobs such as Foreign Currency Valuation (e.g.,
FAGL_FCV), GR/IR Clearing (e.g.,SAPF124), Trial Balance reports (e.g.,RFBILA00), and Financial Statements generation (e.g.,RFBILA00). These can be found by checking scheduled jobs in transactionSM37. - Customize the SQL Query: Copy the provided SQL query into a text editor or SQL client. Replace the placeholder variables
{{start_date}},{{end_date}}, and{{company_codes}}with the actual values for your analysis. Update the lists of document types and program names based on the information gathered in the previous steps. - Connect to the Database: Use a standard SQL client tool, such as DBeaver, SQL Server Management Studio, or Oracle SQL Developer, to connect to the SAP database using the credentials you obtained.
- Execute the Query: Run the customized SQL query against the database. Depending on the date range and the size of your finance tables, this query may take a significant amount of time to complete.
- Review the Initial Results: Once the query finishes, perform a quick review of the output. Check for a reasonable number of rows, ensure all columns are present, and verify that different
ActivityNamevalues are included in the results. - Export the Data: Export the complete result set from your SQL client to a CSV file. Ensure the file is saved with UTF-8 encoding to prevent character issues.
- Prepare for Upload: Before uploading to a process mining tool, confirm that the column headers in the CSV file exactly match the required attribute names (
FinancialPeriod,ActivityName,EventTime, etc.). Also, verify that theEventTimecolumn is in a consistent timestamp format, such asYYYY-MM-DD HH:MI:SS.
Configuration
- Database Credentials: A read-only database user with access to the core SAP finance and system tables is required. This includes tables like
BKPF,BSEG,TBTCO,CDHDR, andCDPOS. - Date Range: We recommend extracting data for at least 3 to 6 full financial periods to capture meaningful process variations. Be mindful that larger date ranges will significantly increase query execution time.
- Company Codes (
BUKRS): Always filter by a specific list of company codes. Running the query for all company codes on a large system is not feasible and will likely cause performance issues. - Document Types (
BLART): The identification of journal entry types, such as accruals and adjustments, depends entirely on your organization's specific SAP configuration. You must provide the correct document type codes in theWHEREclauses of the query for accurate activity classification. - Program and Job Names: The query uses common program names for automated closing steps. Your system might use custom wrapper programs or different job names. Verify these in transaction
SM37and update the query accordingly. - Performance Considerations: This query accesses very large tables, especially
BSEGandCDPOS. It is strongly recommended to run this extraction during non-business hours to avoid impacting system performance. Applying narrow date and company code filters is the most effective way to manage execution time.
a Sample Query sql
SELECT
CONCAT(CAST(b.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', b.MONAT), 2)) AS FinancialPeriod,
'Period Opened For Posting' AS ActivityName,
c.UDATE + c.UTIME AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
p.TABKEY AS CompanyCode,
NULL AS DocumentNumber,
c.USERNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM CDHDR c
JOIN CDPOS p ON c.OBJECTCLAS = p.OBJECTCLAS AND c.OBJECTID = p.OBJECTID AND c.CHANGENR = p.CHANGENR
WHERE c.OBJECTCLAS = 'V_T001B'
AND p.TABNAME = 'T001B'
AND p.FNAME = 'FRPE1'
AND c.UDATE BETWEEN '{{start_date}}' AND '{{end_date}}'
UNION ALL
SELECT
CONCAT(CAST(b.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', b.MONAT), 2)) AS FinancialPeriod,
'Period Closed For Posting' AS ActivityName,
c.UDATE + c.UTIME AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
p.TABKEY AS CompanyCode,
NULL AS DocumentNumber,
c.USERNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM CDHDR c
JOIN CDPOS p ON c.OBJECTCLAS = p.OBJECTCLAS AND c.OBJECTID = p.OBJECTID AND c.CHANGENR = p.CHANGENR
WHERE c.OBJECTCLAS = 'V_T001B'
AND p.TABNAME = 'T001B'
AND p.FNAME = 'TOPE1'
AND c.UDATE BETWEEN '{{start_date}}' AND '{{end_date}}'
UNION ALL
SELECT
CONCAT(CAST(h.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', h.MONAT), 2)) AS FinancialPeriod,
'Accrual Or Provision Posted' AS ActivityName,
h.CPUDT + h.CPUTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
h.BUKRS AS CompanyCode,
h.BELNR AS DocumentNumber,
h.USNAM AS ResponsibleUser,
d.HKONT AS GLAccount,
h.BLART AS DocumentType,
d.DMBTR AS AmountInLocalCurrency,
'Accrual' AS JournalEntryType
FROM BKPF h
JOIN BSEG d ON h.MANDT = d.MANDT AND h.BUKRS = d.BUKRS AND h.BELNR = d.BELNR AND h.GJAHR = d.GJAHR
WHERE h.BUDAT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND h.BUKRS IN ({{company_codes}})
AND h.BLART IN ('SA', '[Your Accrual Doc Type]')
UNION ALL
SELECT
CONCAT(CAST(h.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', h.MONAT), 2)) AS FinancialPeriod,
'Intercompany Document Cleared' AS ActivityName,
h.AUGDT AS EventTime, -- Clearing Date
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
h.BUKRS AS CompanyCode,
h.BELNR AS DocumentNumber,
h.USNAM AS ResponsibleUser,
d.HKONT AS GLAccount,
h.BLART AS DocumentType,
d.DMBTR AS AmountInLocalCurrency,
'Clearing' AS JournalEntryType
FROM BKPF h
JOIN BSEG d ON h.MANDT = d.MANDT AND h.BUKRS = d.BUKRS AND h.BELNR = d.BELNR AND h.GJAHR = d.GJAHR
WHERE h.AUGDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND h.BUKRS IN ({{company_codes}})
AND h.BLART IN ('[Your Intercompany Doc Type]')
AND h.AUGBL IS NOT NULL
UNION ALL
SELECT
CONCAT(CAST(YEAR(j.SDLSTRTDT) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(j.SDLSTRTDT)), 2)) AS FinancialPeriod,
'Foreign Currency Valuation Run' AS ActivityName,
j.SDLSTRTDT + j.SDLSTRTTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
NULL AS CompanyCode,
j.JOBNAME AS DocumentNumber,
j.SDLUNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM TBTCO j
JOIN TBTCP p ON j.JOBNAME = p.JOBNAME AND j.JOBCOUNT = p.JOBCOUNT
WHERE p.PROGNAME = 'FAGL_FCV' OR p.PROGNAME = 'SAPF100'
AND j.SDLSTRTDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND j.STATUS = 'F' -- Finished
UNION ALL
SELECT
CONCAT(CAST(YEAR(j.SDLSTRTDT) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(j.SDLSTRTDT)), 2)) AS FinancialPeriod,
'GR/IR Clearing Run Executed' AS ActivityName,
j.SDLSTRTDT + j.SDLSTRTTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
NULL AS CompanyCode,
j.JOBNAME AS DocumentNumber,
j.SDLUNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM TBTCO j
JOIN TBTCP p ON j.JOBNAME = p.JOBNAME AND j.JOBCOUNT = p.JOBCOUNT
WHERE p.PROGNAME = 'SAPF124' -- Program for F.13
AND j.SDLSTRTDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND j.STATUS = 'F'
UNION ALL
SELECT
CONCAT(CAST(YEAR(j.SDLSTRTDT) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(j.SDLSTRTDT)), 2)) AS FinancialPeriod,
'Account Reconciliation Started' AS ActivityName, -- Proxy event
j.SDLSTRTDT + j.SDLSTRTTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
NULL AS CompanyCode,
j.JOBNAME AS DocumentNumber,
j.SDLUNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM TBTCO j
JOIN TBTCP p ON j.JOBNAME = p.JOBNAME AND j.JOBCOUNT = p.JOBCOUNT
WHERE p.PROGNAME IN ('FAGLL03', 'FBL3N') -- Common reconciliation reports
AND j.SDLSTRTDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND j.STATUS = 'F'
UNION ALL
SELECT
CONCAT(CAST(h.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', h.MONAT), 2)) AS FinancialPeriod,
'Adjusting Journal Entry Posted' AS ActivityName,
h.CPUDT + h.CPUTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
h.BUKRS AS CompanyCode,
h.BELNR AS DocumentNumber,
h.USNAM AS ResponsibleUser,
d.HKONT AS GLAccount,
h.BLART AS DocumentType,
d.DMBTR AS AmountInLocalCurrency,
'Adjusting' AS JournalEntryType
FROM BKPF h
JOIN BSEG d ON h.MANDT = d.MANDT AND h.BUKRS = d.BUKRS AND h.BELNR = d.BELNR AND h.GJAHR = d.GJAHR
WHERE h.BUDAT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND h.BUKRS IN ({{company_codes}})
AND h.BLART IN ('[Your Adjusting Doc Type]')
UNION ALL
SELECT
CONCAT(CAST(h.GJAHR AS VARCHAR(4)), '-', RIGHT(CONCAT('00', h.MONAT), 2)) AS FinancialPeriod,
'Reversal Entry Posted' AS ActivityName,
h.CPUDT + h.CPUTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
h.BUKRS AS CompanyCode,
h.BELNR AS DocumentNumber,
h.USNAM AS ResponsibleUser,
d.HKONT AS GLAccount,
h.BLART AS DocumentType,
d.DMBTR AS AmountInLocalCurrency,
'Reversal' AS JournalEntryType
FROM BKPF h
JOIN BSEG d ON h.MANDT = d.MANDT AND h.BUKRS = d.BUKRS AND h.BELNR = d.BELNR AND h.GJAHR = d.GJAHR
WHERE h.BUDAT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND h.BUKRS IN ({{company_codes}})
AND h.STBLG IS NOT NULL -- STBLG links to the reversed document
UNION ALL
SELECT
CONCAT(CAST(YEAR(j.SDLSTRTDT) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(j.SDLSTRTDT)), 2)) AS FinancialPeriod,
'Trial Balance Report Generated' AS ActivityName,
j.SDLSTRTDT + j.SDLSTRTTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
NULL AS CompanyCode,
j.JOBNAME AS DocumentNumber,
j.SDLUNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM TBTCO j
JOIN TBTCP p ON j.JOBNAME = p.JOBNAME AND j.JOBCOUNT = p.JOBCOUNT
WHERE p.PROGNAME IN ('RFSSLD00', 'S_ALR_87012310')
AND j.SDLSTRTDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND j.STATUS = 'F'
UNION ALL
SELECT
CONCAT(CAST(YEAR(j.SDLSTRTDT) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(j.SDLSTRTDT)), 2)) AS FinancialPeriod,
'Financial Statements Generated' AS ActivityName,
j.SDLSTRTDT + j.SDLSTRTTM AS EventTime,
'SAP_ECC' AS SourceSystem,
CURRENT_TIMESTAMP AS LastDataUpdate,
NULL AS CompanyCode,
j.JOBNAME AS DocumentNumber,
j.SDLUNAME AS ResponsibleUser,
NULL AS GLAccount,
NULL AS DocumentType,
NULL AS AmountInLocalCurrency,
NULL AS JournalEntryType
FROM TBTCO j
JOIN TBTCP p ON j.JOBNAME = p.JOBNAME AND j.JOBCOUNT = p.JOBCOUNT
WHERE p.PROGNAME = 'RFBILA00' -- Program for F.01
AND j.SDLSTRTDT BETWEEN '{{start_date}}' AND '{{end_date}}'
AND j.STATUS = 'F'
-- UNION ALL
-- Note: 'Reconciliation Reviewed' is typically not a standard, logged event in SAP ECC.
-- This activity often happens offline or in a custom tool.
-- The following is a placeholder to be adapted if a custom (Z-table) log exists.
-- SELECT
-- CONCAT(CAST(YEAR(z.REVIEW_DATE) AS VARCHAR(4)), '-', RIGHT(CONCAT('00', MONTH(z.REVIEW_DATE)), 2)) AS FinancialPeriod,
-- 'Reconciliation Reviewed' AS ActivityName,
-- z.REVIEW_DATE AS EventTime,
-- 'SAP_ECC' AS SourceSystem,
-- CURRENT_TIMESTAMP AS LastDataUpdate,
-- z.BUKRS AS CompanyCode,
-- z.HKONT AS DocumentNumber, -- Using GL Account as a proxy identifier
-- z.REVIEWER_USER AS ResponsibleUser,
-- z.HKONT AS GLAccount,
-- NULL AS DocumentType,
-- NULL AS AmountInLocalCurrency,
-- NULL AS JournalEntryType
-- FROM ZRECON_LOG z -- Replace with your custom table for reconciliation status
-- WHERE z.REVIEW_DATE BETWEEN '{{start_date}}' AND '{{end_date}}'
-- AND z.STATUS = 'Reviewed'
;