ABAP 新特性 – 内表操作:LINES/LINE_EXISTS/LINE_INDEX

LINES

SELECT carrid 
       FROM scarr 
       INTO TABLE @DATA(lt_tab). 

OLD:
DESCRIBE TABLE lt_tab LINES DATA(LV_TABIX).

NEW:
DATA(LV_TABIX) = LINES( lt_tab ).

LINE_EXISTS

SELECT * 
       FROM spfli 
       INTO TABLE @flight_tab. 

IF line_exists( flight_tab[ carrid = 'XM' 
                            connid = '6688' ] ). 
  "ACTION
ENDIF. 

LINE_INDEX

OLD:
READ TABLE flight_tab TRANSPORTING NO FIELDS WITH KEY carrid = 'XX'
                                                       connid = '88'.
IF sy-subrc = 0.
  WRITE: sy-tabix. "index
ENDIF.

NEW:
DATA(indx) = line_index( flight_tab[ carrid = 'XX'
                                      connid = '88'] ).
WRITE: indx.
RIPRO主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
SapiBook » ABAP 新特性 – 内表操作:LINES/LINE_EXISTS/LINE_INDEX

发表评论