日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

get_children 方法里面参数 iv_as_copy 有什么用?

發(fā)布時(shí)間:2023/12/19 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 get_children 方法里面参数 iv_as_copy 有什么用? 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Sent: Wednesday, May 08, 2013 11:47 AM

Question:

lv_children = iv_account->get_children( iv_as_copy = abap_true ). 的參數(shù)啥意思 lo_children = iv_account->get_relation( iv_relation_name = <rel> 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:

  • iv_as_copy = true => you get a snapshot (preffered)
  • iv_as_copy = false => list gets updated; use only if you want to keep the list; has negative impact on
    performance/memory consumption
  • Sent: Thursday, May 09, 2013 5:21 PM

    其實(shí)對于做過debug的developer,看了文檔里對這個(gè)參數(shù)的解釋后理解就會更加深刻。但是的確剛剛接觸的developer看了解釋可能仍然似懂非懂。

    這個(gè)參數(shù)關(guān)鍵起作用的地方就在container object list的構(gòu)造函數(shù)里:

    如果你使用iv_as_copy = true得到一個(gè)container object list,那么這個(gè)container object list A 只是當(dāng)前parent container object的children的一個(gè)snapshot,今后parent container object 如果有新的children加進(jìn)來之后,新的child不會反映到你得到的snapshot A去,因?yàn)閠echnical上講,你的snapshot并沒有注冊 parent container object的CHILD_ADDED event,因?yàn)椴粫煌ㄖ健?/p>

    舉一個(gè)例子:

    我在從Account navigate 到AccountAddress的地方加一段代碼,分別存儲兩種方式得到的account address container object list,這個(gè)時(shí)候還沒有真正取Account address,所以兩個(gè)container object list里面都只有一個(gè)dummy的entry,is_handle = X

    我新建一個(gè)Address,然后save

    因?yàn)楫?dāng)前的Account DB里面有50個(gè)address,我又在當(dāng)前session里面添加了1個(gè),所以iv_as_copy = false的有51個(gè)item,而snapshot仍然只有1個(gè)dummy的。

    要獲取更多Jerry的原創(chuàng)文章,請關(guān)注公眾號"汪子熙":

    創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

    總結(jié)

    以上是生活随笔為你收集整理的get_children 方法里面参数 iv_as_copy 有什么用?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。