*&---------------------------------------------------------------------* *& Report YTEST1 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ytest1. TYPES:BEGIN OF ty_tab, tabix TYPE sy-tabix, END OF ty_tab. DATA:lt_tab TYPE TABLE OF ty_tab. lt_tab = VALUE #( ( tabix = 1 ) ( tabix = 1 ) ( tabix = 1 ) ( tabix = 2 ) ). "表记录是否存在 CHECK line_exists( lt_tab[ tabix = 1 ] ). "获取行号 DATA(lv_index) = line_index( lt_tab[ tabix = 1 ] ). "获取行内容 DATA(ls_tab) = lt_tab[ tabix = 1 ]. "获取满足条件的行数 DATA(lv_lines) = REDUCE i( INIT x = 0 FOR wa IN lt_tab WHERE ( tabix = 1 ) NEXT x = x + 1 ). "合计行数据 DATA(lv_tabix) = REDUCE i( INIT x = 0 FOR wa IN lt_tab WHERE ( tabix = 1 ) NEXT x = x + wa-tabix ).