Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

structure of a table

Former Member
0 Kudos
297

hi all,

I want to save the structure of a table in a file

can i save it?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
94

Here's a Utility Program that I wrote and use for simplicty.

Modify it for your needs, but you can simply change the ALV Layout then export it to Excel.


REPORT yptc_table_sturcture .

TABLES: dd03l.

*---------------------------------------------------------------*
*   ALV Related Fields & Tables
*---------------------------------------------------------------*
TYPE-POOLS: slis.
CONSTANTS:
  gc_formname_top_of_page   TYPE slis_formname VALUE 'TOP_OF_PAGE',
  gc_formname_user_command   TYPE slis_formname VALUE 'USER_COMMAND'.

DATA: g_fieldcat                   TYPE slis_t_fieldcat_alv,
        g_extab                    TYPE slis_t_extab,
        g_layout                   TYPE slis_layout_alv,
        g_keyinfo                  TYPE slis_keyinfo_alv,
        g_print                    TYPE slis_print_alv,
        g_sort                     TYPE slis_t_sortinfo_alv,
        g_sp_group                 TYPE slis_t_sp_group_alv,
        g_events                   TYPE slis_t_event,
        g_events_ex                TYPE slis_t_event_exit,
        g_repid                    LIKE sy-repid,
        g_list_top_of_page         TYPE slis_t_listheader,
        g_save                     TYPE c.
*        g_exit                     TYPE c.
*        g_variant                  LIKE disvariant,
DATA: ls_line                      TYPE slis_listheader.

DATA:
  tab_rec LIKE dd03l,
  it_table LIKE STANDARD TABLE OF tab_rec.

PARAMETERS:
  tabname    LIKE dd03l-tabname.
*______________________________________  Initialization
INITIALIZATION.
* Check authority for ALV Standard layout save option
  AUTHORITY-CHECK OBJECT 'ZALV_STD'
          ID 'ACTVT' FIELD '02'.
  IF sy-subrc = 0.
    g_save = 'A'.
  ELSE.
    g_save = 'U'.
  ENDIF.

START-OF-SELECTION.

  REFRESH it_table.

  SELECT * INTO TABLE it_table FROM dd03l
    WHERE tabname = tabname
    ORDER BY position.

  PERFORM display_alv_report.
*---------------------------------------------------------------------*
*       FORM display_alv_report                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM display_alv_report.
  PERFORM fieldcat_init      USING g_fieldcat[].
  PERFORM build_sort_fields  USING g_sort[].
  PERFORM eventtab_build     USING g_events[]
                                   g_events_ex[].
  PERFORM layout_build       USING g_layout.
*
  PERFORM list_view.
*
ENDFORM.                    " display_alv_report.


*====> End of section that produces the report
*====> This section builds the event table


FORM eventtab_build
    USING e03_lt_events TYPE slis_t_event
          e03_lt_events_ex TYPE slis_t_event_exit.
  DATA: ls_event      TYPE slis_alv_event,
        ls_event_exit LIKE LINE OF e03_lt_events_ex.
*
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
            i_list_type = 1
       IMPORTING
            et_events   = e03_lt_events.
  READ TABLE e03_lt_events
       WITH KEY name = slis_ev_top_of_page
       INTO ls_event.
  IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
  ENDIF.
  READ TABLE e03_lt_events
       WITH KEY name = 'USER_COMMAND'
       INTO ls_event.
  IF sy-subrc = 0.
    MOVE gc_formname_user_command TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
  ENDIF.
  ls_event_exit-ucomm  = 'DISP'.
  APPEND ls_event_exit TO  e03_lt_events_ex.
ENDFORM.                    " build_events_table


*====> End of the Build Events section
*====> This section builds the Layout Record


FORM layout_build
    USING e05_ls_layout TYPE slis_layout_alv.
*
  CLEAR e05_ls_layout.
*
  e05_ls_layout-f2code = 'DISP'.
  e05_ls_layout-colwidth_optimize = 'X'.
  e05_ls_layout-zebra = 'X'.
  e05_ls_layout-detail_popup = 'X'.
  e05_ls_layout-detail_initial_lines = 'X'.
  e05_ls_layout-detail_titlebar = 'Table Structure'.
  e05_ls_layout-info_fieldname = 'X'.
*
*  e05_ls_layout-min_linesize = 125.
*  gs_print-no_print_listinfos = 'X'.
*
ENDFORM.                    " layout_build


*====> End of the Build for Layout Record
*====> This section builds the Actual Display Routine


FORM list_view.
*
  g_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program = g_repid
            is_layout          = g_layout
            it_sort            = g_sort[]
            it_events          = g_events[]
            it_fieldcat        = g_fieldcat[]
            i_save             = g_save
       TABLES
            t_outtab           = it_table
       EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.

  IF sy-subrc <> 0.
    MESSAGE e208(00) WITH 'Error: ALV Grid'.
  ENDIF.
*
ENDFORM.                    " layout_build


*====> End of Actual Display Routine
*====> This section builds the Top of Page Routine


FORM top_of_page.
*
  DATA: ls_line TYPE slis_listheader.
*
  CLEAR g_list_top_of_page[].
  CLEAR ls_line.
  ls_line-typ  = 'H'.
  CONCATENATE 'Table Structure -' tabname
    INTO ls_line-info SEPARATED BY space.
  APPEND ls_line TO g_list_top_of_page.
  PERFORM build_sub_headings
      USING g_list_top_of_page.
*
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
            it_list_commentary = g_list_top_of_page[].
*
ENDFORM.                    " top_of_page
*
FORM build_sub_headings
        USING e07_top_of_page TYPE slis_t_listheader.
  DATA: ls_line TYPE slis_listheader.
*
  CLEAR ls_line.
  ls_line-typ  = 'S'.
  ls_line-key = 'Run Info'.
  CONCATENATE  sy-sysid sy-uname sy-mandt
        INTO ls_line-info
        SEPARATED BY space.
  APPEND ls_line TO e07_top_of_page.
*
ENDFORM.                    "build_sub_headings


*====> End of top_of_page
*====> This section builds the User Command Routine


FORM user_command
        USING p_ucomm LIKE sy-ucomm
              p_selfield TYPE slis_selfield.
*
  IF p_selfield-value NE space.
    CASE p_selfield-tabname.
      WHEN 'IT_TABLE'.
        READ TABLE it_table INDEX p_selfield-tabindex
                  INTO tab_rec.
      WHEN OTHERS.
        EXIT.
    ENDCASE.
  ELSE.
    EXIT.
  ENDIF.
*
  CHECK sy-subrc = 0.
*
  CASE p_selfield-fieldname.
*    WHEN 'QUOTE'.
*      SET PARAMETER ID 'AGN' FIELD p_selfield-value.
*      CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.
*
    WHEN OTHERS.
      EXIT.
  ENDCASE.
*
ENDFORM.                    "user_command
*&--------------------------------------------------
*&      Form  build_sort_fields
*&--------------------------------------------------
FORM build_sort_fields
  USING p_sort TYPE slis_t_sortinfo_alv..
*----------------------> ALV Build Sort Table
  DATA:  ls_sort  LIKE LINE OF p_sort.
  REFRESH p_sort.
* Table name
  CLEAR ls_sort.
  ls_sort-tabname       = 'IT_TABLE'.
  ls_sort-fieldname     = 'TABNAME'.
  ls_sort-up            = 'X'.
  APPEND ls_sort TO p_sort.
* Position of the field in the table
  CLEAR ls_sort.
  ls_sort-tabname       = 'IT_TABLE'.
  ls_sort-fieldname     = 'POSITION'.
  ls_sort-up            = 'X'.
  APPEND ls_sort TO p_sort.
ENDFORM.          " build_sort_fields
*&--------------------------------------------------
*&      Form  fieldcat_init
*&--------------------------------------------------
FORM fieldcat_init
  USING e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.

  CLEAR: e01_lt_fieldcat[], e01_lt_fieldcat.
* Table name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'TABNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'TABNAME'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table'.
  ls_fieldcat-SELTEXT_M     = 'Table name'.
  ls_fieldcat-SELTEXT_L     =
    'Table name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Field name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'FIELDNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'FIELDNAME'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Field name'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Field name'.
  ls_fieldcat-SELTEXT_M     = 'Field name'.
  ls_fieldcat-SELTEXT_L     =
    'Field name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Activation status of a Repository object
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'AS4LOCAL'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'AS4LOCAL'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Activation status'.
  ls_fieldcat-SELTEXT_L     =
    'Activation status'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Version of the entry (not used)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'AS4VERS'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'AS4VERS'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Version'.
  ls_fieldcat-SELTEXT_L     =
    'Version'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Position of the field in the table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'POSITION'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'POSITION'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table pos.'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table pos.'.
  ls_fieldcat-SELTEXT_M     = 'Table position'.
  ls_fieldcat-SELTEXT_L     =
    'Table position'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Identifies a key field of a table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'KEYFLAG'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'KEYFLAG'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Key field'.
  ls_fieldcat-SELTEXT_L     =
    'Key field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Flag: Field is required (not blank)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'MANDATORY'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'MANDATORY'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Required field'.
  ls_fieldcat-SELTEXT_L     =
    'Required field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Data element (semantic domain)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'ROLLNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'ROLLNAME'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Data elem.'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Data elem.'.
  ls_fieldcat-SELTEXT_M     = 'Data element'.
  ls_fieldcat-SELTEXT_L     =
    'Data element'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Check table name of the foreign key
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'CHECKTABLE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'CHECKTABLE'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Check table'.
  ls_fieldcat-SELTEXT_L     =
    'Check table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Nesting depth for includes
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'ADMINFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'ADMINFIELD'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Admin. field'.
  ls_fieldcat-SELTEXT_L     =
    'Admin. field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* ABAP data type (C,D,N,...)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'INTTYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'INTTYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'ABAP type'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'ABAP type'.
  ls_fieldcat-SELTEXT_M     = 'ABAP type'.
  ls_fieldcat-SELTEXT_L     =
    'ABAP type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Internal length in bytes
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'INTLEN'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'INTLEN'.
  ls_fieldcat-REPTEXT_DDIC   =
    'IntLen'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'IntLen'.
  ls_fieldcat-SELTEXT_M     = 'Internal length'.
  ls_fieldcat-SELTEXT_L     =
    'Internal length'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Table for reference field
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'REFTABLE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'REFTABLE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Ref. table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Ref. table'.
  ls_fieldcat-SELTEXT_M     = 'Reference table'.
  ls_fieldcat-SELTEXT_L     =
    'Reference table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Name of included table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'PRECFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'PRECFIELD'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Name of include'.
  ls_fieldcat-SELTEXT_L     =
    'Name of include'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Reference field for currency and qty fields
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'REFFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'REFFIELD'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Ref. field'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Ref. field'.
  ls_fieldcat-SELTEXT_M     = 'Ref. field'.
  ls_fieldcat-SELTEXT_L     =
    'Ref. field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Check or generating module for fields
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'CONROUT'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'CONROUT'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Check module'.
  ls_fieldcat-SELTEXT_L     =
    'Check module'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Indicator that NOT NULL is forced for this field
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'NOTNULL'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'NOTNULL'.
  ls_fieldcat-REPTEXT_DDIC   =
    'NOT NULL'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'NOT NULL'.
  ls_fieldcat-SELTEXT_M     = 'NOT NULL forced'.
  ls_fieldcat-SELTEXT_L     =
    'NOT NULL forced'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Data type in ABAP Dictionary
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DATATYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DATATYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'DataType'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'DataType'.
  ls_fieldcat-SELTEXT_M     = 'Data type'.
  ls_fieldcat-SELTEXT_L     =
    'Data type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Length (no. of characters)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'LENG'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'LENG'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Lngth'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Lngth'.
  ls_fieldcat-SELTEXT_M     = 'No. of characters'.
  ls_fieldcat-SELTEXT_L     =
    'No. of characters'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Number of decimal places
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DECIMALS'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DECIMALS'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Dec.places'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Dec.places'.
  ls_fieldcat-SELTEXT_M     = 'Decimal places'.
  ls_fieldcat-SELTEXT_L     =
    'Decimal places'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Domain name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DOMNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DOMNAME'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Domain'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Domain'.
  ls_fieldcat-SELTEXT_M     = 'Domain'.
  ls_fieldcat-SELTEXT_L     =
    'Domain name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Origin of an input help
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'SHLPORIGIN'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'SHLPORIGIN'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Origin of an input help'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'SH Origin'.
  ls_fieldcat-SELTEXT_M     = 'Origin of input help'.
  ls_fieldcat-SELTEXT_L     =
    'Origin of an input help'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Flag if it is a table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'TABLETYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'TABLETYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table'.
  ls_fieldcat-SELTEXT_M     = 'Table'.
  ls_fieldcat-SELTEXT_L     =
    'Table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Depth for structured types
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DEPTH'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DEPTH'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Depth'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Depth'.
  ls_fieldcat-SELTEXT_M     = 'Depth'.
  ls_fieldcat-SELTEXT_L     =
    'Depth'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Component type
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'COMPTYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'COMPTYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'CompTyp'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'CompTyp'.
  ls_fieldcat-SELTEXT_M     = 'CompTyp'.
  ls_fieldcat-SELTEXT_L     =
    'Component type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
ENDFORM.          " fieldcat_init

Edited by: Paul Chapman on Mar 10, 2008 3:09 PM

3 REPLIES 3

Former Member
0 Kudos
94

hi ,

go to the link may it useful for u,

http://help.sap.com/saphelp_nw04/helpdata/en/71/489218e5b411d2bdc3080009b4534c/frameset.htm

<REMOVED BY MODERATOR>

venkat.

Edited by: Alvaro Tejada Galindo on Mar 10, 2008 7:13 PM

Former Member
0 Kudos
95

Here's a Utility Program that I wrote and use for simplicty.

Modify it for your needs, but you can simply change the ALV Layout then export it to Excel.


REPORT yptc_table_sturcture .

TABLES: dd03l.

*---------------------------------------------------------------*
*   ALV Related Fields & Tables
*---------------------------------------------------------------*
TYPE-POOLS: slis.
CONSTANTS:
  gc_formname_top_of_page   TYPE slis_formname VALUE 'TOP_OF_PAGE',
  gc_formname_user_command   TYPE slis_formname VALUE 'USER_COMMAND'.

DATA: g_fieldcat                   TYPE slis_t_fieldcat_alv,
        g_extab                    TYPE slis_t_extab,
        g_layout                   TYPE slis_layout_alv,
        g_keyinfo                  TYPE slis_keyinfo_alv,
        g_print                    TYPE slis_print_alv,
        g_sort                     TYPE slis_t_sortinfo_alv,
        g_sp_group                 TYPE slis_t_sp_group_alv,
        g_events                   TYPE slis_t_event,
        g_events_ex                TYPE slis_t_event_exit,
        g_repid                    LIKE sy-repid,
        g_list_top_of_page         TYPE slis_t_listheader,
        g_save                     TYPE c.
*        g_exit                     TYPE c.
*        g_variant                  LIKE disvariant,
DATA: ls_line                      TYPE slis_listheader.

DATA:
  tab_rec LIKE dd03l,
  it_table LIKE STANDARD TABLE OF tab_rec.

PARAMETERS:
  tabname    LIKE dd03l-tabname.
*______________________________________  Initialization
INITIALIZATION.
* Check authority for ALV Standard layout save option
  AUTHORITY-CHECK OBJECT 'ZALV_STD'
          ID 'ACTVT' FIELD '02'.
  IF sy-subrc = 0.
    g_save = 'A'.
  ELSE.
    g_save = 'U'.
  ENDIF.

START-OF-SELECTION.

  REFRESH it_table.

  SELECT * INTO TABLE it_table FROM dd03l
    WHERE tabname = tabname
    ORDER BY position.

  PERFORM display_alv_report.
*---------------------------------------------------------------------*
*       FORM display_alv_report                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM display_alv_report.
  PERFORM fieldcat_init      USING g_fieldcat[].
  PERFORM build_sort_fields  USING g_sort[].
  PERFORM eventtab_build     USING g_events[]
                                   g_events_ex[].
  PERFORM layout_build       USING g_layout.
*
  PERFORM list_view.
*
ENDFORM.                    " display_alv_report.


*====> End of section that produces the report
*====> This section builds the event table


FORM eventtab_build
    USING e03_lt_events TYPE slis_t_event
          e03_lt_events_ex TYPE slis_t_event_exit.
  DATA: ls_event      TYPE slis_alv_event,
        ls_event_exit LIKE LINE OF e03_lt_events_ex.
*
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
            i_list_type = 1
       IMPORTING
            et_events   = e03_lt_events.
  READ TABLE e03_lt_events
       WITH KEY name = slis_ev_top_of_page
       INTO ls_event.
  IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
  ENDIF.
  READ TABLE e03_lt_events
       WITH KEY name = 'USER_COMMAND'
       INTO ls_event.
  IF sy-subrc = 0.
    MOVE gc_formname_user_command TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
  ENDIF.
  ls_event_exit-ucomm  = 'DISP'.
  APPEND ls_event_exit TO  e03_lt_events_ex.
ENDFORM.                    " build_events_table


*====> End of the Build Events section
*====> This section builds the Layout Record


FORM layout_build
    USING e05_ls_layout TYPE slis_layout_alv.
*
  CLEAR e05_ls_layout.
*
  e05_ls_layout-f2code = 'DISP'.
  e05_ls_layout-colwidth_optimize = 'X'.
  e05_ls_layout-zebra = 'X'.
  e05_ls_layout-detail_popup = 'X'.
  e05_ls_layout-detail_initial_lines = 'X'.
  e05_ls_layout-detail_titlebar = 'Table Structure'.
  e05_ls_layout-info_fieldname = 'X'.
*
*  e05_ls_layout-min_linesize = 125.
*  gs_print-no_print_listinfos = 'X'.
*
ENDFORM.                    " layout_build


*====> End of the Build for Layout Record
*====> This section builds the Actual Display Routine


FORM list_view.
*
  g_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program = g_repid
            is_layout          = g_layout
            it_sort            = g_sort[]
            it_events          = g_events[]
            it_fieldcat        = g_fieldcat[]
            i_save             = g_save
       TABLES
            t_outtab           = it_table
       EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.

  IF sy-subrc <> 0.
    MESSAGE e208(00) WITH 'Error: ALV Grid'.
  ENDIF.
*
ENDFORM.                    " layout_build


*====> End of Actual Display Routine
*====> This section builds the Top of Page Routine


FORM top_of_page.
*
  DATA: ls_line TYPE slis_listheader.
*
  CLEAR g_list_top_of_page[].
  CLEAR ls_line.
  ls_line-typ  = 'H'.
  CONCATENATE 'Table Structure -' tabname
    INTO ls_line-info SEPARATED BY space.
  APPEND ls_line TO g_list_top_of_page.
  PERFORM build_sub_headings
      USING g_list_top_of_page.
*
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
            it_list_commentary = g_list_top_of_page[].
*
ENDFORM.                    " top_of_page
*
FORM build_sub_headings
        USING e07_top_of_page TYPE slis_t_listheader.
  DATA: ls_line TYPE slis_listheader.
*
  CLEAR ls_line.
  ls_line-typ  = 'S'.
  ls_line-key = 'Run Info'.
  CONCATENATE  sy-sysid sy-uname sy-mandt
        INTO ls_line-info
        SEPARATED BY space.
  APPEND ls_line TO e07_top_of_page.
*
ENDFORM.                    "build_sub_headings


*====> End of top_of_page
*====> This section builds the User Command Routine


FORM user_command
        USING p_ucomm LIKE sy-ucomm
              p_selfield TYPE slis_selfield.
*
  IF p_selfield-value NE space.
    CASE p_selfield-tabname.
      WHEN 'IT_TABLE'.
        READ TABLE it_table INDEX p_selfield-tabindex
                  INTO tab_rec.
      WHEN OTHERS.
        EXIT.
    ENDCASE.
  ELSE.
    EXIT.
  ENDIF.
*
  CHECK sy-subrc = 0.
*
  CASE p_selfield-fieldname.
*    WHEN 'QUOTE'.
*      SET PARAMETER ID 'AGN' FIELD p_selfield-value.
*      CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.
*
    WHEN OTHERS.
      EXIT.
  ENDCASE.
*
ENDFORM.                    "user_command
*&--------------------------------------------------
*&      Form  build_sort_fields
*&--------------------------------------------------
FORM build_sort_fields
  USING p_sort TYPE slis_t_sortinfo_alv..
*----------------------> ALV Build Sort Table
  DATA:  ls_sort  LIKE LINE OF p_sort.
  REFRESH p_sort.
* Table name
  CLEAR ls_sort.
  ls_sort-tabname       = 'IT_TABLE'.
  ls_sort-fieldname     = 'TABNAME'.
  ls_sort-up            = 'X'.
  APPEND ls_sort TO p_sort.
* Position of the field in the table
  CLEAR ls_sort.
  ls_sort-tabname       = 'IT_TABLE'.
  ls_sort-fieldname     = 'POSITION'.
  ls_sort-up            = 'X'.
  APPEND ls_sort TO p_sort.
ENDFORM.          " build_sort_fields
*&--------------------------------------------------
*&      Form  fieldcat_init
*&--------------------------------------------------
FORM fieldcat_init
  USING e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.

  CLEAR: e01_lt_fieldcat[], e01_lt_fieldcat.
* Table name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'TABNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'TABNAME'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table'.
  ls_fieldcat-SELTEXT_M     = 'Table name'.
  ls_fieldcat-SELTEXT_L     =
    'Table name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Field name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'FIELDNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'FIELDNAME'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Field name'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Field name'.
  ls_fieldcat-SELTEXT_M     = 'Field name'.
  ls_fieldcat-SELTEXT_L     =
    'Field name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Activation status of a Repository object
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'AS4LOCAL'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'AS4LOCAL'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Activation status'.
  ls_fieldcat-SELTEXT_L     =
    'Activation status'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Version of the entry (not used)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'AS4VERS'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'AS4VERS'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Version'.
  ls_fieldcat-SELTEXT_L     =
    'Version'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Position of the field in the table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'POSITION'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'POSITION'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table pos.'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table pos.'.
  ls_fieldcat-SELTEXT_M     = 'Table position'.
  ls_fieldcat-SELTEXT_L     =
    'Table position'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Identifies a key field of a table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'KEYFLAG'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'KEYFLAG'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Key field'.
  ls_fieldcat-SELTEXT_L     =
    'Key field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Flag: Field is required (not blank)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'MANDATORY'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'MANDATORY'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Required field'.
  ls_fieldcat-SELTEXT_L     =
    'Required field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Data element (semantic domain)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'ROLLNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'ROLLNAME'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Data elem.'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Data elem.'.
  ls_fieldcat-SELTEXT_M     = 'Data element'.
  ls_fieldcat-SELTEXT_L     =
    'Data element'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Check table name of the foreign key
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'CHECKTABLE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'CHECKTABLE'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Check table'.
  ls_fieldcat-SELTEXT_L     =
    'Check table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Nesting depth for includes
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'ADMINFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'ADMINFIELD'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Admin. field'.
  ls_fieldcat-SELTEXT_L     =
    'Admin. field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* ABAP data type (C,D,N,...)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'INTTYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'INTTYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'ABAP type'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'ABAP type'.
  ls_fieldcat-SELTEXT_M     = 'ABAP type'.
  ls_fieldcat-SELTEXT_L     =
    'ABAP type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Internal length in bytes
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'INTLEN'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'INTLEN'.
  ls_fieldcat-REPTEXT_DDIC   =
    'IntLen'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'IntLen'.
  ls_fieldcat-SELTEXT_M     = 'Internal length'.
  ls_fieldcat-SELTEXT_L     =
    'Internal length'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Table for reference field
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'REFTABLE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'REFTABLE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Ref. table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Ref. table'.
  ls_fieldcat-SELTEXT_M     = 'Reference table'.
  ls_fieldcat-SELTEXT_L     =
    'Reference table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Name of included table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'PRECFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'PRECFIELD'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Name of include'.
  ls_fieldcat-SELTEXT_L     =
    'Name of include'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Reference field for currency and qty fields
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'REFFIELD'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'REFFIELD'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Ref. field'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Ref. field'.
  ls_fieldcat-SELTEXT_M     = 'Ref. field'.
  ls_fieldcat-SELTEXT_L     =
    'Ref. field'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Check or generating module for fields
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'CONROUT'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'CONROUT'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = ''.
  ls_fieldcat-SELTEXT_M     = 'Check module'.
  ls_fieldcat-SELTEXT_L     =
    'Check module'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Indicator that NOT NULL is forced for this field
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'NOTNULL'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'NOTNULL'.
  ls_fieldcat-REPTEXT_DDIC   =
    'NOT NULL'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'NOT NULL'.
  ls_fieldcat-SELTEXT_M     = 'NOT NULL forced'.
  ls_fieldcat-SELTEXT_L     =
    'NOT NULL forced'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Data type in ABAP Dictionary
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DATATYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DATATYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'DataType'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'DataType'.
  ls_fieldcat-SELTEXT_M     = 'Data type'.
  ls_fieldcat-SELTEXT_L     =
    'Data type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Length (no. of characters)
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'LENG'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'LENG'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Lngth'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Lngth'.
  ls_fieldcat-SELTEXT_M     = 'No. of characters'.
  ls_fieldcat-SELTEXT_L     =
    'No. of characters'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Number of decimal places
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DECIMALS'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DECIMALS'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Dec.places'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Dec.places'.
  ls_fieldcat-SELTEXT_M     = 'Decimal places'.
  ls_fieldcat-SELTEXT_L     =
    'Decimal places'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Domain name
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DOMNAME'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DOMNAME'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Domain'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Domain'.
  ls_fieldcat-SELTEXT_M     = 'Domain'.
  ls_fieldcat-SELTEXT_L     =
    'Domain name'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* Origin of an input help
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'SHLPORIGIN'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'SHLPORIGIN'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Origin of an input help'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'SH Origin'.
  ls_fieldcat-SELTEXT_M     = 'Origin of input help'.
  ls_fieldcat-SELTEXT_L     =
    'Origin of an input help'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Flag if it is a table
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'TABLETYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'TABLETYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Table'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Table'.
  ls_fieldcat-SELTEXT_M     = 'Table'.
  ls_fieldcat-SELTEXT_L     =
    'Table'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Depth for structured types
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'DEPTH'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'DEPTH'.
  ls_fieldcat-REPTEXT_DDIC   =
    'Depth'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'Depth'.
  ls_fieldcat-SELTEXT_M     = 'Depth'.
  ls_fieldcat-SELTEXT_L     =
    'Depth'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
* DD: Component type
  CLEAR ls_fieldcat.
  ls_fieldcat-tabname       = 'IT_TABLE'.
  ls_fieldcat-fieldname     = 'COMPTYPE'.
  ls_fieldcat-ref_tabname   = 'DD03L'.
  ls_fieldcat-ref_fieldname = 'COMPTYPE'.
  ls_fieldcat-REPTEXT_DDIC   =
    'CompTyp'.
  ls_fieldcat-ddictxt       = 'S'.
  ls_fieldcat-SELTEXT_S     = 'CompTyp'.
  ls_fieldcat-SELTEXT_M     = 'CompTyp'.
  ls_fieldcat-SELTEXT_L     =
    'Component type'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
ENDFORM.          " fieldcat_init

Edited by: Paul Chapman on Mar 10, 2008 3:09 PM

former_member583013
Active Contributor
0 Kudos
94

This blog might help you...

[Taking good care of Z tables|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3337] [original link is broken] [original link is broken] [original link is broken];

Greetings,

Blag.