内表要进行排序 然后删除重复行SORT BY [ascending/descending].DELETE ADJACENT DUPLICATES FROM COMPARING ALL FIELDS. type-pools: slis. field-symbols: type standard table, ” 内表 结构 <dyn_wa>, ” 表头 <dyn_field>. ” 项 data: dy_table type ref to data, dy_line type ref to data, ” 行 xfc type lvc_s_f cat , ” 列结构 ifc type lvc_t_f cat . call method cl_alv_table_create=>create_dynamic_table exporting it_field cat alog = ifc importing ep_table = dy_table. assign dy_table->* to <dyn_table>. create data dy_line like line of <dyn_table>. assign dy_line->* to <dyn_wa>.
ABAP 语言中,可以使用内置函数DISTINCT去除 重复 项。下面是一个简单的例子: DATA:BEGIN OF lt_data OCCURS 0, field1 TYPE string, field2 TYPE string, END OF lt_data. " 在这里添加原始 数据 到lt_data SORT lt_data BY field1...
或者从 数据 表到 内表 进行SELECT后加distinct。 DATA IT_PRINT_001 LIKE 你的 内表 名 OCCURS 0 WITH HEADER LINE. IT_PRINT_001[] = 你的 内表 名[]. sort it_alv by liushui d es cending werks ps_psp_pnr ASCENDING. 删除 重复 内容: DELETE ADJACENT DUPLI CAT ES FROM IT_PRINT_0.
前一段时间调试一个程序的,半天没发现问题在哪里,经过测试才发现 delete adjacent dupli cat es from itab 和 delete adjacent dupli cat es from itab comparing all fields还是有区别的: 前者相邻两行 数据 ,如果除金额字段以外的其他字段都相同,则 去重 删除 其中一行; 后者相邻两行 数据 ,如果所有对应的字段都相同(包含金额字段),则 去重 删除 其中一行。 以下文檔地址 使用DELETE ADJACENT FORM i.
场景:userlist为处理后的 数据 内表 ,字段为(身份证、员工号、标识号),需求为筛选出身份证号出现次数大于1的 数据 展现。 首先处理 数据 ,将userlist中符合要求的 数据 附加到userlistout中。 将处理后的 数据 输出为alv报表。
type-pools: slis. field-symbols: type standard table, ” 内表 结构 , ” 表头 . ” 项 data: dy_table type ref to data, dy_line type ref to data, ” 行 xfc type lvc_s_f cat , ” 列结构 ifc type lvc_t_f cat . call method cl_alv_table_create=>create_dynamic_table exporting it_field cat alog = ifc importing ep_table = dy_table. assign dy_table->* to . create data dy_line like line of . assign dy_line->* to . 申明:文档资源来源于网络博客!
您可以使用 ABAP 内表 的 INSERT 语句来插入 数据 。例如,如果您有一个名为 ITAB 的 内表 ,并且想要在其中插入一行 数据 ,可以使用以下代码: DATA: wa_itab TYPE LINE OF itab. wa_itab-field1 = 'Value1'. wa_itab-field2 = 'Value2'. wa_itab-field3 = 'Value3'. INSERT wa_itab INTO TABLE itab. 这将在 ITAB 内表 中插入一行 数据 ,其中 field1、field2 和 field3 是 内表 的字段名称,而 Value1、Value2 和 Value3 是要插入的实际值。