on 01-23-2015 11:53 AM
Estou com um problema em um programa em Module Pool que estou fazendo para portifólio, estou fazendo um duplo ALV Grid onde no primeiro mostra o resultado de uma pesquisa na Sflight, e no segundo ALV, a intenção era trazer UMA linha isolada da Sflight com um Duplo Clique, porém a tabela inteira sflight está sendo mostrada no segundo ALV com o duplo clique.... já tentei de várias formas resolver este problema, mas sem sucesso.....se alguém puder ajudar eu agradeço.
Olha, eu acho que seria interessante entender como você está fazendo as instanciações e chamadas de cada um..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vou deixar como eu estou fazendo abaixo desde a chamada do Container 1 assim fica mais fácil de visualizar..
FORM init_container1 .
IF go_container1 IS NOT BOUND.
CREATE OBJECT go_container1
EXPORTING
* parent =
container_name = 'CONTAINER_1'
* style =
* lifetime = lifetime_default
* repid =
* dynnr =
* no_autodef_progid_dynnr =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " INIT_CONTAINER
*&---------------------------------------------------------------------*
*& Form INIT_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_alv1 .
IF go_alv1 IS NOT BOUND.
CREATE OBJECT go_alv1
EXPORTING
* i_shellstyle = 0
* i_lifetime =
i_parent = go_container1
* i_appl_events = space
* i_parentdbg =
* i_applogparent =
* i_graphicsparent =
* i_name =
* i_fcat_complete = SPACE
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " INIT_ALV
*&---------------------------------------------------------------------*
*& Form SHOW_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM show_data1 .
CALL METHOD go_alv1->set_table_for_first_display
EXPORTING
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
i_structure_name = 'SFLIGHT'
* is_variant =
* i_save =
* i_default = 'X'
* is_layout =
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = it_sflight
* it_fieldcatalog =
* it_sort =
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SHOW_DATA
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_data .
SELECT * FROM sflight
INTO TABLE it_sflight
WHERE carrid EQ sflight-carrid
AND connid EQ sflight-connid.
ENDFORM. " SELECT_DATA
*----------------------------------------------------------------------*
* CLASS ENDCLASS
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_handler DEFINITION. " Double Click
PUBLIC SECTION.
METHODS show_table FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row.
* e_column
* es_row_no.
ENDCLASS. "ENDCLASS
*----------------------------------------------------------------------*
* CLASS lcl_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_handler IMPLEMENTATION.
METHOD show_table.
READ TABLE it_sflight INDEX e_row INTO wa_sflight.
IF sy-subrc EQ 0.
SELECT * FROM sflight INTO TABLE it_sflight WHERE carrid = wa_sflight-carrid
and connid = wa_sflight-connid.
ENDIF.
**************************************************************************************************
CALL METHOD go_alv2->set_table_for_first_display
EXPORTING
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
i_structure_name = 'SFLIGHT'
* is_variant =
* i_save =
* i_default = 'X'
* is_layout =
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = it_sflight
* it_fieldcatalog =
* it_sort =
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD. "lcl_handler
ENDCLASS. "lcl_handler IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Form INIT_CONTAINER2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_container2 .
IF go_container2 IS NOT BOUND.
CREATE OBJECT go_container2
EXPORTING
* parent =
container_name = 'CONTAINER_2'
* style =
* lifetime = lifetime_default
* repid =
* dynnr =
* no_autodef_progid_dynnr =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " INIT_CONTAINER2
*&---------------------------------------------------------------------*
*& Form INIT_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_alv2 .
IF go_alv2 IS NOT BOUND.
CREATE OBJECT go_alv2
EXPORTING
* i_shellstyle = 0
* i_lifetime =
i_parent = go_container2
* i_appl_events = space
* i_parentdbg =
* i_applogparent =
* i_graphicsparent =
* i_name =
* i_fcat_complete = SPACE
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA r_handler TYPE REF TO lcl_handler.
CREATE OBJECT r_handler.
SET HANDLER r_handler->show_table FOR go_alv1.
ENDIF.
ENDFORM. " INIT_ALV2
Jefferson,
Veja se na chamada do método CALL METHOD go_alv2->set_table_for_first_display quantas linhas há na tabela it_sflight.
Acredito que ela não esteja apenas com os dados da linha selecionada no primeiro ALV. Neste caso basta ajustar a lógica para pegar os dados apenas da linha que recebeu o duplo clique.
Também sugiro você utilizar outra tabela interna para o segundo ALV.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.