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: 

How to change the structure of itab in Debugging mode?

naveen_inuganti2
Active Contributor
0 Kudos

Hi,

Can I change the structure of my internal table in runtime?

Say,

I am having my internal table like this:

types: begin of ty_tab,

f1, f2, f3, f4, f5, f6,

end of ty_tab.

data: itab type standard table of ty_tab with header line.

Now I want to change it in runtime(Debugging mode) where it contains f1 and f2 fileds only not the other four fields.

FYI: regarding some memory allocation issues i want to change it like that as I am not having access to change the code in that server.

--Naveen Inuganti

1 ACCEPTED SOLUTION

0 Kudos

Hi,

Its not possible to change the structure in debug mode, but at program run time there are ways of creating new structures and moving data from your existing internal table to an internal table of this structure.

Regards,

Sesh

10 REPLIES 10

0 Kudos

Hi,

Its not possible to change the structure in debug mode, but at program run time there are ways of creating new structures and moving data from your existing internal table to an internal table of this structure.

Regards,

Sesh

0 Kudos

>but at program run time there are ways of creating new structures and moving data from your existing >internal table to an internal table of this structure.

How can I do it?

0 Kudos

Check [Rich's|] reply.

0 Kudos

Hi,

You can create dynamic types and data for those types are run time.

lets assume that you have structure of some type and you have work area of that type.

DATA: lv_data type SPFLI.
DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
DATA: lt_comp       TYPE cl_abap_structdescr=>component_table.
DATA: ls_comp       LIKE LINE OF lt_comp.
DATA: lr_data       TYPE REF TO data.
FIELD-SYMBOLS: <fs_data> TYPE ANY.

    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( lv_data ).
    lt_comp = lr_rtti_struc->get_components( ).

"Now  lets remove two fileds from the table as follows.
LOOP AT lt_comp into ls_comp.
DELETE lt_comp INDEX sy-tabix.
IF sy-tabix = 2.
EXIT. " Delete two components of the structure now lt_comp as two components less from SPFLI
ENDIF.
ENDLOOP.

    CALL METHOD cl_abap_structdescr=>create
      EXPORTING
        p_components = lt_comp
        p_strict     = abap_false
      RECEIVING
        p_result     = lr_rtti_struc.

CREATE DATA lr_data TYPE HANDLE lr_rtti_struc. "Now you have data of the new type
    ASSIGN lr_data->* TO <fs_data>.

    CREATE DATA lr_table LIKE STANDARD TABLE OF <fs_data>.
    ASSIGN lr_table->* TO <fs_table>.

Regards,

Sesh

former_member181995
Active Contributor
0 Kudos

I guess there is no chance to delete the structure fields while runtime(I'm open for others suggestions as well).

We can only delete Lines with data but debugging will not allow us to temper the structure while run time.

Former Member
0 Kudos

Hi,

No you cannot exclude any COLUMN from Internal table in debug,you can change the order of columns in debug but not exclude them.

you can do such manipulation with rows add,remove,change...

Regards,

Neha

0 Kudos

Neha,

> you can change the order of columns in debug but not exclude them.

How can I do it?

--Naveen Inuganti.

0 Kudos

hi,

In debug(NEW abap debugger) go to the internal table,there on right hand side is an icon for "Services of the tool",the bottom most icon-> double click on that->Column Configuration --->Edit Order of Columns ===> here you can change there order.

regards,

neha

0 Kudos

Even Simple Just Drag And drop the column at desired place.

0 Kudos

Hi,

yes true,but following the menu path he can explore aother options too.

regards,

neha