獲取表的結構、欄位描述等

liuhaimiao發表於2017-02-17

REPORT  z_barry_table_field.

TYPE-POOLS slis.

DATA: it_fields TYPE STANDARD TABLE OF dd03p ,
      gs_layout TYPE slis_layout_alv .

PARAMETERS p_table TYPE ddobjname OBLIGATORY.

CALL FUNCTION 'DDIF_TABL_GET'
  EXPORTING
    name          = p_table
    langu         = sy-langu
  TABLES
    dd03p_tab     = it_fields
  EXCEPTIONS
    illegal_input = 1
    OTHERS        = 2.

*DELETE it_fields WHERE fieldname+0(1) = '.'.

gs_layout-zebra             = 'X'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-no_keyfix         = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_structure_name   = 'DD03P'
    is_layout          = gs_layout
  TABLES
    t_outtab           = it_fields
  EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/223653/viewspace-2133741/,如需轉載,請註明出處,否則將追究法律責任。

相關文章