[英]How to replace append lines of in ABAP 7.5?
I have the following code snippet, that I would like to write in functional style :我有以下代码片段,我想以函数式风格编写:
data(lt_es) = me->prepare_process_part_ztoa1( ).
APPEND LINES OF me->prepare_process_part_protocol( ) to lt_es.
How to rewrite the code above in new ABAP 7.5?如何在新的 ABAP 7.5 中重写上面的代码?
Use the LINES OF
construct (available since ABAP 7.40 SP 8 ).使用
LINES OF
构造(自ABAP 7.40 SP 8起可用)。
For instance, it could be something like this:例如,它可能是这样的:
lt_es = VALUE #( BASE me->prepare_process_part_ztoa1( )
( LINES OF me->prepare_process_part_protocol( ) ) ).
Whether it is better/simplier than the original, that's another question :)它是否比原版更好/更简单,这是另一个问题:)
It can be also done without BASE
.它也可以在没有
BASE
情况下完成。 However one must specify the type explicitly (usage of #
ends with a syntax error).然而,必须明确指定类型(
#
使用以语法错误结束)。
REPORT ZZZ.
DATA: lt_t1 TYPE string_table,
lt_t2 TYPE string_table.
DATA(lt_t3) = VALUE string_table( ( LINES OF lt_t1 ) ( LINES OF lt_t2 ) ).
Would be interesting to know if this is maybe more performant than the usage of BASE
if used in a loop for example.例如,如果在循环中使用,这是否可能比
BASE
的使用性能更高,这将会很有趣。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.