02-21-2014 9:05 PM
FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE ,
<l_field> TYPE ANY.
READ TABLE gt_itab ASSIGNING <l_field>. "with table key pernr = <l_table>-pernr.
LOOP at gt_itab.
check <l_field> is assigned.
ASSIGN <l_field> TO <l_table>. -------- I get runtime this line
ENDLOOP.
Note: My gt_itab (interna table) and <l_field> are loaded.
02-21-2014 9:25 PM
Hello,
Instead of FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE ,
Make it FIELD-SYMBOLS: <l_table> TYPE Any .
Thanks & Regards,
Abhijit
02-21-2014 10:22 PM
Hello Burak,
It is very clear from the runtime error that there is type conflict.
Change the declaration of <l_table> as below.
FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE ,
Regards,
Thanga
02-21-2014 10:35 PM
02-21-2014 10:31 PM
Hi, A type conflict would happen when structures of <l_field> and <l_itab> do not match in the run time.
For ASSIGN <l_field> TO <l_table> this statement to execute successfully, <l_field> must be of table type, however, it seems that it is of a structure type rather than a table type.
Kindly check and make changes accordingly.
I hope this will fix your issue.
Thanks
Mohit
02-22-2014 4:24 AM
Hello Burak,
Sorry typo error. Declare like below.
FIELD-SYMBOLS: <l_table> TYPE any.
Regards,
Thanga
02-22-2014 5:58 AM
1. FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE.
2. <l_field> TYPE ANY.
3. READ TABLE gt_itab ASSIGNING <l_field>. "with table key pernr = <l_table>-pernr.
4. LOOP at gt_itab.
5. check <l_field> is assigned.
6. ASSIGN <l_field> TO <l_table>. -------- I get runtime this line
7. ENDLOOP.
Once step 3 is complete, <l_field> is either assigned or not assigned. It's status will not now change. The means the check at step 5 is unnecessarily within the loop. This would be better.
1. FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE.
2. <l_field> TYPE ANY.
3. READ TABLE gt_itab ASSIGNING <l_field>. "with table key pernr = <l_table>-pernr.
4. IF <l_field> IS ASSIGNED.
5. LOOP at gt_itab.
6. ASSIGN <l_field> TO <l_table>. -------- I get runtime this line
7. ENDLOOP.
8. ENDIF.
Given the typing of <l_table> and <l_field>, line 6 makes zero sense. You can't assign a component of a line of table to a table field symbol. I think you don't understand ASSIGN.
Without knowing what you intend your program to do - and what you've supplied looks incomplete, I cannot help you further. I suggest that you read the abap help on ASSIGN, and look for examples of how to use it with internal tables.
02-26-2014 6:22 AM
Burak YILDIZ wrote:
ASSIGN <l_field> TO <l_table>. -------- I get runtime this line
Thats not the way to use the ASSIGN statement. I am not sure what do u exactly want to do here.
You cannot assign a structure field symbol to a table field symbol.
READ TABLE into reads one record so the loop is not used properly. If u want to read all the records from it_tab with the key pernr and insert it into <l_table> you could use :
FIELD-SYMBOLS: <l_table> TYPE STANDARD TABLE ,
<l_field> TYPE ANY.
LOOP at gt_itab ASSIGNING <l_field>. "with table key pernr = <l_table>-pernr.
APPEND <l_field> TO <l_table>.
ENDLOOP.
it will load all the fields from gt_itab to <l_table> having the key u specified.
12-26-2015 10:38 AM
Hello All,
Im getting an error for the same but didn't declare <i_table> bcz Im generating ALV report for the DDIC tables.
FIELD-SYMBOLS: type STANDARD TABLE.
ASSIGN FS_TAB->* TO .
Thanks,
Vivek