专栏首页Jerry的SAP技术分享如何在SAP C4C AdvancedListPane上批量执行若干BO实例的action

如何在SAP C4C AdvancedListPane上批量执行若干BO实例的action

Recently one partner asked me about this question. Suppose I have a custom BO with one Date field “CloseDate”, and one indicator field “IsOverDue”.

There is an action “OverDueCheckMass” defined with the simple logic that if current date < Close Date, then I consider the order as Overdue and vice versa. The source code of this action implementation:

import ABSL;
var current = Context.GetCurrentGlobalDateTime( );

foreach( var rootNode in this ){
	var closeDate = rootNode.CloseDate.ConvertToGlobalDateTime();
	rootNode.IsOverDue = current.LessThan(closeDate);
}

This action is marked as Mass-enabled.

Requirement is: in the table implemented by AdvancedListPane in UI Designer, if several rows are selected by Ctrl+Click ( Or Shift + Click ), once the button “Overdue check” is pressed, the action must be performed on those selected rows.

Take the below screenshot as example, the first and fourth row are selected, it is expected that after OverDue check is executed, IsOverDue indicator for the first row is determined as Yes.

Here below is details step how this requirement could be fulfilled.

(1) Specify the List SelectOption property as “multiSelectWithLeadSelection”.

Create a Data List in DataModel tab:

(2) Create an event handler with type BOAction. For instance Binding attribute, bind it to the Data List created in previous step. Choose “multiple” as Action Type and bind this event handler to BO Action OverDueCheckMass.

By default when you create a new event handler, Action Type is always set as single by default. Don’t worry, once you bind this action to the Instance Binding which points to a Data List in your Data Model and the BO action implementation is Mass-Enabled, once you click bind button, this Action Type will change into multiple automatically.

After these two steps are done, select the first and fourth row and press the OverDue check button – it works as expected.

How it works under the hood

Suppose you have first pressed Ctrl key and then select the first and fourth row, how UI5 framework reacts to this event? Set a breakpoint on function OnClick of file TablePointerExtension.js, and there is one attribute ctrlKey in the native HTML event object which indicates whether the Ctrl key is pressed in current event.

With this indicator, UI5 framework could react accordingly:

Since I have selected the SelectOption of my list as multiSelect, so UI5 uses an array to store the selected rows’ indexes:

Now when you click Overdue Check button with the state that first and fourth rows are selected, the breakpoint set in method SendAsyncPostRequest in file Request.js will be triggered. Check what exactly the data will be sent to backend by inspecting variable mParameters:

It clearly shows that the node ID of selected two BO instances are passed to backend for action execution.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • SAP CRM IBASE的archive方法

    There is one IBASE 112467 which contains one object component. This IBASE is int...

    Jerry Wang
  • SAP OData性能分析工具

    As mentioned by title, this blog does not introduce the OData trace functionalit...

    Jerry Wang
  • 使用SAP Transaction Launcher将ABAP Webdynpro嵌入到WebClient UI中

    THINK twice why you want to include an ABAP webdynpro component into CRM UI, as ...

    Jerry Wang
  • 语境很重要:手语识别的自我注意(cs,AI)

    本文为连续手语识别任务提出了一注意力网络。拟议的方法利用相互依赖的数据流来建模手语模式。这些不同的信息渠道可以共享彼此复杂的时间结构。因此,我们关注同步并帮助捕...

    天然 8129060
  • 聊聊flink LocalEnvironment的execute方法

    flink-java-1.6.2-sources.jar!/org/apache/flink/api/java/DataSet.java

    codecraft
  • 聊聊flink LocalEnvironment的execute方法

    flink-java-1.6.2-sources.jar!/org/apache/flink/api/java/DataSet.java

    codecraft
  • Redis 为什么这么快?(9)

    因为单线程已经够用了,CPU不是redis的瓶颈。Redis的瓶颈最有可能是机器内存或者网络带宽。既然单线程容易实现,而且CPU不会成为瓶颈,那就顺理成章地采用...

    兜兜毛毛
  • 多目标进化算法应用于提高医药数据领域学习器的性能(CS AI)

    原文标题完整翻译:多目标进化算法应用于提高在医药数据领域使用整体特征选择和离散化模型的学习器的性能

    Donuts_choco
  • SAP CRM IBASE的archive方法

    There is one IBASE 112467 which contains one object component. This IBASE is int...

    Jerry Wang
  • 如何启用SAP Business by design里的Correction Invoice功能

    Subject: [Tip] How to enable the function Correction Invoice for customer invoic...

    Jerry Wang

扫码关注云+社区

领取腾讯云代金券