ABAP alv输出的方式详解编程语言

1. FUNCTION ‘REUSE_ALV_GRID_DISPLAY_LVC’

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' 
    EXPORTING 
      i_callback_program       = sy-repid 
      is_layout_lvc            = gs_layout 
      it_fieldcat_lvc          = gt_fieldcat[] 
*     i_grid_settings          = ls_glay 
       i_callback_pf_status_set    = 'FM_SET_STATUS' 
      i_callback_user_command  = 'FRM_UCOMM' 
      i_default                = 'X' 
      i_save                   = 'A' 
      it_excluding             = it_exclude 
      it_event_exit            = gt_event_exit[] 
*     i_grid_title             = r_title 
      is_variant                  = gs_alv_variant 
    TABLES 
      t_outtab                 = gt_out 
    EXCEPTIONS 
      program_error            = 1 
      OTHERS                   = 2.

2. FUNCTION ‘REUSE_ALV_GRID_DISPLAY’

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
    EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

i_callback_pf_status_set = 'FM_FULLSCREEN'

i_callback_user_command = 'ALV_COMMADN'

* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = lt_layo
it_fieldcat = t_zsdr059
it_excluding = it_exclude
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE = * I_DEFAULT = 'X'
i_save = 'A'
* IS_VARIANT =
it_events = git_events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_zsdr059
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

一般调用:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
    EXPORTING 
      i_structure_name   = 'KKBCS' 
      it_fieldcat        = lt_field 
      is_layout          = gs_layout 
      i_callback_program = sy-repid 
      i_grid_title       = '' 
    TABLES 
      t_outtab           = gt_kkbcs[]

3.OO方式的alv:set_table_for_first_display

ls_variant-report = sy-repid. 
  
CALL METHOD gc_alvgrid->set_table_for_first_display 
    EXPORTING 
      is_layout       = ls_layout 
      i_save          = 'A'          "设置成A 
       is_variant       = ls_variant   "这个参数也必须输入 
    CHANGING 
      it_outtab       = git_item[] 
      it_fieldcatalog = git_fieldcat[].

4.FUNCTION ‘LVC_FIELDCATALOG_MERGE’ 根据表结构生成fieldcat

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' 
    EXPORTING 
      i_structure_name       = 'ZSSD028' 
    CHANGING 
      ct_fieldcat            = gt_fieldcatalog[] 
    EXCEPTIONS 
      inconsistent_interface = 1 
      program_error          = 2 OTHERS = 3.

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/18589.html

(0)
上一篇 2021年7月19日 21:15
下一篇 2021年7月19日 21:15

相关推荐

发表回复

登录后才能评论