‎2008 Nov 03 3:47 PM
Hi there. How can I assign an itab to pointer to have possibility to make operations on pointer (not itab)?
[ I ]
DATA: itab LIKE dbtab OCCURS 0 .
field-symbols: <ritab> type any table .
field-symbols: <rline> type any .
ASSIGN itab TO <ritab> .
it's ok but now ... when I want to ...
READ TABLE <ritab> INTO <rline> INDEX G_arow .
... I receive You cannot use explicit or implicit index operations on tables with
types "HASHED TABLE" or "ANY TABLE". "<RITAB>" has the type "ANY TABLE".
[ II ]
DATA: itab LIKE dbtab OCCURS 0 .
field-symbols: <pointer> type standard table .
field-symbols: <rline> type any .
ASSIGN (itab) TO <pointer> .
the ASSIGN statement returns sy-subrc = 4
‎2008 Nov 03 4:08 PM
Hi,
change your declaration of
field-symbols: <pointer> type any table .to
field-symbols: <pointer> type standard table .Darren
‎2008 Nov 03 3:50 PM
‎2008 Nov 03 3:51 PM
Did you try
READ TABLE <ritab> ASSIGNING <rline> INDEX G_arow .-Aman
‎2008 Nov 03 3:53 PM
Also remove the brackets from the itab ...
ASSIGN (itab) TO <pointer> .
isntead to ASSIGN itab TO <pointer> .
regards,
Advait
‎2008 Nov 03 3:52 PM
there's a mistake in my post but I can't edit it now...
Explanation: <ritab> = <pointer>
<<First post edited by your friendly neighbourhood moderator>>
‎2008 Nov 03 4:08 PM
Hi,
change your declaration of
field-symbols: <pointer> type any table .to
field-symbols: <pointer> type standard table .Darren
‎2008 Nov 03 4:12 PM
INDEX TABLE would be better.
Explanation. something defined with reference to ANY TABLE could be a HASHED table, and that doesn't support indexed operations. SORTED tables and STANDARD tables do. They are referred to generically as INDEX.
matt
‎2008 Nov 03 4:22 PM
A)
DATA: itab LIKE zlhist02 OCCURS 0 WITH HEADER LINE .
field-symbols: <pointer> type table .
" OR
field-symbols: <pointer> type standard table .
" OR
field-symbols: <pointer> type any table .
field-symbols: <line> type any .
ASSIGN itab TO <pointer> . " ERROR
READ TABLE <pointer> ASSIGNING <line> INDEX 1 .
"itab" is not type-compatible with field symbol "<POINTER>".
‎2008 Nov 03 4:25 PM
If you hadn't defined ITAB as a table with a header-line, you wouldn't have had the problem.
ASSIGN itab[] TO <pointer> .Tables with header lines are inherently ambigous - as you've found. Is itab the table or the header-line? In this case, it was the header. Don't use them - they're not allowed in an Object Oriented context anyway. Instead define seperate work areas.
matt
‎2008 Nov 03 4:26 PM
Defin your table with the types as you have defined your field symbols POINTER with types.
DATA: itab Type standarad table of zlhist02.
Regards,
Naimesh Patel
‎2008 Nov 03 4:29 PM
Naimesh Patel
The problem is that original itab declaration is more complex ...
DATA: BEGIN OFitab OCCURS 0 ...
... field1 ...
... field2 ...
... field3 ...
... ...... ...
... END OF itab .
and I can't change it
‎2008 Nov 03 4:31 PM
>
> The problem is that original itab declaration is more complex ...
> and I can't change it
OK - in that case change the code as I suggested.
matt