SAP BW: Replacement Path Variables

How to use Replacement Path Variables to perform Date Calculations

A Step-by-Step guide

Have you ever wanted to perform calculations using dates defined as characteristics but have never worked out how it can be done? Replacement Path Variables are the key.

Using Replacement Path in your Text and Formula variables, replace values held in a characteristic. The Characteristic value variables are replaced by the results of a query at run-time.

The steps detailed below show a technique to enable a BEx query user to determine the number of days between two dates.

Scenario:
The group HR administrator wants a detailed line item report that lists all employee absences in a given period. The report is to show the employee number, the absence start date, together with the end date of the absence and show the number of calendar days the employee was absent.

The good thing about using this technique is that no redesign work is needed from your technical BW team, no ABAP is involved and best of all, it quick and easy.

Solution:
For this example I created an ODS object called Absence that holds basic employee information along with individual absence record data.

Follow the steps below:

  1. Open the BEx Query Designer and create a new report on your chosen InfoProvider.
  2. Drag the Employee, Valid from and Valid to characteristics into the Rows section of the screen. If needed, apply data selection restrictions to the characteristics as shown in Figure 1.
  3. Right click on the Key Figures structure and select New Formula (Figure 1).

     Figure 1
  4. In the new formula window right click on Formula Variable and choose New Variable Figure 2 ).

      Figure 2
  5. The Variables Wizard will launch and will require you to specify the variable details. 
    ( Click the NEXT button if the Introduction screen appears )
  6. Enter the variable details on the General Information as shown in Figure 3 
    Enter the Variable Name , Description and select Replacement Path in the Processing by field. 
    Click the Next Button.

      Figure 3
  7. In the Characteristic screen (Figure 4) select the date characteristic that represents the first date to use in the calculation (From Date).
    Click the Next Button.

     Figure 4
  8. In the Replacement Path screen (Figure 5) select Key in the Replace Variable with field. Leave all the other options as they are (The offset values will be set automatically).
    Click the Next Button.

     Figure 5
  9. In the Currencies and Units screen (Figure 6) select Date as the Dimension ID.
    Click the Next button.

     Figure 6
  10. The Save Variable screen (Figure 7) displays a summary of the new variable.
    Click on the Finish button to save the variable.

     Figure 7
  11. Repeat steps 4 to 11 to create a second variable for the second date to be used in the calculation. In the example shown, the characteristic 0DATETO is used to create the variable ABSEND (Absence End Date).

Define the Calculation

We can now use our two new replacement variables to define our new calculated key figure that generates the number of absence days for each record.

  1. You will now be back at the New Formula screen (Figure 8). Drag and drop the two new variables into the formula section of the screen and insert the subtract sign (“-“) between the two.
  2. Give the new formula a description and click the formula syntax check button  to ensure the formula is valid.

     Figure 8
  3. The new calculated key figure will now show in the columns section of the BEx query designer (Figure 9).

    Figure 9
  4. Save the query and execute it.

In the example shown the Number of Calendar Days Absent is calculated correctly. See the table of results below.

EmployeeValid FromValid ToNumber of Calendar 
Days Absent
5000000117/04/200421/04/20044
5000000216/07/200429/09/200413
5000000307/01/200409/02/200433
5000000404/08/200405/08/20041

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下载 4使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、 4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.m或d论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 、1资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值