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

Internal Table declaration - clarification

Former Member
0 Likes
744

Hello all,

I need some help in declaring internal table.

I have declared my internal table as


data : itab_wa type ZRESULT_LINE,
       itab type ZRESUULT_ROW.

Where ZRESULT_LINE is a structure with FIELD1, FIELD2 and FIELD3. Now I want to add

TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,

in my internal table declaration so that it has the declaration similar to


DATA: BEGIN OF itab OCCURS 0,
      FIELD1,
      FIELD2,
      FIELD3,
  <b>    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,</b> 
      END OF itab.

How can I do this please help. I have to use the structure ZRESULT_LINE in my internal table. Waiting....

7 REPLIES 7
Read only

Former Member
0 Likes
672

Hi,

DATA: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE ZRESULT_LINE.

DATA: TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,

END OF itab.

Thanks,

Naren

Read only

0 Likes
672

HI Narendran,

In my code I already used <b>itab_wa</b> (work area) and <b>itab</b> (body) so I dont want to change my code as I have many lines of code. Can you change your sample declaration so that it has <b>itab_wa</b> (work area) and <b>itab</b> (body).

Waiting............

Read only

0 Likes
672

then use the below code..

data: begin of itab_wa.

include structure zresult_line.

data: tcolor type slis_t_specialcol_alv,

end of itab_wa.

data itab like table of itab_wa.

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
672

Try like this.

DATA: BEGIN OF itab OCCURS 0,

FIELD1,

FIELD2,

FIELD3,

DATA: TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,

END OF itab.

Thanks,

Read only

abdul_hakim
Active Contributor
0 Likes
672

hi

if ZRESULT_LINE is a structure then your internal table declaration is wrong.

it should be like

<b>data itab like table of zresult_line</b>.

if you wanna add additional field then you could add the same to your structure ZRESULT_LINE by going into SE11 if the structure created thru ABAP Dictionary.

Also you can use the below syntax.

data: begin of itab occurs 0.

include structure zresult_line.

data: tcolor type slis_t_specialcol_alv,

end of itab.

Also note that internal table with header lines are oldest forms of internal table and it wont be supported in OO Context..

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
672

Hi,

if you have already declared the itab_wa and if you want to use the work area in the internal table.

DATA: ITAB LIKE ITAB_WA OCCURS 0 WITH HEADER LINE.

Hope this works..

Thanks,

Naren

Read only

uwe_schieferstein
Active Contributor
0 Likes
672

Hello Raju

That's how I would define the structure (of course never using header lines which are only a soure of errors):

TYPES: begin of ty_s_line.
  INCLUDE TYPE zresult_line.
  INCLUDE TYPE slis_t_specialcol_alv AS tcolor.
TYPES: end of ty_s_line.
TYPES: ty_t_itab   TYPE STANDARD TABLE of ty_s_line
                   WITH STANDARD KEY.
DATA:
  gt_itab   TYPE ty_t_itab,
  gs_line   TYPE ty_s_line.

Regards

Uwe