Professional Documents
Culture Documents
1) Debes Crear una Dynpro : 3000 en ella un custom control llamado CONTENEDOR
2) Crear un status Gui vacio
3) Puedes crear o no una segunda Dynpro : 3100 para edicion en detalle de un
registro con OK_CODE.
4) Modifica lo que sea necesario para tu necesidad como por ejemplo el nombre de
la Tabla "Z" ( TABLA_Z ).
Saludos.
Atte.,
Enrique Borroni.
TABLES : TABLA_Z.
TYPE-POOLS: icon.
*&---------------------------------------------------------------------*
*& Declaration Section for the Internal Tables *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Declaration Section for EVENT HANDLER CLASS *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Declaration Section for the ALV Grid *
*&---------------------------------------------------------------------*
PUBLIC SECTION.
METHODS:
*&---------------------------------------------------------------------*
*& Classes implementation section
*&---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
CONSTANTS:
c_button_normal TYPE i VALUE 0,
c_separator TYPE i VALUE 1.
ENDMETHOD. "handle_toolbar
CASE e_ucomm.
WHEN 'AGRE'.
CALL SCREEN 3100 STARTING AT 25 3.
* WHEN 'EDIT'.
* CALL METHOD obj_grid->set_ready_for_input
* EXPORTING
* i_ready_for_input = 1.
WHEN 'UPDATE'.
PERFORM update_modified_information.
WHEN 'DELETE'.
PERFORM delete_selected_information.
WHEN 'REFRESH'.
PERFORM refresh_table_information.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDMETHOD. "handle_double_click
*&---------------------------------------------------------------------*
*& Selection ScreenSection for the ALV Grid
*&---------------------------------------------------------------------*
*SELECTION-SCREEN BEGIN OF BLOCK add1 WITH FRAME TITLE text-001.
*
****select-options : s_acode for TABLA_Z-addcode.
*
*SELECTION-SCREEN END OF BLOCK add1.
*&---------------------------------------------------------------------*
*& Start Of Selection Event Begins Here *
*&---------------------------------------------------------------------*
START-OF-SELECTION.
IF obj_contenedor IS INITIAL.
CREATE OBJECT obj_contenedor "Creating container object
EXPORTING
container_name = i_container.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_3000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_3000 INPUT.
CASE ok_code.
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_3001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_3001 INPUT.
CASE ok_code.
WHEN 'CLOS'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form create_field_catalog
*&---------------------------------------------------------------------*
* This Subroutine Creates the Field Catalogue.
*----------------------------------------------------------------------*
FORM create_field_catalog.
* Address Code
w_fcat-fieldname = 'BWSCL'.
w_fcat-ref_table = 'TABLA_Z'.
w_fcat-ref_field = 'BWSCL'.
w_fcat-coltext = text-100.
w_fcat-seltext = text-100.
w_fcat-col_pos = 1.
w_fcat-outputlen = 15.
w_fcat-sp_group = 'GEN'.
APPEND w_fcat TO i_fcat.
CLEAR w_fcat.
* Address Name
w_fcat-fieldname = 'MSTAE'.
w_fcat-ref_table = 'TABLA_Z'.
w_fcat-ref_field = 'MSTAE'.
w_fcat-coltext = text-105.
w_fcat-seltext = text-105.
w_fcat-col_pos = 2.
w_fcat-outputlen = 15.
w_fcat-sp_group = 'GEN'.
APPEND w_fcat TO i_fcat.
CLEAR w_fcat.
*&---------------------------------------------------------------------*
*& Form create_field_group
*&---------------------------------------------------------------------*
* Creates the Grouping for the Fields in the Grid
*----------------------------------------------------------------------*
FORM create_field_group.
*&---------------------------------------------------------------------*
*& Form update_modified_information
*&---------------------------------------------------------------------*
* Updates all the changed entries into the database table
*----------------------------------------------------------------------*
FORM update_modified_information.
IF sy-subrc = 0.
MESSAGE i000 WITH 'Los Cambios se Guardaron...'.
ELSE.
MESSAGE i000 WITH 'Los Cambios NO se Guardaron...'.
ENDIF.
*&---------------------------------------------------------------------*
*& Form delete_selected_information
*&---------------------------------------------------------------------*
* This Deletes the selected row of data form the ALV grid.
*----------------------------------------------------------------------*
FORM delete_selected_information.
CLEAR : t_intab2.
REFRESH : t_intab2.
IF i_lines = 0.
MESSAGE i000 WITH 'Para Eliminar...Debe Marcar un Registro.'.
EXIT.
ENDIF.
COMMIT WORK.
PERFORM refresh_table_information.
IF sy-subrc = 0.
MESSAGE i000 WITH 'Proceso de Borrado Ok.'.
ELSE.
MESSAGE i000 WITH 'Fallo el Proceso de Borrado'.
ENDIF.
CASE ok_code.
WHEN 'GRAB'.
PERFORM nuevo_registro.
SET SCREEN 0.
WHEN 'CANC'.
SET SCREEN 0.
ENDCASE.
CLEAR : ok_code,
sy-ucomm.
ENDMODULE. " USER_COMMAND_3100 INPUT
*&---------------------------------------------------------------------*
*& Form NUEVO_REGISTRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM nuevo_registro .
CLEAR : t_intab1.
REFRESH : t_intab1.
ENDIF.