04-07-2017 10:29 AM
Hi there,
i need some helb in calling the function module REUSE_ALV_GRID_DISPLAY. Calling the following code will end in an dump with runtime error 'MOVE_TO_LIT_NOTALLOWED_NODATA'.
The detailed error says ' Field "T_OUTTAB[]" was to assigned a new value but this field is at least partly protected against changes'.
Has someone an idea why the error is coming up?
Here ist my code.
Part of the public class definition
methods SET_ALV_INHALT
importing
!resulttab type ANY .
Method where the error occurs.
METHOD alv_view.
FIELD-SYMBOLS: <tab> TYPE STANDARD TABLE. "table.
ASSIGN me->alv_tab->* TO <tab>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <tab>[]
EXCEPTIONs
program_error = 1
OTHERS = 2.
ENDMETHOD.
method SET_ALV_content.
GET REFERENCE OF resulttab INTO me->alv_tab.
endmethod.
I call my object like this
CREATE OBJECT alv TYPE zcl_fi_alv_tool.
alv->set_alv_content( resulttab = itab_error ).
alv->alv_view( ).
Her is the dump
Short Text
Assignment error: Overwriting of a protected field.
What happened?
Error in the ABAP application program.
The current ABAP program "SAPLSLVC_FULLSCREEN" had to be terminated because it
found a
statement that could not be executed.
Error analysis
An exception has occurred which is explained in more detail below. The
exception is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE' and was not
caught in procedure
"PBO" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated this
exception, the current program was terminated.
The reason for the exception is:
Field "T_OUTTAB[]" was to assigned a new value but this field is at least
partly
protected against changes.
Missing RAISING clause in interface
Program SAPLSLVC_FULLSCREEN
Include LSLVC_FULLSCREENF01
Row 358
Module Type (FORM)
Module Name PBO
Trigger Location of Exception
Program SAPLSLVC_FULLSCREEN
Include LSLVC_FULLSCREENF01
Row 632
Module Type (FORM)
Module Name PBO
Source Code Extract
Line SourceCde
602 with key name = slis_ev_reprep_sel_modify.
603 if sy-subrc eq 0.
604 ls_reprep_id-cb_repid = ls_reprep_id-s_rprp_id-onam.
605 ls_reprep_id-cb_frm_mod = ls_event-form.
606 endif.
607 *<<< INSERT BRAUNMI RepRep
608 else.
609 ls_reprep_id = is_reprep_id_lvc.
610 endif.
611 call method gt_grid-grid->activate_reprep_interface
612 exporting
613 is_reprep = ls_reprep_id
614 exceptions
615 no_sender = 1.
616
617 *>>> new API
618 perform salv_set_selmode changing gt_grid-s_lvc_layout.
619 *<<< new API
620
621 *>>>Mendocino Extraction
622 * TOP-OF-LIST and END-OF-LIST must processed at first because of
623 * set screen 0. leave screen. in method set_table_for_first_display
624 data: l_mode(1).
625 import l_mode to l_mode from memory id 'ALV_EXTRACT_MODE'.
626 if l_mode eq 'M'.
627 perform raise_top_of_list.
628 perform raise_end_of_list.
629 endif.
630 *<<<Mendocino Extraction
631
>>>>> call method gt_grid-grid->set_table_for_first_display
633 exporting
634 i_consistency_check = i_interface_check
635 i_bypassing_buffer = i_bypassing_buffer
636 i_buffer_active = i_buffer_active
637 i_structure_name = i_structure_name
638 is_variant = ls_variant
639 i_save = i_save
640 i_default = i_default
641 is_layout = gt_grid-s_lvc_layout
642 is_print = gt_grid-s_lvc_print
643 it_special_groups = gt_grid-t_lvc_spec
644 it_hyperlink = gt_grid-t_lvc_hyperlink
645 it_toolbar_excluding = gt_grid-t_excluding_lvc
646 it_except_qinfo = gt_grid-t_lvc_qinfo
647 ir_salv_adapter = gt_grid-r_salv_fullscreen_adapter
648 it_alv_graphics = gt_grid-t_alv_graphics
649 changing
650 it_fieldcatalog = gt_grid-t_lvc_fieldcat
651 it_sort = gt_grid-t_lvc_sort
Active Calls/Events
No. Ty. Program Include Line
Name
6 FORM SAPLSLVC_FULLSCREEN LSLVC_FULLSCREENF01 632
PBO
5 MODULE (PBO) SAPLSLVC_FULLSCREEN LSLVC_FULLSCREENO01 12
PBO
4 FUNCTION SAPLSLVC_FULLSCREEN LSLVC_FULLSCREENU01 187
REUSE_ALV_GRID_DISPLAY
3 METHOD ZCL_FI_ALV_TOOL===============CP ZCL_FI_ALV_TOOL===============CM001 6
ZCL_FI_ALV_TOOL=>ALV_VIEW
2 FORM ZFI_TEST ZFI_TEST 709
BELEG_BUCHEN
1 EVENT ZFI_TEST ZFI_TEST 216
START-OF-SELECTION
04-07-2017 12:47 PM
Probably the reason is that the internal table is passed via an importing parameter in custom method instead of a changing one.
04-07-2017 12:21 PM
The immediate cause is that me->alv_tab is protected against changes. How have you defined it? How does its values get set?
(And why are you using the function module instead of the cl_salv_table? )
04-07-2017 12:47 PM
Probably the reason is that the internal table is passed via an importing parameter in custom method instead of a changing one.
04-07-2017 1:14 PM
Thats it. Switching the importparameter to 'changing' everything works.
Thanks a lot.