APPEND INITIAL LINE 向内表中插入空行追加数据

2024-07-04 16:26:12 0点赞 0收藏 0评论


APPEND INITIAL LINE TO lt_tab_new ASSIGNING FIELD-SYMBOL().

SELECT SINGLE * FROM zudi_master INTO @DATA(ls_test).​ APPEND INITIAL LINE TO udi_master ASSIGNING FIELD-SYMBOL().​ MOVE-CORRESPONDING ls_test TO .​ APPEND INITIAL LINE TO udi_mapp_in ASSIGNING FIELD-SYMBOL().​ MOVE-CORRESPONDING ls_test TO .APPEND INITIAL LINE 向内表中插入空行追加数据

https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapappend_linespec.htm

DATA itab TYPE TABLE OF spfli.​FIELD-SYMBOLS LIKE LINE OF itab.​APPEND INITIAL LINE TO itab ASSIGNING .-carrid = '...'....​

语法:

​​SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.ABAP - Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables → APPEND → ​APPEND - line_spec​Quick Reference​Syntax​... wa | {INITIAL LINE} | {LINES OF jtab [FROM idx1] [TO idx2] [USING KEY keyname]} ...​Alternatives:​1. ... wa​2. ... INITIAL LINE​3. ... LINES OF jtab [FROM idx1] [TO idx2] [USING KEY keyname]​Effect​Either a work area wa, an initial row INITIAL LINE, or multiple rows of an internal table jtab can be appended.​Alternative 1​... wa​​Effect​A new row is appended to which the content of the work area wa is assigned. wa is a general expression position. wa may be incompatible with the row type of the internal table and, if necessary, is converted to the row type in accordance with the conversion rules. If a conversion error occurs here, the exception cannot be handled using CX_SY_CONVERSION_ERROR and the associated runtime error occurs instead. If an arithmetic expression is specified for wa, the row type of the internal table is respected when determining the calculation type.​Notes​ If a conflict occurs with an existing unique primary table type, this raises a non-handleable exception when appending a single row. In the case of a conflict with a unique secondary table key, a handleable exception of the class CX_SY_ITAB_DUPLICATE_KEY is raised.​ Specifying a calculation expression for wa is usually only a good idea for elementary row types.​ With the exception, an obsolete short form is possible where wa TO can be omitted, if the internal table has a header line itab with the same name. The statement then uses the header line as the work area implicitly.​​Example​Appending square numbers to a sorted table with elementary row type.​DATA: int TYPE i, itab LIKE SORTED TABLE OF int WITH UNIQUE KEY table_line.​DO 10 TIMES. int = sy-index ** 2. APPEND int TO itab.ENDDO.​Alternative 2​... INITIAL LINE​​Effect​A new row is added in which every component contains the type-friendly initial value.​Example​Attaching an initial row which is also linked to a field symbol by the ASSIGNING addition. This means that initial rows can be processed directly.​DATA itab TYPE TABLE OF spfli.​FIELD-SYMBOLS LIKE LINE OF itab.​APPEND INITIAL LINE TO itab ASSIGNING .-carrid = '...'....​Alternative 3​... LINES OF jtab [FROM idx1] [TO idx2] [USING KEY keyname]​​Effect​The rows of an internal table jtab are added as a block. jtab is a functional operand position.​The inserted rows are sequentially taken from the table jtab. The row type of jtab can be incompatible with the row type of the internal table itab and it is converted to the row type of the target table (if necessary), in accordance with the conversion rules. If a conversion error occurs here, the exception cannot be handled using CX_SY_CONVERSION_ERROR and the associated runtime error occurs instead.​The order in which the rows are taken is the same as for the statement LOOP and can also be influenced by specifying a table key keyname after USING KEY. The additions FROM idx1 and TO idx2 have, in relation to jtab, the same syntax and effect as for LOOP.​If a conflict with existing primary or secondary table keys occurs, this always raises a non-handleable exception when multiple rows are appended.​Note​When a standard table is constructed, the constructor operators NEW and VALUE can also append multiple rows from a table to the target table using LINES OF.​



我是老周,如果你喜欢我的文字,请记得点击⬇️关注我。


码字不易,文章下拉,右边点个【赞】和【在看】吧!!

猜您还喜欢合集:

解决方案

SAP优化

ABAP新语法

SAP Note

SAP

ABAP

懒人鱼

猜您还喜欢文章:

聊聊ABAP动态编程

SAP这样优化:乙方开心,甲方放心!

浅谈SAP/SSO介绍及应用

浅谈SAP/ 文档管理解决方案

浅谈SAP/某化学纤维行业客户-优化案例

展开 收起
0评论

当前文章无评论,是时候发表评论了
提示信息

取消
确认
评论举报

相关文章推荐

更多精彩文章
更多精彩文章
最新文章 热门文章
0
扫一下,分享更方便,购买更轻松