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.

Employee Valid From Valid To Number of Calendar 
Days Absent
50000001 17/04/2004 21/04/2004 4
50000002 16/07/2004 29/09/2004 13
50000003 07/01/2004 09/02/2004 33
50000004 04/08/2004 05/08/2004 1

SAP BW: Replacement Path Variables的更多相关文章

  1. SAP BW标准模型简介(BW星形模型 BW Star Schema )

    标准星型模型是 数据仓库中一种常用的组织信息和数据的多维数据模型.它由中心的一个事实表(Fact Table)和一些围绕它的维度表(Dimensional Table)组成.  事实(Fact)着眼于 ...

  2. SAP BW 数据库表命名规则

    SAP BW 数据库表命名规则 已有 315 次阅读2012/6/8 15:55 |系统分类:专业内容| SAP, 命名, 数据库表 Namings for Cube: /BI<C OR DIG ...

  3. 应用SAP PI实现SAP BW数据仓库对于第三方系统数据完美集成以及DELTA加载的分析

    注明:本篇的技术性细节参考了SAP SCN上的一篇SAP PI 和BW集成的文章,本篇文章并不打算过多探讨实现的技术细节,因为在SCN上的这篇英文文章已经完全涵盖了技术细节和配置步骤 大家可以通过搜索 ...

  4. 【BW系列】SAP BW on HANA 迁移问题

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[BW系列]SAP BW on HANA 迁移问 ...

  5. 【BW系列】SAP BW实时抽取ECC数据的实现

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[BW系列]SAP BW实时抽取ECC数据的实现 ...

  6. Idea | Load error: undefined path variables

    Load error: undefined path variables 案例 今天打开idea项目,突然间出现如下异常: Load error: undefined path variables 类 ...

  7. SAP BW顾问如何保持市场竞争力

    跟大部分电工一样,SAP顾问也经常有迷茫的时候.因为,这个世界变化实在太快了.每一个电工,总是在担心自己会不会被飞速发展的技术所淘汰.那么,作为 一个BW顾问,应该如何保持市场竞争力呢?我觉得需要两个 ...

  8. SAP BW中的增强(转)

    根据所了解的资料,BW中的有关增强可分为五部分,如下: 1.  数据抽取增强,即在标准数据源中加入数据源中所不存在的字段,或者标准数据源不存在所需数据而需要自定义数据源,相关的事务代码有RSO2(用于 ...

  9. 【转】SAP BW 顾问靠手 — SAP中的例程

    什么是例程(Routine)? 例程就是我们可以自己定义的程序代码.通过程序代码来完成我们的需求,因为业务是千变万化,如果想让产品能跟随上业务的脚步,就必须要有非常灵活的功能来补充.大家都知道软件产品 ...

随机推荐

  1. Laravel 核心概念

    工欲善其事,必先利其器.在开发Xblog的过程中,稍微领悟了一点Laravel的思想.确实如此,这篇文章读完你可能并不能从无到有写出一个博客,但知道Laravel的核心概念之后,当你再次写起Larav ...

  2. 教程:在 Visual Studio 中开始使用 Flask Web 框架

    教程:在 Visual Studio 中开始使用 Flask Web 框架 Flask 是一种轻量级 Web 应用程序 Python 框架,为 URL 路由和页面呈现提供基础知识. Flask 被称为 ...

  3. python中执行shell的两种方法总结

    这篇文章主要介绍了python中执行shell的两种方法,有两种方法可以在Python中执行SHELL程序,方法一是使用Python的commands包,方法二则是使用subprocess包,这两个包 ...

  4. P2031 脑力达人之分割字串

    P2031 脑力达人之分割字串字符串dp,f[i]表示主串到第i个字符,最多能分割成多少子串.f[i]=max(f[i],f[k]+1);k是能匹配到的前一位. #include<iostrea ...

  5. 陈国凯oi历程

    从此成了OI退役狗 说实话,当时NOIP比赛前就想写这篇,结果一直没有足够的动力和时间写,现在高考完了,也有了时间,就写一点东西,记录一下我的OI经历吧. 初入OI 高一时,我是信息技术课代表(当然没 ...

  6. 003.HAProxy ACL规则的智能负载均衡

    一 简介 HAProxy可以工作在第七层模型,可通过ACL规则实现基于HAProxy的智能负载均衡系统,HAProxy通过ACL规则完成以下两种主要功能: 通过ACL规则检查客户端请求是否合法,如果符 ...

  7. Linux 程序设计1:深入浅出 Linux 共享内存

    笔者最近在阅读Aerospike 论文时,发现了Aerospike是利用了Linux 共享内存机制来实现的存储索引快速重建的.这种方式比传统利用索引文件进行快速重启的方式大大提高了效率.(减少了磁盘 ...

  8. 是否可从一个static方法内发出对非static方法的调用?

    不可以.因为非static方法是要与对象关联在一起的,必须创建一个对象后,才可以在该对象上进行方法调用,而static方法调用时不需要创建对象,可以直接调用.也就是说,当一个static方法被调用时, ...

  9. OSINT系列:网站信任评估WOT

     OSINT系列:网站信任评估WOT Web of Trust(WOT)是芬兰的一家网站信任评估服务公司.它通过收集用户对网站的评价,来评估网站的可信任度.在该公司网站www.mywot.com,用户 ...

  10. 爬虫三Scrapy

    Scrapy,Python开发的一个快速,高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据.Scrapy用途广泛,可以用于数据挖掘.监测和自动化测试. Scrapy吸引人 ...