Получение инстанции cl_gui_alv_grid для SALV
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
CLASS lcl_access_salv DEFINITION INHERITING FROM cl_salv_model_list FINAL. PUBLIC SECTION. CLASS-METHODS: get_cl_gui_alv_grid IMPORTING io_salv TYPE REF TO cl_salv_model_list RETURNING VALUE(ro_grid) TYPE REF TO cl_gui_alv_grid. ENDCLASS. CLASS lcl_access_salv IMPLEMENTATION. METHOD get_cl_gui_alv_grid. DATA:lo_salv TYPE REF TO cl_salv_table. *--------------------------------------------------------------------* * Must be bound *--------------------------------------------------------------------* IF io_salv IS NOT BOUND. RETURN. ENDIF. *--------------------------------------------------------------------* * Adapter must be bound *--------------------------------------------------------------------* IF io_salv->r_controller IS NOT BOUND OR io_salv->r_controller->r_adapter IS NOT BOUND. MESSAGE 'Minor programming fault: Call GET_GRID_FROM_SALV after SALV->DISPLAY( )!'(001) TYPE 'S' DISPLAY LIKE 'W'. lo_salv ?= io_salv. " Calling method has cl_salv_table typed in interface lo_salv->display( ). ENDIF. IF io_salv->r_controller IS NOT BOUND OR io_salv->r_controller->r_adapter IS NOT BOUND. RETURN. " Still not bound --> can't do anything ENDIF. *--------------------------------------------------------------------* * If method not present or wrong return type exception will handle this and we return unbound grid *--------------------------------------------------------------------* TRY. " Works for CL_SALV_FULLSCREEN_ADAPTER as well as for CL_SALV_GRID_ADAPTER CALL METHOD io_salv->r_controller->r_adapter->('GET_GRID') RECEIVING value = ro_grid. CATCH cx_root ##CATCH_ALL. " don't dump RETURN. ENDTRY. ENDMETHOD. ENDCLASS. |
Для полноэкранной версии:
1 2 3 |
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = go_grid. |