cancel
Showing results for 
Search instead for 
Did you mean: 

internal table

Former Member
0 Kudos

hai.how to increase the fields of internal tabl edynamically?plz help me on this.

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member480923
Active Contributor
0 Kudos

Hi

Create the fieldcatalog thru the FM

 CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = in_tabname
       CHANGING
            ct_fieldcat      = it_fcat
       EXCEPTIONS
            OTHERS           = 1.

then append the number of dynamic fields you want to into the Fieldcatalog and then call on the following class

CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_fcat
    IMPORTING
      ep_table        = it_content.
  IF sy-subrc = 0.
    ASSIGN it_content->* TO <itab>.
  ELSE.
    WRITE: 'Error creating internal table'.
    STOP.
  ENDIF.

This will return you a table whose fields will increase decrease dynamically.

Hope that Helps

Anirban M.

former_member480923
Active Contributor
0 Kudos

Hi

Create the fieldcatalog thru the FM

 CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = in_tabname
       CHANGING
            ct_fieldcat      = it_fcat
       EXCEPTIONS
            OTHERS           = 1.

then append the number of dynamic fields you want to into the Fieldcatalog and then call on the following class

CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_fcat
    IMPORTING
      ep_table        = it_content.
  IF sy-subrc = 0.
    ASSIGN it_content->* TO <itab>.
  ELSE.
    WRITE: 'Error creating internal table'.
    STOP.
  ENDIF.

This will return you a table whose fields will increase decrease dynamically.

Hope that Helps

Anirban M.

former_member480923
Active Contributor
0 Kudos

Hi

Create the fieldcatalog thru the FM

 CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = in_tabname
       CHANGING
            ct_fieldcat      = it_fcat
       EXCEPTIONS
            OTHERS           = 1.

then append the number of dynamic fields you want to into the Fieldcatalog and then call on the following class

CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_fcat
    IMPORTING
      ep_table        = it_content.
  IF sy-subrc = 0.
    ASSIGN it_content->* TO <itab>.
  ELSE.
    WRITE: 'Error creating internal table'.
    STOP.
  ENDIF.

This will return you a table whose fields will increase decrease dynamically.

Hope that Helps

Anirban M.

Former Member
0 Kudos

Hi Mrudula,

Check this code.

DATA: BEGIN OF str_itab OCCURS 0,

var1 TYPE i,

var2 TYPE i,

END OF str_itab.

CREATE DATA itab TYPE STANDARD TABLE OF itab.

By using 'create data' statement you can create internal table dynamically.

regards,

Rajesh.

Message was edited by:

RK

Former Member
0 Kudos

Hi Mrudula,

In order to increase the size of the internal table , i.e. fields dynamically , you need to include or append structures to the respective internal table.

Hope this resolves your query.

Reward all the helpful answers.

Regards