How to create custom message for budget availability control notifications and mail
As a process of Budget availability control, system issues warnings and mail notifications based on tolerance limits set up. The notifications displayed in standard system seldom understood by users owing to the fact that the content of message is not clear and straight forward as shown below.
The challenges in understanding the standard notification messages can be summarized as below:
- The budget amount displayed is at times very confusing
- No direct indication of available budget
- The standard text does not provide the name of WBS element which is most prominently used for tracking by business
Hence very often there are demands from clients for customized messages (in a form that can be easily understood by users) to be displayed in the process of availability control. The fact that the standard message text is unclear and not straight forward, the requirement seems quite reasonable.
As such there is no standard way provided by SAP for getting the customized message, I am going to explain how this can be achieved indirectly through development.
To explain the solution in a simpler way, I am taking an example of custom message requirement as below where the required message text is like this:
WBS Element xxxxxxxxx (name of WBS) budget threshold of 75% has been crossed.
For WBS Element xxxxxxxxx(name of WBS), xx% of the released budget for fiscal year YYYY has been reached.
Available budget for future spend is XXXX (currency).
Creating Custom Message:
The standard messages related to Availability control are defined in message class “BP” and message numbers ranging from 601 to 614. To get the custom message displayed, all these messages need to be replaced by a custom message created in the same class “BP”.
Replacing these messages can be easily handled by maintaining a set for the message numbers to be replaced. Advantage with set is that any changes can be easily done as part of ongoing maintenance.
Steps in creating custom message:
1. A set is created using tcode GS01 as shown below:
3. Format Long text of message as required
4. Define the variables as required in the message display. In the above example, V1 is used for WBS code concatenated with description, V3 is for % of budget spent, V2 is for Fiscal Year and V4 is for available budget. Out of these only V2 is the standard variable and all others are custom defined.
Functional design for getting different variables in the messages:
WBS element details and description of WBS are ascertained from standard Function Module and table PRPS.
For getting the % of spent budget, below logic will be used:
Table BPJA- OBJNR= PRPS-OBJNR
BPJA-WRTTP=42, BPJA-GJAHR= FY in question
Assigned Budget = (BPJA-WLJHR + TBPJA-WLJHR)
Release Budget = BPJA-WLJHV
% Budget Spent = (Assigned Budget/ Release Budget) * 100
Available Budget = Release Budget – Assigned Budget
For Overall budget values: refer table BPGE with same logic
The % of spent and remaining budget are dynamically calculated each time the message is hit.
Embed the calculations in the code to display dynamic values based on real time data
5. The budget availability control is managed in the standard program and the required custom message is achieved through implementation of Implicit Enhancements.
Create implicit enhancements in Include: LBPFCM1 as shown below
These custom enhancements are meant to fulfill the below tasks in the same order:
- Replacing standard message numbers maintained in set with the custom message BP 890
- Concatenating WBS text to WBS number
- Storing the dynamic variables such as % of budget spent and available budget in message
- Customizing message text being sent to external mail as part of FM: BP_CREATE_MAIL
6. Activate the enhancements and after activating the implementation, the custom message (BP 890) will be displayed as on-screen notification and also as external mail text.
Customized message as on-screen notification:
Message sent to external mail Id:
Sample Code for implicit enhancements for both LBPFCM1 and FM: BP_CREATE_MAIL for the above custom message is provided below