|
#1
|
||||
|
||||
Una Dynpro con Dos ALV Tree :o
Holis de nuevo!
Acabe (por fin!) mi ALV Tree con la consulta a las tablas... Todo un lío :s pero despues de revisarlo, me pidieron que en esa misma dynpro despliegue dos ALV Tree... Y yo solo pense "Mmmm creo que es reutilizar funciones y solamente hacer una busqueda de datos diferentes" O es q tengo que rehacer las funciones para pintar otro ALV??? Y una duda mas...Como hago para agrupar desde el Screen Painter un Control Custom y un Label??? Porque tambien tengo que aparecerlos y desaparecerlos dependiendo del valor de una variable... Muchas gracias de Antemano!! (por lo menos por leerlo )
__________________
Jazzy Lebon |
#2
|
|||
|
|||
Para poder hacer 2 trees en una misma dynpro me temo que no vas a poder utilizar las reuse, tendras que hacerlo por medio de objetos declarandote 2 custom container y asignando un objeto tree a cada uno
Para agrupar campo y ocultarlos o mostrarlos juntos vete a la SE51 metes el nombre de programa y dynpro, haces doble click en un campo y en la pantalla que te sale veras que hay una parte donde pone grupos y hay 4 parametros ponle el mismo nombre en uno de los parametros al custom control y al label, luego mediante codigo puedes hacer un loop at screen y veras que dentro de la estructura screen hay unos campos llamados group1 group2 ... si por ejemplo le hubieras puesto TEST en el parametro 1 al custom control podrias hacer Loop at screen if group1 = TEST ocultar campos endif endloop |
#3
|
|||
|
|||
Hola...
Chekat este codigo....pue q te ayude..es OO
REPORT test. TYPE-POOLS: icon. DATA: ok_code LIKE sy-ucomm. DATA gs_variant TYPE disvariant. DATA: gt_fieldcat TYPE lvc_t_fcat. DATA: gs_layout TYPE lvc_s_layo. DATA: gs_fieldcat TYPE lvc_s_fcat. DATA: BEGIN OF gt_sflight OCCURS 0. INCLUDE STRUCTURE sflight. DATA: carrname LIKE scarr-carrname, cell TYPE lvc_t_styl, END OF gt_sflight. DATA: BEGIN OF it_sflight OCCURS 0. INCLUDE STRUCTURE sflight. DATA: END OF it_sflight. DATA: BEGIN OF gt_sflight1 OCCURS 0. INCLUDE STRUCTURE sflight. DATA: carrname LIKE scarr-carrname, END OF gt_sflight1, * g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1', g_container TYPE scrfname VALUE 'CONTEINER1', g_container2 TYPE scrfname VALUE 'CONTEINER2', grid1 TYPE REF TO cl_gui_alv_grid, grid2 TYPE REF TO cl_gui_alv_grid, g_custom_container TYPE REF TO cl_gui_custom_container, g_custom_container2 TYPE REF TO cl_gui_custom_container. CLASS lcl_event_receiver DEFINITION DEFERRED. DATA: o_event_receiver TYPE REF TO lcl_event_receiver. *---------------------------------------------------------------------* * CLASS lcl_event_receiver DEFINITION *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* CLASS lcl_event_receiver DEFINITION. PUBLIC SECTION. METHODS: handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid IMPORTING e_object e_interactive, handle_user_command FOR EVENT user_command OF cl_gui_alv_grid IMPORTING e_ucomm. ENDCLASS. *---------------------------------------------------------------------* * class lcl_event_receiver implementation *---------------------------------------------------------------------* CLASS lcl_event_receiver IMPLEMENTATION. METHOD handle_toolbar. * manejador del evento para el evento toolbar CONSTANTS: * constantes de botón c_button_normal TYPE i VALUE 0, c_menu_and_default_button TYPE i VALUE 1, c_menu TYPE i VALUE 2, c_separator TYPE i VALUE 3, c_radio_button TYPE i VALUE 4, c_checkbox TYPE i VALUE 5, c_menu_entry TYPE i VALUE 6. DATA: ls_toolbar TYPE stb_button. * añade un separador CLEAR ls_toolbar. MOVE c_separator TO ls_toolbar-butn_type.. APPEND ls_toolbar TO e_object->mt_toolbar. * append a new button that to the toolbar. use e_object of * event toolbar.e_object is of type cl_alv_event_toolbar_set. * this class has one attribute mt_toolbar which is of table type * ttb_button. * the structure is stb_button *******Borrado de Botones Estandar: DELETE e_object->mt_toolbar WHERE ( function EQ '&MB_SUM' OR function EQ '&MB_SUBTOT' OR function EQ '&GRAPH' OR function EQ '&&SEP07' OR function EQ '&INFO' ). ******** CLEAR ls_toolbar. MOVE 'LOG' TO ls_toolbar-function. MOVE icon_error_protocol TO ls_toolbar-icon. MOVE 'Log Errores' TO ls_toolbar-quickinfo. MOVE 'Log' TO ls_toolbar-text. MOVE ' ' TO ls_toolbar-disabled. APPEND ls_toolbar TO e_object->mt_toolbar. ENDMETHOD. METHOD handle_user_command. * handle own functions defined in the toolbar CASE e_ucomm. WHEN 'CHANGE'. LEAVE TO SCREEN 0. WHEN 'LOG'. CALL TRANSACTION 'SM35'. ENDCASE. ENDMETHOD. ENDCLASS. *---------------------------------------------------------------------* * MAIN * *---------------------------------------------------------------------* START-OF-SELECTION. DATA: wa_sflight LIKE gt_sflight. DATA: flag1(1), flag2(1). DATA: seatsocc LIKE gt_sflight-seatsocc. DATA: planetype LIKE gt_sflight-planetype. SELECT * INTO CORRESPONDING FIELDS OF TABLE it_sflight FROM sflight. LOOP AT it_sflight. MOVE-CORRESPONDING it_sflight TO gt_sflight. APPEND gt_sflight. ENDLOOP. SORT gt_sflight BY planetype. * SEATSMAX *PLANETYPE LOOP AT gt_sflight INTO wa_sflight. IF seatsocc NE wa_sflight-seatsocc AND planetype NE wa_sflight-planetype. CLEAR wa_sflight-seatsmax. MOVE '1' TO wa_sflight-seatsmax. MODIFY gt_sflight FROM wa_sflight. MOVE: wa_sflight-seatsocc TO seatsocc, wa_sflight-planetype TO planetype. ELSEIF seatsocc EQ wa_sflight-seatsocc AND planetype NE wa_sflight-planetype. CLEAR wa_sflight-seatsmax. MOVE '1' TO wa_sflight-seatsmax. MODIFY gt_sflight FROM wa_sflight. MOVE: wa_sflight-seatsocc TO seatsocc, wa_sflight-planetype TO planetype. ELSEIF seatsocc NE wa_sflight-seatsocc AND planetype EQ wa_sflight-planetype. CLEAR wa_sflight-seatsmax. MOVE '1' TO wa_sflight-seatsmax. MODIFY gt_sflight FROM wa_sflight. MOVE: wa_sflight-seatsocc TO seatsocc, wa_sflight-planetype TO planetype. ELSE. MOVE: wa_sflight-seatsocc TO seatsocc, wa_sflight-planetype TO planetype. CLEAR wa_sflight-seatsmax. MOVE '0' TO wa_sflight-seatsmax. MODIFY gt_sflight FROM wa_sflight. ENDIF. ENDLOOP. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'CARRID'. gs_fieldcat-ref_table = 'SFLIGHT'. gs_fieldcat-outputlen = '5'. gs_fieldcat-key = 'X'. * gs_fieldcat-edit = 'X'. gs_fieldcat-auto_value = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'CARRNAME'. gs_fieldcat-ref_table = 'SCARR'. gs_fieldcat-outputlen = '12'. gs_fieldcat-key = 'X'. gs_fieldcat-auto_value = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'CONNID'. gs_fieldcat-ref_table = 'SFLIGHT'. gs_fieldcat-key = 'X'. * gs_fieldcat-edit = 'X'. gs_fieldcat-auto_value = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'FLDATE'. gs_fieldcat-ref_table = 'SFLIGHT'. * gs_fieldcat-edit = 'X'. gs_fieldcat-key = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'SEATSOCC'. gs_fieldcat-ref_table = 'SFLIGHT'. * gs_fieldcat-edit = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'PLANETYPE'. gs_fieldcat-ref_table = 'SFLIGHT'. * gs_fieldcat-edit = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'SEATSMAX'. gs_fieldcat-ref_table = 'SFLIGHT'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'PAYMENTSUM'. gs_fieldcat-datatype = 'CURR'. gs_fieldcat-coltext = text-004. gs_fieldcat-cfieldname = 'CURRENCY'. * gs_fieldcat-edit = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'PRICE'. gs_fieldcat-ref_table = 'SFLIGHT'. gs_fieldcat-cfieldname = 'CURRENCY'. * gs_fieldcat-edit = 'X'. APPEND gs_fieldcat TO gt_fieldcat. CLEAR gs_fieldcat. gs_fieldcat-fieldname = 'CURRENCY'. gs_fieldcat-ref_table = 'SFLIGHT'. * gs_fieldcat-edit = 'X'. gs_fieldcat-checktable = '!'. gs_fieldcat-auto_value = 'X'. APPEND gs_fieldcat TO gt_fieldcat. gs_variant-report = sy-repid. * CALL SCREEN 100. CALL SCREEN 0001. *---------------------------------------------------------------------* * MODULE PBO OUTPUT * *---------------------------------------------------------------------* MODULE pbo OUTPUT. PERFORM pbo_output. ENDMODULE. *---------------------------------------------------------------------* * MODULE PAI INPUT * *---------------------------------------------------------------------* MODULE pai INPUT. PERFORM pai_input. ENDMODULE. " F4 *&---------------------------------------------------------------------* *& Form pbo_output *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM pbo_output. SET PF-STATUS 'MAIN100'. * SET PF-STATUS 'MAIN0001'. SET TITLEBAR '001'. IF g_custom_container IS INITIAL. IF sy-batch IS INITIAL. CREATE OBJECT g_custom_container EXPORTING container_name = g_container. ENDIF. CREATE OBJECT grid1 EXPORTING i_parent = g_custom_container. CREATE OBJECT o_event_receiver. SET HANDLER o_event_receiver->handle_user_command FOR grid1. SET HANDLER o_event_receiver->handle_toolbar FOR grid1. gs_layout-stylefname = 'CELL'. gs_layout-no_toolbar = ' '. gs_layout-grid_title = 'Facturas Contabilizadas en SAP'. CALL METHOD grid1->set_table_for_first_display EXPORTING i_save = 'A' is_layout = gs_layout CHANGING it_fieldcatalog = gt_fieldcat it_outtab = gt_sflight[]. CALL METHOD grid1->set_toolbar_interactive. ENDIF. IF g_custom_container2 IS INITIAL. IF sy-batch IS INITIAL. CREATE OBJECT g_custom_container2 EXPORTING container_name = g_container2. ENDIF. CREATE OBJECT grid2 EXPORTING i_parent = g_custom_container2. * CREATE OBJECT o_event_receiver. SET HANDLER o_event_receiver->handle_user_command FOR grid2. SET HANDLER o_event_receiver->handle_toolbar FOR grid2. gs_layout-stylefname = 'CELL'. gs_layout-grid_title = 'Facturas Anuladas en SAP'. CALL METHOD grid2->set_table_for_first_display EXPORTING i_save = 'A' is_layout = gs_layout CHANGING it_fieldcatalog = gt_fieldcat it_outtab = gt_sflight[]. CALL METHOD grid2->set_toolbar_interactive. ENDIF. ENDFORM. " pbo_output *&---------------------------------------------------------------------* *& Form pai_input *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM pai_input. DATA: l_valid(1) TYPE c. ok_code = sy-ucomm. CASE ok_code. WHEN 'SAVE'. CALL METHOD grid1->check_changed_data IMPORTING e_valid = l_valid. IF l_valid = 'X'. MESSAGE i000(0k) WITH text-009. ELSE. MESSAGE i000(0k) WITH text-010. ENDIF. WHEN 'CHANGE'. IF grid1->is_ready_for_input( ) = 0. CALL METHOD grid1->set_ready_for_input EXPORTING i_ready_for_input = 1. ELSE. CALL METHOD grid1->check_changed_data IMPORTING e_valid = l_valid. IF l_valid = 'X'. CALL METHOD grid1->set_ready_for_input EXPORTING i_ready_for_input = 0. ENDIF. ENDIF. WHEN 'EXIT'. SET SCREEN 0. LEAVE SCREEN. ENDCASE. CLEAR ok_code. ENDFORM. " pai_input *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. * SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'. ENDMODULE. " STATUS_0100 OUTPUT Nota: El codigo no es mio...pero me lo piratie
__________________
el tema esta en hacer la pregunta correcta... |
#4
|
||||
|
||||
:) Gracias
Muchas gracias por sus respuestas!!
Ballan--> Intente hacerle como me lo mencionas, pero ya sea por la transaccion se51 o la sm80, cuando agrego un segundo ALV, los 4 edits que vienen para agregar los grupos vienen deshabilitados. vickxo--> Gracias! En un momento lo pruebo. Mientras estoy checando la lógica de todos modos gracias
__________________
Jazzy Lebon |
#5
|
|||
|
|||
C me olvido mencionar
Olvide mencionar q debes de crear dos dynpros y en cada una agrear dos conteiner
CONTEINER1 Contiene el primer ALV CONTEINER2 COntiene el sefgundo ALV Y dos dynpros... la dynpro 0001 Contendra los ALV y debera de tener este codigo PROCESS BEFORE OUTPUT. * MODULE STATUS_0100. MODULE pbo. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0100. MODULE pai. MODULE user_command_0001. La dynpro 0100 hace otra cosa q no viene al caso y trae este codigo PROCESS BEFORE OUTPUT. * MODULE STATUS_0100. MODULE pbo. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0100. MODULE pai. pero agregale un container con este nombre BCALV_GRID_DEMO_0100_CONT1 Saludos...para cambiar a ALV tree solo dberias de mandar a llamar la cuncion ALV
__________________
el tema esta en hacer la pregunta correcta... |
#6
|
||||
|
||||
Gracias!!
Vickxo, me sirvio muchisimo tu ayuda!!!!!
Gracias!!!!
__________________
Jazzy Lebon |
Herramientas | Buscar en Tema |
Desplegado | |
|
|