‎2009 Jul 07 6:38 PM
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
‎2009 Jul 07 6:44 PM
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.
‎2009 Jul 07 6:42 PM
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.
‎2009 Jul 07 6:44 PM
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.
‎2009 Jul 07 6:47 PM
>
> 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
‎2009 Jul 07 7:05 PM
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