APF filter到底支持多复杂的条件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/i042416/article/details/88949723

When I added 6 individual filters in the configuration:

clipboard1

And run it:

clipboard2

Add first step is OK, but when select Year 2016 and add second step, dump occurred:

clipboard3

clipboard4

The error is “Filter condition is too complex”

The batch request URL is as below:

https://jerry.sap.corp:1300/sap/opu/odata/sap/Z_SALESVOLUMEANALYSISQUERY_CDS/Z_SALESVOLUMEANALYSISQUERY(P_ExchangeRateType=‘M’,P_DisplayCurrency=‘EUR’)/Results?KaTeX parse error: Expected 'EOF', got '&' at position 76: …DisplayCurrency&̲filter=((((BillingDocumentDateYear%20eq%20%272015%27)%20or%20(BillingDocumentDateYear%20eq%20%272016%27)%20or%20(BillingDocumentDateYear%20eq%20%272017%27))%20and%20((BillingDocDateYearQuarter%20eq%20%271.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%271.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2017%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2017%27))%20and%20((BillingDocDateYearMonth%20eq%20%2702.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2707.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2712.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2701.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2702.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2703.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2704.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2017%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2017%27)))%20and%20((SalesOrganization%20eq%20%270001%27)%20or%20(SalesOrganization%20eq%20%270012%27)%20or%20(SalesOrganization%20eq%20%27ZBG1%27)%20or%20(SalesOrganization%20eq%20%27ZZZ1%27))%20and%20(BillingDocumentDateYear%20eq%20%272015%27))&$format=json
Seems indeed it’s very complex… but all the filters are necessary, looks like I have to try Smart Filter instead…

I’ve copied the configuration, you could use the copied one:

clipboard5

我找到了具体引起这个错误的ABAP code,一会给你说怎么定位:

clipboard6

现在在看怎么避免这个error。你第一次添加step时能够正常工作,因为it_filter_select_options和iv_filter_string都是有值的:

clipboard7

而添加第二个step时,it_filter_select_options不知为何为空了,所以框架检查出错:

clipboard8

还需要继续看。第一个step传到后台的url:
GET Z_SALESVOLUMEANALYSISQUERY(P_ExchangeRateType=%27M%27,P_DisplayCurrency=%27EUR%27)/Results?KaTeX parse error: Expected 'EOF', got '&' at position 74: …DisplayCurrency&̲filter=((((BillingDocumentDateYear%20eq%20%272015%27)%20or%20(BillingDocumentDateYear%20eq%20%272016%27)%20or%20(BillingDocumentDateYear%20eq%20%272017%27))%20and%20((BillingDocDateYearQuarter%20eq%20%271.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%271.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2017%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2017%27))%20and%20((BillingDocDateYearMonth%20eq%20%2702.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2707.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2712.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2701.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2702.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2703.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2704.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2017%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2017%27)))%20and%20((SalesOrganization%20eq%20%270001%27)%20or%20(SalesOrganization%20eq%20%270012%27)%20or%20(SalesOrganization%20eq%20%27ZBG1%27)%20or%20(SalesOrganization%20eq%20%27ZZZ1%27)))& f o r m a t = j s o n H T T P / 1.1 s t e p u r l : G E T Z S A L E S V O L U M E A N A L Y S I S Q U E R Y ( P E x c h a n g e R a t e T y p e = format=json HTTP/1.1 第二个step的url: GET Z_SALESVOLUMEANALYSISQUERY(P_ExchangeRateType=%27M%27,P_DisplayCurrency=%27EUR%27)/Results? select=BillingDocDateYearQuarter,DisplayCurrency,NetAmountInDisplayCurrency& f i l t e r = ( ( ( ( B i l l i n g D o c u m e n t D a t e Y e a r filter=((((BillingDocumentDateYear%20eq%20%272015%27)%20or%20(BillingDocumentDateYear%20eq%20%272016%27)%20or%20(BillingDocumentDateYear%20eq%20%272017%27))%20and%20((BillingDocDateYearQuarter%20eq%20%271.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2015%27)%20or%20(BillingDocDateYearQuarter%20eq%20%271.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%272.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2016%27)%20or%20(BillingDocDateYearQuarter%20eq%20%273.2017%27)%20or%20(BillingDocDateYearQuarter%20eq%20%274.2017%27))%20and%20((BillingDocDateYearMonth%20eq%20%2702.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2707.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2712.2015%27)%20or%20(BillingDocDateYearMonth%20eq%20%2701.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2702.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2703.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2704.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2705.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2706.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2709.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2711.2016%27)%20or%20(BillingDocDateYearMonth%20eq%20%2708.2017%27)%20or%20(BillingDocDateYearMonth%20eq%20%2710.2017%27)))%20and%20((SalesOrganization%20eq%20%270001%27)%20or%20(SalesOrganization%20eq%20%270012%27)%20or%20(SalesOrganization%20eq%20%27ZBG1%27)%20or%20(SalesOrganization%20eq%20%27ZZZ1%27))%20and%20(BillingDocumentDateYear%20eq%20%272016%27))& format=json HTTP/1.1在第二个step时,上面的方法解析select option出错了:因此最后没有select option传到后台框架去,所以引起了那个错误。

clipboard9

clipboard10

解析出错的原因
这个BILLINGDOCUMENTDATEYEAR出现在了一个内表里,expect的行为是不出现。还需要看。

clipboard11

比较两个step发送url有何差异,已经能看出原因了,蓝色的区域是第二个step新增加的url:

clipboard12

之前的研究概括起来就是:在第一个step的chart上选中2016年那个节点,然后创建第二个step,此时给后台发送的url如下:

clipboard13

这时选中的context 2016年就是上图紫色的内容,通过debug框架,发现其验证逻辑认为紫色的2016年是不合法的,因为and 左边的filter里已经包含了这个条件了,所以报错。这些url都是APF runtime 负责拼接再传给后台的,我们没办法控制,这个问题可能需要和APF的同事一起来看:
或者是我们filter的modelling有问题
或者是APF 处理filter这块的JS代码有问题

We got this “filter condition is too complex error” again, add sap-apf-filter-reduction=true in the URL doesn’t work this time.
Go to:

https://jerry.wdf.sap.corp:1300/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html?sap-client=928#BillingDocument-testSalesVolume?EvaluationId=.E.1464769533103&sap-xapp-state=ASMUJD92Q3C7JZ6BJ9G5AA8DNIVBC7IKQFPAM4WD&/
Don’t change filter, add a step, the error will occur.

clipboard14

I checked the error log and debugged the code like we did last time, I found that the cause is not the same as the last time:
Filter check code on ER9:

clipboard15
clipboard16
clipboard17
clipboard18
clipboard19
clipboard20

It seems the code check if there’re more than one filters have more than one values in the condition, if so, it will raise error.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

猜你喜欢

转载自blog.csdn.net/i042416/article/details/88949723