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

Error: itab is a table without a header....

Former Member
27,876

Hi everybody,

i get the following error after activation:

"ITAB" is a table without a header line and therefore has no component called "NUM"..

How can i solve this problem?


  TYPES: BEGIN OF i_itab,
           NUM TYPE I,
         END OF i_itab.
         
  DATA: itab TYPE TABLE OF i_tab.
 
  LOOP AT myTable INTO ls_mytable.

    itab-num = ls_mytable-nr.
    APPEND itab.

  ENDLOOP.

regards,

Sid

Edited by: Sid on Jul 7, 2009 7:39 PM

1 ACCEPTED SOLUTION
Read only

Former Member
10,233

Hi,

TYPES: BEGIN OF i_itab,
           NUM TYPE I,
         END OF i_itab.
         
  DATA: itab TYPE TABLE OF i_tab-.
  DATA: WA LIKE LINE OF itab.      "--> Add this 
 
  LOOP AT myTable INTO ls_mytable.
 
    wa-num = ls_mytable-nr.
    APPEND wa to  itab.       "--> Add this 
    CLEAR wa.                      "--> Add this 
 
  ENDLOOP.

4 REPLIES 4
Read only

Former Member
0 Likes
10,233

yas

here itab is just an standard internal table

if you want to access its content like compair its value u must externally add a work area to it

itab LIKE <itab type> WITH HEADER LINE.

Read only

Former Member
10,234

Hi,

TYPES: BEGIN OF i_itab,
           NUM TYPE I,
         END OF i_itab.
         
  DATA: itab TYPE TABLE OF i_tab-.
  DATA: WA LIKE LINE OF itab.      "--> Add this 
 
  LOOP AT myTable INTO ls_mytable.
 
    wa-num = ls_mytable-nr.
    APPEND wa to  itab.       "--> Add this 
    CLEAR wa.                      "--> Add this 
 
  ENDLOOP.

Read only

former_member189420
Active Participant
0 Likes
10,233

>

> Hi everybody,

>

> i get the following error after activation:

>

> "ITAB" is a table without a header line and therefore has no component called "NUM"..

>

> How can i solve this problem?

>

>


>   TYPES: BEGIN OF i_itab,
>            NUM TYPE I,
>          END OF i_itab.
>          
>   DATA: itab TYPE TABLE OF i_tab.
>  
>   LOOP AT myTable INTO ls_mytable.
> 
>     itab-num = ls_mytable-nr.
>     APPEND itab.
> 
>   ENDLOOP.
> 

Have a work area for the internal table itab. Code modified below :

TYPES: BEGIN OF i_itab,

NUM TYPE I,

END OF i_itab.

DATA: itab TYPE TABLE OF i_tab,

wa TYPE i_tab.

LOOP AT myTable INTO ls_mytable.

wa-num = ls_mytable-nr.

APPEND wa to itab.

ENDLOOP.

Hope this helps.

Regards,

Anand Patil

Read only

Former Member
0 Likes
10,233

Hi Sid,

There is a simple solution to your problem.

Have a look.


TYPES: BEGIN OF i_itab,
           NUM TYPE I,
         END OF i_itab.
         
  DATA: itab TYPE TABLE OF i_tab with header line. "Just add the addition 'with header line' 
 
  LOOP AT myTable INTO ls_mytable.
 
    itab-num = ls_mytable-nr.
    APPEND itab.
 
  ENDLOOP.

Hope this helps.

Regards,

Abhinab Mishra