程序代码:
  1. *---type pools
  2. TYPE-POOLS: slis.
  3. *---internal tables
  4. DATA: BEGIN OF it_flight OCCURS 0,
  5.        carrid  LIKE sflight-carrid,
  6.        connid   LIKE sflight-connid,
  7.        fldate   LIKE sflight-fldate,
  8.        seatsmax LIKE sflight-seatsmax,
  9.        seatsocc LIKE sflight-seatsocc,
  10.       END OF it_flight,
  11. *--internal tables for ALV
  12.       it_fieldcat TYPE  slis_t_fieldcat_alv,
  13.       wa_fcat LIKE LINE OF it_fieldcat,
  14.       layout TYPE  slis_layout_alv,
  15.       it_sort type  slis_t_sortinfo_alv,
  16.       wa_sort like line of it_sort.
  17. *---start-of-selection .
  18. START-OF-SELECTION.
  19. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  20.   EXPORTING
  21.     i_program_name         = sy-repid
  22.     i_internal_tabname     = 'IT_FLIGHT'
  23.     i_inclname             = sy-repid
  24.   CHANGING
  25.     ct_fieldcat            = it_fieldcat
  26.   EXCEPTIONS
  27.     inconsistent_interface = 1
  28.     program_error          = 2.
  29. *----get data
  30.   SELECT carrid
  31.          connid
  32.          fldate
  33.          seatsmax
  34.          seatsocc
  35.    FROM sflight
  36.    INTO CORRESPONDING FIELDS OF TABLE it_flight
  37.    UP TO 20 ROWS.
  38.   .
  39.   wa_fcat-do_sum = 'X'.
  40.   MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
  41.    WHERE fieldname = 'SEATSOCC' .
  42.   wa_sort-fieldname = 'CARRID'.
  43.   wa_sort-group = 'UL'.  "显示分割线
  44.   wa_sort-up = 'X'.
  45.   APPEND wa_sort TO it_sort.
  46.   wa_sort-fieldname = 'CONNID'.
  47.   wa_sort-subtot = 'X'.
  48.   wa_sort-up = 'X'.
  49.   APPEND wa_sort TO it_sort.

  50.   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  51.     EXPORTING
  52.       i_callback_program = sy-repid
  53.       is_layout          = layout
  54.       it_fieldcat        = it_fieldcat
  55.       it_sort            = it_sort
  56.     TABLES
  57.       t_outtab           = it_flight
  58.     EXCEPTIONS
  59.       program_error      = 1.
复制代码


程序执行效果:
在alv list小计之后输出分割线

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-06-01
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2021-11-17
相关资源
相似解决方案