java getIV_Java SAP CRM get_children 方法里面参数 iv_as_copy 有什么用? _好机友

lv_children = iv_account->get_children( iv_as_copy = abap_true ). 的参数啥意思 lo_children = iv_account->get_relation( iv_relation_name = iv_as_copy = abap_false ).

解释没太看懂There is one special thing you need to know on the parameter IV_AS_COPY of GET_CHILDREN. It has only effect on the iterator GET_FIRST etc. of the container list you will receive back. If set to true the iterator will iterate only on the children inside the container list when it was created. If the parameter is set to false the iterator will take into account children that are added to the container (or which are deleted from it) after the container list was get. It is a misunderstanding that you get a copy of the content of the container if you use this parameter. Knowing this you now have the knowledge going through the relations of your model getting a separate nested container for every 1:n relation.

Rule of thumb:

(1) iv_as_copy = true => you get a snapshot (preffered) (2) iv_as_copy = false => list gets updated; use only if you want to keep the list; has negative impact on performance/memory consumption

其实对于做过debug的developer,看了文档里对这个参数的解释后理解就会更加深刻。但是的确刚刚接触的developer看了解释可能仍然似懂非懂。

这个参数关键起作用的地方就在container object list的构造函数里:6soim2oiu5.jpeg?w=700

如果你使用iv_as_copy = true得到一个container object list,那么这个container object list A 只是当前parent container object的children的一个snapshot,今后parent container object 如果有新的children加进来之后,新的child不会反映到你得到的snapshot A去,因为technical上讲,你的snapshot并没有注册 parent container object的CHILD_ADDED event,因为不会被通知到。

举一个例子:

我在从Account navigate 到AccountAddress的地方加一段代码,分别存储两种方式得到的account address container object list,这个时候还没有真正取Account address,所以两个container object list里面都只有一个dummy的entry,is_handle = Xocfxdp71xv.jpeg?w=700

我新建一个Address,然后savezl0vt8bubf.jpeg?w=700

因为当前的Account DB里面有50个address,我又在当前session里面添加了1个,所以iv_as_copy = false的有51个item,而snapshot仍然只有1个dummy的。n4llecrl0a.jpeg?w=700

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值