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: 

cl_gui_alv_grid, export MT_OUTTAB ??

Former Member
0 Kudos
4,060

Hello,

Is there any way to gain access to the protected attribute MT_OUTTAB in class cl_gui_alv_grid?

Using function 'GET_GLOBALS_FROM_SLVC_FULLSCR', I am able to retrieve the class of type cl_gui_alv_grid, but because the attribute is protected, I can't access it.

The reason I need this, is because I can't rely solely on the changed data alone. The data I'm displaying in the ALV grid has default values that can be optionally overwritten by the user, but it isn't necessary. So after input validation (using method cl_gui_alv_grid->check_changed_data) I still need to retrieve the complete table, and not just the changes.

I've looked around, and see this question popping up from time to time, but it's never answered completely.

7 REPLIES 7

david_carballido
Active Participant
0 Kudos
2,099

Hi Dave, try use CL_ISSR_BASI_ALV_GRID class, its superclass is CL_GUI_ALV_GRID and also has GET_DATA and SET_DATA method.

Its construction is similar to CL_GUI_ALV_GRID, I hope this help you

Regards

David Carballido

Former Member
0 Kudos
2,099

Hi,

  Is there any reason why want to access the MT_OUTTAB from CL_GUI_ALV_GRID, as the internal table values will be available in your program...can you not get the internal table records stored inside your program which you used it for ALV?

  Please correct me if I am wrong in my understanding.

Thanks

Naren

Former Member
0 Kudos
2,099

Hi Dave,

If you see the method set_table_for_first_display

SAP Exports the table to memory ID you can try accessing it from there.

Also there is a way to gain access to the ITAB of any alv executed there is a very nice blog have a look.

http://scn.sap.com/community/abap/blog/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-rep...

I hope it solves your problem

Cheers

adeloera
Explorer
0 Kudos
2,099

Hello Dave,

MT_OUTTAB is pointing to your internal table in your z program if you make changes after the calling of the grid method set_table_for_first_display You will be able to see those changes in the internal table.

I hope It helps

former_member826996
Discoverer
0 Kudos
2,099
DATA: l_o_grid TYPE REF TO cl_gui_alv_grid.
DATA: l_o_facade_grid TYPE REF TO cl_salv_gui_grid_facade.
DATA: l_t_detail_report TYPE zfoca_t_alv_mrr_detail.

DATA: l_s_itab TYPE zfoca_s_alv_mrr_detail.


CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_o_grid.
CREATE OBJECT l_o_facade_grid
EXPORTING
o_grid = l_o_grid.

DATA l_t_data TYPE REF TO data.
FIELD-SYMBOLS: <l_t_data> TYPE zfoca_t_alv_mrr_detail.
CREATE DATA l_t_data TYPE zfoca_t_alv_mrr_detail.
l_t_data = l_o_facade_grid->if_salv_gui_grid_data_source~get_r_appl_data( ).
ASSIGN l_t_data->* TO <l_t_data>.
IF <l_t_data> IS ASSIGNED.
l_t_detail_report[] = <l_t_data>.

ENDIF.

0 Kudos
1,714

ty

thomas_mller13
Participant
0 Kudos
1,665

You do not need the access. 

1. Delegate all ALV events(e.g. enter) to the PAI of your program. That can be done by CL_GUI_CFW=>SET_NEW_OK_CODE(<your_ok_code>).

2. In PAI, the first call you do is : go_alv->check_data_changed( ).

After this call the data in mt_outtab have been transferred to your own data table that has been given to the ALV via .set_table_for_first_display.