Hola Alexis97,
Creo que tu problema esta en la secuencia…
Aqui te adjunto una secuencia de codigo para tener dos ALV, en donde desde la ALV1 segn lo que
hagas te lleva a la ALV2 y muestra los datos…Ahora si lo que quieres es que al volver desde el ALV2 al ALV1 este este posicionado en la o las filas marcadas debe utilizar los metodos
—> guarda la o las filas seleccionadas
o_grid_cc_main->get_selected_rows( IMPORTING et_row_no = lt_row_no ).
—> selecciona y se posiciona en la o las filas guardadas antes de ir al ALV2
o_grid_cc_main->set_selected_rows( it_row_no = lt_row_no[] ).
PERFORM show_alv_deta USING gs_alv_main.
-------------------------------------------------------------------------------
*---->>> Aqui la secuencia…Espero te sea util.
*---->> DYNPRO PRINCIPAL : LOGICA DE PROCESOS
PROCESS BEFORE OUTPUT.
MODULE status_3000.
MODULE init_container_pbo_3000.
*
PROCESS AFTER INPUT.
MODULE exit_3000 AT EXIT-COMMAND.
MODULE user_command_3000.
-----------------------------------------------------------------------------------------------------------------
- MODULE PBO : INIT_CONTAINER_PBO_3000 OUTPUT
-----------------------------------------------------------------------------------------------------------------
MODULE init_container_pbo_3000 OUTPUT.
- PERFORM init_container_main.
-
ENDMODULE. "
-------------------------------------------------------------------------------------------------------------------
- FORM : INIT_CONTAINER_MAIN
-------------------------------------------------------------------------------------------------------------------
FORM init_container_main.
-
*------- LLENAR TABLA INTERNA DEL ALV PRINCIPAL
*
*
IF ( cc_main IS INITIAL ).
*
*
CREATE OBJECT cc_main
EXPORTING
container_name = cc_main_name.
*
CREATE OBJECT o_grid_cc_main
EXPORTING
i_parent = cc_main.
*
-
LAMADA DE LOS EVENTOS DESARROLLADO EN LA CLASE : LCL_EVENT_RECEIVER
CREATE OBJECT o_events_main.
SET HANDLER o_events_main->on_user_command FOR o_grid_cc_main.
SET HANDLER o_events_main->on_button_click_main_alv FOR o_grid_cc_main.
SET HANDLER o_events_main->on_hotspot_click FOR o_grid_cc_main.
SET HANDLER o_events_main->on_toolbar FOR o_grid_cc_main.
SET HANDLER o_events_main->on_data_changed FOR o_grid_cc_main.
SET HANDLER o_events_main->on_data_changed_finished FOR o_grid_cc_main.
-
-
ACTUA CUANDO SE MODIFICA UN VALOR EN EL ALV Y SE PRECIO ENTER
CALL METHOD o_grid_cc_main->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
-
PERFORM crea_fcat_main CHANGING gt_fcat_alv_main[].
PERFORM modify_fcat_alv USING ‘MAIN’ CHANGING gt_fcat_alv_main[].
PERFORM prepare_layout_alv USING ‘MAIN’ CHANGING gs_layout_main.
CREATE OBJECT lcl_handler_receiver_ca.
-
CALL METHOD o_grid_cc_main->set_table_for_first_display
EXPORTING
is_layout = gs_layout_main
i_save = ‘A’
i_default = ‘X’
CHANGING
it_outtab = gt_alv_main[]
it_fieldcatalog = gt_fcat_alv_main[]
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ENDIF.
-
CALL METHOD o_grid_cc_main->refresh_table_display
EXPORTING
is_stable = gs_stable.
-
ENDFORM.
-------------------------------------------------------------------------------------------------------------------
-
FORM : USER_COMMAND_DYN
-------------------------------------------------------------------------------------------------------------------
FORM user_command_dyn.
-
-
-
-
ld_okcode = ok_code.
CLEAR : ok_code.
-
CASE ld_okcode.
WHEN ‘VER_DETALLE’.
PERFORM show_alv_deta USING gs_alv_main.
ENDFORM.
-------------------------------------------------------------------------------------------------------------------
- FORM : SHOW_ALV_DETA
-------------------------------------------------------------------------------------------------------------------
FORM show_alv_deta USING ps_alv_main TYPE ty_alv_main.
-
-
*---- LLENAT TABLA INTERNA DEL ALV DE DETALLE
- IF ( cc_deta IS INITIAL ).
- CREATE OBJECT cc_deta
EXPORTING
container_name = cc_deta_name.
- CREATE OBJECT o_grid_cc_deta
EXPORTING
i_parent = cc_deta.
-
- LAMADA DE LOS EVENTOS DESARROLLADO EN LA CLASE : LCL_EVENT_RECEIVER
CREATE OBJECT o_events_deta.
SET HANDLER o_events_deta->on_user_command FOR o_grid_cc_deta.
SET HANDLER o_events_deta->on_button_click_deta_alv FOR o_grid_cc_deta.
SET HANDLER o_events_deta->on_hotspot_click_deta FOR o_grid_cc_deta.
SET HANDLER o_events_deta->on_toolbar_deta FOR o_grid_cc_deta.
SET HANDLER o_events_deta->on_data_changed FOR o_grid_cc_deta.
SET HANDLER o_events_deta->on_data_changed_finished FOR o_grid_cc_deta.
-
- ACTUA CUANDO SE MODIFICA UN VALOR EN EL ALV Y SE PRECIO ENTER
CALL METHOD o_grid_cc_deta->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
- PERFORM crea_fcat_deta CHANGING gt_fcat_alv_deta[].
PERFORM modify_fcat_alv USING ‘DETA’ CHANGING gt_fcat_alv_deta[].
PERFORM prepare_layout_alv USING ‘DETA’ CHANGING gs_layout_deta.
- CALL METHOD o_grid_cc_deta->set_table_for_first_display
EXPORTING
is_variant = gs_variant
is_layout = gs_layout_deta
i_save = ‘A’
i_default = ‘X’
CHANGING
it_outtab = gt_alv_deta[]
it_fieldcatalog = gt_fcat_alv_deta[]
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ELSE.
CALL METHOD o_grid_cc_deta->refresh_table_display
EXPORTING
is_stable = gs_stable.
ENDIF.
-
ENDFORM. "
-------------------------------------------------------------------------------------------------------------------
- FORM : USER_COMMAND_ALV
-------------------------------------------------------------------------------------------------------------------
FORM user_command_alv USING p_function
pa_alv_name.
-
-
-
- CASE p_function.
-
- WHEN ‘CARG’.
-
-
*------>>> PROCESO DE ESTE COMAMNDO
IF ( o_grid_cc_main IS BOUND ).
CALL METHOD o_grid_cc_main->refresh_table_display
EXPORTING
is_stable = gs_stable.
ENDIF.
IF ( o_grid_cc_deta IS BOUND ).
CALL METHOD o_grid_cc_deta->refresh_table_display.
ENDIF.
- ENDCASE.
- CALL METHOD cl_gui_cfw=>dispatch.
CLEAR : sy-ucomm, ok_code.
-
ENDFORM. "