- Home
- S/4HANA
- Custom Analytical Queries
- Creation
Build an actual vs plan query
Step by step in Custom Analytical Queries, with a plan column that names itself
- F1572
- I_ActualPlanJrnlEntryItemCube
- Restricted measure
- Dynamic label
- Calculated measure
What you will build
| G/L Account | Actual Amt | PLN Amt | Variance | Var. % |
|---|---|---|---|---|
| 51000000 | 1,254,300.00 | 1,200,000.00 | 54,300.00 | 4.53 |
| 51100000 | 386,250.00 | 410,000.00 | -23,750.00 | -5.79 |
| 53000000 | 92,400.00 | 110,000.00 | -17,600.00 | -16.00 |
Before you start
One report, four columns, no code
The report lists cost by G/L account and cost center: what was posted, what was planned, and the difference in value and in percent. Everything is done in one Fiori app, on a cube SAP already delivers. If you have never opened the app, the Custom Analytical Queries overview explains how it works.
- The app
F1572Custom Analytical Queries
The Fiori app where key users build analytical queries on SAP’s released cubes. You need a business role that includes it.
- The data
I_ActualPlanJrnlEntryItemCubeActual and plan in one cube
Actual Plan of Journal Entry Item reads actual postings from the Universal Journal (ACDOCA) and plan data (ACDOCP) together, so one query can compare them.
- The plan
Plan CategoryPlan data to compare
Plan data must exist for at least one plan category, such as PLN in this example. The user chooses the category every time the report runs.
Step by step
From an empty query to a tile on the launchpad
Fifteen screens, in the order you go through them. Each one is the Fiori app redrawn with neutral data, and the numbers on the screen match the notes under it.
The selection screen
Seven prompts, in this order
Every prompt is set on the Filters tab as User Input Values, the way steps 10 and 11 show. Variable Sequence decides the order on the selection screen; leaving gaps of ten makes room for a prompt added later.
Tip. A default fiscal year is a fixed value. Review it at the start of every year, or users open the report on last year.
| Seq. | Prompt | Multiple values | Mandatory | Default |
|---|---|---|---|---|
| 10 | Controlling Area | No | Yes | SNF3 |
| 20 | Company Code | Yes | Yes | 1010 |
| 30 | Fiscal Year | No | Yes | 2026 |
| 40 | Ledger | No | Yes | 0L |
| 50 | Plan Category (ZPLAN_CATEGORY) | No | Yes | PLN |
| 60 | Chart of Accounts | No | No | YCOA |
| 70 | Fiscal Period | Yes | No | — |
Names in this example
Everything we create starts with Z
The Z keeps your own names apart from the ones SAP delivers, so nobody mistakes a measure you built for a standard field.
The query name also gets the prefix your system adds. Most systems propose YY1_. A system whose extensibility setup uses a registered namespace adds that instead, written between slashes, like /S4P/ here.
| Name | What it is | How it is set |
|---|---|---|
/S4P/Z_ACTUAL_VS_PLAN | Query | Label Actual vs Plan, on the cube I_ACTUALPLANJRNLENTRYITEMCUBE. |
ZPLAN_CATEGORY | User input filter (prompt) | Data type FCOM_CATEGORY, override label Plan Category, default PLN, hidden in the result. |
ZActualAmt | Restricted measure | Act Amt in CC Crcy with Actual/Plan Code = A. Static label Actual Amt. |
ZPlanAmt | Restricted measure | Plan Amt in CC Crcy with Actual/Plan Code = P and Plan Category = :ZPLAN_CATEGORY. Dynamic label "ZPLAN_CATEGORY" Amt. |
ZVarianceAmt | Calculated measure | ZActualAmt - ZPlanAmt |
ZVariancePct | Calculated measure | NDIV0( ( ZActualAmt - ZPlanAmt ) / ABS( ZPlanAmt ) * 100 ), 2 decimals. |