Application Development and Automation 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: 
Read only

Need information on Dynamic internal table

Former Member
0 Likes
829

Hi All,

I need some information on dynamic internal table.

I want what are the field names and the values in dynamic internal table.

Is there any function module, which tells us the field names and values of corresponding fields from a dynamic internal table ?

Thank you very much in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
786

Hi ,

Go through the fallowing link

I think it will solve your problem

Regards,

Vijay.

Hi All,

I need some information on dynamic internal table.

I want what are the field names and the values in dynamic internal table.

Is there any function module, which tells us the field names and values of corresponding fields from a dynamic internal table ?

Thank you very much in advance.

5 REPLIES 5
Read only

Former Member
0 Likes
787

Hi ,

Go through the fallowing link

I think it will solve your problem

Regards,

Vijay.

Read only

Former Member
0 Likes
786

Hi,

Program to display/edit database tables dynamically.

REPORT  zdyn_table_display.
PARAMETERS: p_table TYPE tabname OBLIGATORY,
            p_rows  TYPE I.

* Creation of dynamic internal table
DATA: lv_dref             TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: lv_table  TYPE  string.
START-OF-SELECTION.
* Dynamic internal table.
  CREATE DATA lv_dref       TYPE TABLE OF (p_table).
  ASSIGN lv_dref->* TO <fs_table>.
  IF sy-subrc  EQ 0.
*    EXIT.
  ENDIF.
data i type i.
* Get the data
  SELECT  *
        FROM (p_table)
        UP TO p_rows ROWS
        INTO TABLE <fs_table>.
  CONCATENATE 'Table contents : ' p_table INTO lv_table.
* display the table control.
  CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
    EXPORTING
      header            = lv_table
      tabname           = p_table
      no_button         = space
    TABLES
      table             = <fs_table>
    EXCEPTIONS
      no_more_tables    = 1
      too_many_fields   = 2
      nametab_not_valid = 3
      handle_not_valid  = 4
      OTHERS            = 5.
  IF sy-subrc  EQ 0.
    EXIT.
  ENDIF.

Getting internal table definition

Try this...

DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.

l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

Now l_descr_ref->components holds the entire list of fields in itab.

Thanks & Regards,

ShreeMohan

Read only

Former Member
0 Likes
786

Hi,

Program to display/edit database tables dynamically.

REPORT  zdyn_table_display.
PARAMETERS: p_table TYPE tabname OBLIGATORY,
            p_rows  TYPE I.

* Creation of dynamic internal table
DATA: lv_dref             TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: lv_table  TYPE  string.
START-OF-SELECTION.
* Dynamic internal table.
  CREATE DATA lv_dref       TYPE TABLE OF (p_table).
  ASSIGN lv_dref->* TO <fs_table>.
  IF sy-subrc  EQ 0.
*    EXIT.
  ENDIF.
data i type i.
* Get the data
  SELECT  *
        FROM (p_table)
        UP TO p_rows ROWS
        INTO TABLE <fs_table>.
  CONCATENATE 'Table contents : ' p_table INTO lv_table.
* display the table control.
  CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
    EXPORTING
      header            = lv_table
      tabname           = p_table
      no_button         = space
    TABLES
      table             = <fs_table>
    EXCEPTIONS
      no_more_tables    = 1
      too_many_fields   = 2
      nametab_not_valid = 3
      handle_not_valid  = 4
      OTHERS            = 5.
  IF sy-subrc  EQ 0.
    EXIT.
  ENDIF.

Getting internal table definition

Try this...

DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.

l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

Now l_descr_ref->components holds the entire list of fields in itab.

Thanks & Regards,

ShreeMohan

Read only

Former Member
0 Likes
786

Hi,

also refer following link,

http://wiki.sdn.sap.com/wiki/display/Snippets/dynamicinternaltableallfields

Thanks & regards,

ShreemOhan