上个月的数据应在下个月汇总

2020-08-30 04:06发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我编写了一个BPC逻辑脚本来汇总下个月的上个月数据。 我有一个包可以执行此BPC逻辑脚本。 例如。 当我执行6月的数据包时,结果应为5月数据(即4月+ 5月)+ 6月数据。

进行汇总的数据保存在 Dummy_test 关键指标中。

AMT 键值具有原始 月数据。

在执行以下逻辑脚本时,例如 对于6月份,原来在6月份存在的记录将与5月份的数据相加。 因此May + June不会在6月添加May数据(A1 E2 100)的新条目。 而是显示如下单个记录

AMT的6月数据:

A1 E1 100

Dummy_test关键数据上的五月数据:

A1 E2 100

A1 E1 100

发布执行脚本:

Dummy_test Keyfigure上的6月数据:

A1 E1 200

预期输出:

Dummy_test Keyfigure上的6月数据:

A1 E1 200

A1 E2 100

我必须在下个月做一个简单的上个月加法。 请帮忙!

 * XDIM_MEMBERSET APL_TIMES =%APL_TIMES_SET%
 * XDIM_MEMBERSET APL_CATEGORY = DUMMY
 * XDIM_MEMBERSET APL_KEYFIGURE = AMT,虚拟测试
//* XDIM_MEMBERSET MEASURES = PERIODIC


 * SELECT(%Y%,YEAR,APL_TIMES,ID =%APL_TIMES_SET%)
 * SELECT(%1%,MONTHNUM,APL_TIMES,ID =%APL_TIMES_SET%)
 * SELECT(%N%,MONTHNUM,APL_TIMES,ID = TMVL(+ 1,%APL_TIMES_SET%))


 *当APL_CATEGORY
 *是假人
 *当APL_TIMES.MONTHNUM
 * IS 1
 * REC(EXPRESSION =%VALUE%,APL_TIMES =%Y%.04,APL_KEYFIGURE = Dummy_test,APL_CATEGORY = DUMMY)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 2
 * REC(表达式=(([[APL_TIMES]。[%Y%.04],[APL_CATEGORY]。[DUMMY],[APL_KEYFIGURE]。[Dummy_test])+([APL_TIMES .. [%Y%.05],[  APL_CATEGORY]。[DUMMY],[APL_KEYFIGURE。[AMT])),APL_TIMES =%Y%.05,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 3
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.05],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.06],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.06,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 4
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.06],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.07],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.07,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 5
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.07],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.08],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.08,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 6
 * REC(表达式=([[APL_TIMES]。[%Y%.08],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.09],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.09,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 7
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.09],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.10],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.10,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 8
 * REC(表达式=([[APL_TIMES]。[%Y%.10],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.11],[APL_KEYFIGURE。[AMT]),APL_TIMES =%  Y%.11,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 9
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.11],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.12],[APL_KEYFIGURE]。[AMT]),APL_TIMES =%  Y%.12,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 10

 * REC(表达式=([[APL_TIMES]。[%Y%.12],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.01],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.01,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 11
 * REC(表达式=([[APL_TIMES]。[%N%.01],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.02],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.02,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 12

 * REC(表达式=([[APL_TIMES]。[%N%.02],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.03],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.03,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *结束
 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我编写了一个BPC逻辑脚本来汇总下个月的上个月数据。 我有一个包可以执行此BPC逻辑脚本。 例如。 当我执行6月的数据包时,结果应为5月数据(即4月+ 5月)+ 6月数据。

进行汇总的数据保存在 Dummy_test 关键指标中。

AMT 键值具有原始 月数据。

在执行以下逻辑脚本时,例如 对于6月份,原来在6月份存在的记录将与5月份的数据相加。 因此May + June不会在6月添加May数据(A1 E2 100)的新条目。 而是显示如下单个记录

AMT的6月数据:

A1 E1 100

Dummy_test关键数据上的五月数据:

A1 E2 100

A1 E1 100

发布执行脚本:

Dummy_test Keyfigure上的6月数据:

A1 E1 200

预期输出:

Dummy_test Keyfigure上的6月数据:

A1 E1 200

A1 E2 100

我必须在下个月做一个简单的上个月加法。 请帮忙!

 * XDIM_MEMBERSET APL_TIMES =%APL_TIMES_SET%
 * XDIM_MEMBERSET APL_CATEGORY = DUMMY
 * XDIM_MEMBERSET APL_KEYFIGURE = AMT,虚拟测试
//* XDIM_MEMBERSET MEASURES = PERIODIC


 * SELECT(%Y%,YEAR,APL_TIMES,ID =%APL_TIMES_SET%)
 * SELECT(%1%,MONTHNUM,APL_TIMES,ID =%APL_TIMES_SET%)
 * SELECT(%N%,MONTHNUM,APL_TIMES,ID = TMVL(+ 1,%APL_TIMES_SET%))


 *当APL_CATEGORY
 *是假人
 *当APL_TIMES.MONTHNUM
 * IS 1
 * REC(EXPRESSION =%VALUE%,APL_TIMES =%Y%.04,APL_KEYFIGURE = Dummy_test,APL_CATEGORY = DUMMY)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 2
 * REC(表达式=(([[APL_TIMES]。[%Y%.04],[APL_CATEGORY]。[DUMMY],[APL_KEYFIGURE]。[Dummy_test])+([APL_TIMES .. [%Y%.05],[  APL_CATEGORY]。[DUMMY],[APL_KEYFIGURE。[AMT])),APL_TIMES =%Y%.05,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 3
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.05],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.06],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.06,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 4
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.06],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.07],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.07,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 5
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.07],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.08],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.08,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 6
 * REC(表达式=([[APL_TIMES]。[%Y%.08],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.09],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.09,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 7
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.09],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.10],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  Y%.10,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 8
 * REC(表达式=([[APL_TIMES]。[%Y%.10],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.11],[APL_KEYFIGURE。[AMT]),APL_TIMES =%  Y%.11,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 9
 * REC(EXPRESSION =([[APL_TIMES]。[%Y%.11],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%Y%.12],[APL_KEYFIGURE]。[AMT]),APL_TIMES =%  Y%.12,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 10

 * REC(表达式=([[APL_TIMES]。[%Y%.12],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.01],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.01,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *当APL_TIMES.MONTHNUM
 * IS 11
 * REC(表达式=([[APL_TIMES]。[%N%.01],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.02],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.02,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束

 *当APL_TIMES.MONTHNUM
 * IS 12

 * REC(表达式=([[APL_TIMES]。[%N%.02],[APL_KEYFIGURE]。[Dummy_test] + [APL_TIMES]。[%N%.03],[APL_KEYFIGURE .. [AMT]),APL_TIMES =%  N%.03,APL_CATEGORY = DUMMY,APL_KEYFIGURE = Dummy_test)
 *结束
 *结束
 
付费偷看设置
发送
10条回答
95年老男孩
1楼 · 2020-08-30 04:32.采纳回答

用于更新所选月份以及所选月份之后所有月份的脚本:

 * SELECT(%Y%,YEAR,TIME,ID =%TIME_SET%)//%TIME_SET%-单个成员!
 * SELECT(%TID%,[TIMEID],TIME,ID =%TIME_SET%)

 * SELECT(%T01%,[ID],TIME,YEAR =%Y%AND TIMEID> =%TID%AND CALC = N)
 * SELECT(%TID02%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 2)
 * SELECT(%T02%,[ID],TIME,TIMEID> =%TID02%AND ID =%T01%)
 * SELECT(%TID03%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 3)
 * SELECT(%T03%,[ID],TIME,TIMEID> =%TID03%AND ID =%T01%)
 * SELECT(%TID04%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 4)
 * SELECT(%T04%,[ID],TIME,TIMEID> =%TID04%AND ID =%T01%)
 * SELECT(%TID05%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 5)
 * SELECT(%T05%,[ID],TIME,TIMEID> =%TID05%AND ID =%T01%)
 * SELECT(%TID06%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 6)
 * SELECT(%T06%,[ID],TIME,TIMEID> =%TID06%AND ID =%T01%)
 * SELECT(%TID07%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 7)
 * SELECT(%T07%,[ID],TIME,TIMEID> =%TID07%AND ID =%T01%)
 * SELECT(%TID08%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 8)
 * SELECT(%T08%,[ID],TIME,TIMEID> =%TID08%AND ID =%T01%)
 * SELECT(%TID09%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 9)
 * SELECT(%T09%,[ID],TIME,TIMEID> =%TID09%AND ID =%T01%)
 * SELECT(%TID10%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 10)
 * SELECT(%T10%,[ID],TIME,TIMEID> =%TID10%AND ID =%T01%)
 * SELECT(%TID11%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 11)
 * SELECT(%T11%,[ID],TIME,TIMEID> =%TID11%AND ID =%T01%)
 * SELECT(%TID12%,[TIMEID],TIME,YEAR =%Y%AND CALC = N AND MONTHNUM = 12)
 * SELECT(%T12%,[ID],TIME,TIMEID> =%TID12%AND ID =%T01%)

 *当TIME.MONTHNUM
 * IS 1
 *对于%M01%=%T01%
 * REC(EXPRESSION =%VALUE%,TIME =%M01%,ACCOUNT = BS111)
 *下一个
 * IS 2
 *对于%M02%=%T02%
 * REC(EXPRESSION =%VALUE%,TIME =%M02%,ACCOUNT = BS111)
 *下一个
 * IS 3
 *对于%M03%=%T03%
 * REC(EXPRESSION =%VALUE%,TIME =%M03%,ACCOUNT = BS111)
 *下一个
 * IS 4
 *对于%M04%=%T04%
 * REC(EXPRESSION =%VALUE%,TIME =%M04%,ACCOUNT = BS111)
 *下一个
 * IS 5
 *对于%M05%=%T05%
 * REC(EXPRESSION =%VALUE%,TIME =%M05%,ACCOUNT = BS111)
 *下一个
 * IS 6
 *对于%M06%=%T06%
 * REC(EXPRESSION =%VALUE%,TIME =%M06%,ACCOUNT = BS111)
 *下一个
 * IS 7
 *对于%M07%=%T07%
 * REC(EXPRESSION =%VALUE%,TIME =%M07%,ACCOUNT = BS111)
 *下一个
 * IS 8
 *对于%M08%=%T08%
 * REC(EXPRESSION =%VALUE%,TIME =%M08%,ACCOUNT = BS111)
 *下一个
 * IS 9
 *对于%M09%=%T09%
 * REC(EXPRESSION =%VALUE%,TIME =%M09%,ACCOUNT = BS111)
 *下一个
 * IS 10
 *对于%M10%=%T10%
 * REC(EXPRESSION =%VALUE%,TIME =%M10%,ACCOUNT = BS111)
 *下一个
 * IS 11
 *对于%M11%=%T11%
 * REC(EXPRESSION =%VALUE%,TIME =%M11%,ACCOUNT = BS111)
 *下一个
 * IS 12
 *对于%M12%=%T12%
 * REC(EXPRESSION =%VALUE%,TIME =%M12%,ACCOUNT = BS111)
 *下一个
 * ENDWHEN 
zhangjiyang1323
2楼-- · 2020-08-30 04:35

抱歉,但信息不足!

模型类型:定期还是年初至今?

时间维度屏幕截图?

数据和所需结果样本?

...

请阅读: https ://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues /

N-Moskvin
3楼-- · 2020-08-30 04:33

嗨,

我的要求是2018.05 = 2018.04 + 2018.05。

2018.06 = 2018.05 + 2018.06 + 2018.04等等。

我正在Dummy_test关键指标中保存2018.04 + 2018.05的汇总数据。 因此,公式变为([[APL_TIMES]。[%Y%.04],[APL_CATEGORY]。[DUMMY],[APL_KEYFIGURE]。[Dummy_test])+([APL_TIMES]。[%Y%.05],[APL_CATEGORY  ]。[DUMMY],[APL_KEYFIGURE]。[AMT])

我使用了不同的关键指标,因为Dummy_test将具有汇总数据,而AMT将具有基本值,因此我可以避免添加过去几个月的总和,而只是在Dummy_test中选择上个月的数据。

但是现在的问题是,当对2018.04中存在的记录使用上述公式时,而2018.05中不存在数据,则它们不会汇总。 例如。 未发生NOPRODUCT/H01001/1000_SRVS/2018.04第一行的2018.04 + 2018.05,因为2018.05(AMT)中不存在相应的记录条目。

下面的数据在AD01/1000_PRJS上的发生是正确的,因为在AMT上该组合的一些数据在2018.05出现(度量:年初至今)

时间维度主数据:

希望问题现在已经清楚了。 抱歉,Vadim。

谢谢!

Haoba3210
4楼-- · 2020-08-30 04:26

型号类型:YTD

TIME主数据,4月数据,5月的附加屏幕截图。5月出现数据和输出。 该记录适用于H01001帐户ID。

预期的输出:4月未出现NOPRODUCT记录。

大道至简
5楼-- · 2020-08-30 04:40

提供其他信息后,我可以看到您正在执行从PERIODIC到YTD的简单转换! 会计年度为四月至三月。

"我可以避免将过去几个月的总和相加,而只需在Dummy_test中选择上个月的数据即可。" -错误的想法!

请阅读我的博客:

https: //blogs.sap.com/2018/11/02/periodic-ytd-conversion-using-script-logic-in-bpc-nw /

SAP砖家
6楼-- · 2020-08-30 04:47

很抱歉,但是没有

并且没有示例屏幕截图,所需的逻辑也不清楚!

奄奄一息的小鱼
7楼-- · 2020-08-30 04:27

"已阅读此博客。非常有用,但不适用于我的时间元素 我将2018.04设为1,然后将12设为2019.03"。

抱歉,这是什么问题?

只需根据您的会计年度更正我的脚本!

< p>例如,第一个脚本:

//让我们假设变量$ FE $包含用户选择的会计年度-2018
//2018.04,...,2018.12,2019.01,...,2019.03
//$ FE $将等于列表中的第一年,我们必须计算第二年

//根据会计年度的最后一个月计算%NEXTY%-MAR
 * SELECT(%NEXTY%,[YEAR],TIME,[YEAR] = $ FE $ AND [MONTHNUM] = 12 AND [CALC] = N)
//%NEXTY%= 2019

 * XDIM_MEMBERSET ACCOUNT = PL110//EXP ACCTYPE
 * XDIM_MEMBERSET MEASURES = PERIODIC
 * XDIM_MEMBERSET TIME = BAS($ FE $ .TOTAL)

 *当TIME.MONTHNUM
 * IS 1
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .04,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .05,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .06,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .07,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .08,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .09,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .10,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .11,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME = $ FE $ .12,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME =%NEXTY%.01,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME =%NEXTY%.02,ACCOUNT = BS111)
 * REC(EXPRESSION =%VALUE%,TIME =%NEXTY%.03,ACCOUNT = BS111)
 * IS 2
 ... 

一周热门 更多>