Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Get column list (Name and Attribute) from internal table with class CL_ABAP_STRUCTDESCR

$
0
0

  data: begin of lt_tab occurs 0,

        bukrs type bukrs,

        text  type c,

        amt   type p,

        end of lt_tab.

 

  type-pools abap.

  data gt_comp type abap_component_tab with header line.

 

  perform get_column tables lt_tab

                   changing gt_comp[].

 

  loop at gt_comp where type->type_kind = 'P'.

    write:/ gt_comp-name.

  endloop.


*&---------------------------------------------------------------------*

*&      Form  get_column

*&---------------------------------------------------------------------*

form get_column tables pt_tab

              changing pt_comp.

  data: lr_data type ref to data,

        lr_desc type ref to cl_abap_structdescr.

 

  create data lr_data like line of pt_tab.

  lr_desc ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).

  pt_comp  = lr_desc->get_components( ).

endform.                    " get_column


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>