其他分享
首页 > 其他分享> > 直接分页查询

直接分页查询

作者:互联网

FUNCTION ztm_rfc004.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(LV_ZWWCK) TYPE  ZWWCK OPTIONAL
*"     VALUE(P_START) TYPE  SY-TABIX OPTIONAL
*"     VALUE(P_LIMIT) TYPE  SY-TABIX OPTIONAL
*"  EXPORTING
*"     VALUE(P_TOTAL) TYPE  SY-TABIX
*"  TABLES
*"      ET_OUT STRUCTURE  ZMMT009C OPTIONAL
*"----------------------------------------------------------------------

  RANGES:r_zwwck FOR zmmt009c-zwwck.
*  DATA:  lt_out LIKE TABLE OF et_out.


  IF lv_zwwck IS NOT INITIAL.
    r_zwwck-sign = 'I'.
    IF '*' CO lv_zwwck.
      r_zwwck-option = 'CP'.
    ELSE.
      r_zwwck-option = 'EQ'.
    ENDIF.
    r_zwwck-low = lv_zwwck.
    APPEND r_zwwck.
  ENDIF.

  SELECT COUNT(*)
    INTO @p_total
    FROM zmmt009c
    WHERE zwwck IN @r_zwwck.


  SELECT FROM zmmt009c
    FIELDS *
     WHERE zwwck IN @r_zwwck
    ORDER BY zwwck
    INTO CORRESPONDING FIELDS OF TABLE @et_out
    OFFSET @p_start UP TO @p_limit ROWS.

*  total = lines( lt_out[] ).



ENDFUNCTION.

 

标签:分页,TYPE,zwwck,VALUE,查询,zmmt009c,直接,OPTIONAL,out
来源: https://www.cnblogs.com/chaguoguo/p/16304291.html