2006 Dec 29 9:52 AM
Hello,
i need your help/experiences.
Regarding SOX we have to close our productive system. If the system is closed, maintaining all tables with se16 is not possible.
Now we have a few (over 100) own customizing tables (only in x and y namespace) where we have to do changes directly in the productive system.
My first idea is a simple alv grid with edit function, but this make problems when sorting and saving a huge amount of data and data will be corrupt.
Next idea was to copy the hole se16 package to z namespace and find the coding for the maintain - but i did´n´t get it to work, a lot of syntax errors after copying.
We are now on 2004s with WEB AS 6.40 and i even tried the "Recreate se16" from Thomas Jung - but is only for reading tables.
Has anybody of you has the same experience or a generic programm to change tables stable.
Thank you for your help in advance.
Marcus
2006 Dec 29 10:00 AM
Hi Marcus,
We also had such type of requirement in our project and in that case we developed a module pool program for maintaining the z tables.
Regards
Ashutosh
Reward points if helpful
2006 Dec 29 11:35 AM
Hi Marcus
Here is a sample that will guide you to create this tool. You must add a few more functioanlities as per your requirement. Hope this will solve your problem,
REPORT zkb_se16.
PARAMETERS: p_table TYPE dntab-tabname DEFAULT 'ZCA_PROJECT_TASK' OBLIGATORY.
TYPE-POOLS : abap.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: o_grid TYPE REF TO cl_gui_alv_grid,
o_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE,
<fs_warea> TYPE ANY,
<fs_field> TYPE ANY.
DATA: o_table TYPE REF TO data,
o_line TYPE REF TO data,
w_fcat TYPE lvc_s_fcat,
i_fcat TYPE lvc_t_fcat,
i_sort TYPE lvc_t_sort,
i_layo TYPE lvc_s_layo.
DATA : i_nametab TYPE TABLE OF dntab,
w_nametab TYPE dntab.
*----------------------------------------------------------------------*
* 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. "lcl_event_receiver DEFINITION
*&---------------------------------------------------------------------*
*& 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.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'EDIT' TO ls_toolbar-function.
MOVE icon_system_copy TO ls_toolbar-icon.
MOVE 'Sets Grid in Edit Mode' TO ls_toolbar-quickinfo.
MOVE 'Edit' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
MOVE 'UPDATE' TO ls_toolbar-function.
MOVE icon_system_save TO ls_toolbar-icon.
MOVE 'Updates all the changed data' TO ls_toolbar-quickinfo.
MOVE 'Update' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
MOVE 'DELETE' TO ls_toolbar-function.
MOVE icon_delete TO ls_toolbar-icon.
MOVE 'Deletes the current record' TO ls_toolbar-quickinfo.
MOVE 'Delete' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
* Method that check the events in the created buttons. *
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'EDIT'.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
WHEN 'UPDATE'.
PERFORM update_modified_information.
WHEN 'DELETE'.
PERFORM delete_modified_information.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
START-OF-SELECTION.
CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'SE16'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.
CASE sy-ucomm .
WHEN 'BACK' OR 'EXIT'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN OTHERS.
MESSAGE 'Function Not Defined' TYPE 'I'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
*& Module init_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE init_9000 OUTPUT.
IF o_custom_container IS INITIAL.
* Create a custom container
CREATE OBJECT o_custom_container
EXPORTING
container_name = 'CONTAINER'
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.
CREATE OBJECT o_grid
EXPORTING
i_parent = o_custom_container
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.
CREATE OBJECT o_event_receiver. "Creating event receiver object
SET HANDLER o_event_receiver->handle_user_command FOR o_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR o_grid.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
ENDIF.
ENDMODULE. " init_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Module build_struct_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE build_struct_9000 OUTPUT.
* Create dynamic Internal Table
CREATE DATA o_table TYPE TABLE OF (p_table) .
ASSIGN o_table->* TO <fs_table>.
* Create dynamic work area
CREATE DATA o_line LIKE LINE OF <fs_table>.
ASSIGN o_line->* TO <fs_warea>.
* Field Catalogue
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = p_table
TABLES
nametab = i_nametab.
LOOP AT i_nametab INTO w_nametab .
w_fcat-col_pos = w_nametab-position.
w_fcat-fieldname = w_nametab-fieldname .
w_fcat-datatype = w_nametab-datatype.
w_fcat-inttype = w_nametab-inttype.
w_fcat-intlen = w_nametab-intlen.
w_fcat-decimals = w_nametab-decimals.
IF w_nametab-keyflag NE 'X'.
w_fcat-edit = 'X'.
ENDIF.
APPEND w_fcat TO i_fcat.
ENDLOOP.
ENDMODULE. " build_struct_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Module display_in_grid_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE display_in_grid_9000 OUTPUT.
SELECT * FROM (p_table) INTO TABLE <fs_table>.
IF sy-subrc EQ 0.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_layout = i_layo
CHANGING
it_outtab = <fs_table>
it_fieldcatalog = i_fcat
it_sort = i_sort
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.
ENDIF.
ENDMODULE. " display_in_grid_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Form update_modified_information
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM update_modified_information .
UPDATE (p_table) FROM TABLE <fs_table>.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
ENDFORM. " update_modified_information
*&---------------------------------------------------------------------*
*& Form delete_modified_information
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM delete_modified_information .
DATA: lv_line TYPE i,
lv_count TYPE i VALUE 0.
DATA: i_index_rows TYPE lvc_t_row,
w_index_rows LIKE lvc_s_row.
* Reading the index of the selected row in the ALV grid.
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = i_index_rows.
DESCRIBE TABLE i_index_rows LINES lv_line.
IF lv_line LT 1.
MESSAGE 'Selete atleast 1 row' TYPE 'I'.
EXIT.
ELSE.
LOOP AT i_index_rows INTO w_index_rows .
lv_line = w_index_rows-index - lv_count.
READ TABLE <fs_table> INTO <fs_warea> INDEX lv_line.
DELETE <fs_table> INDEX lv_line.
DELETE (p_table) FROM <fs_warea>.
lv_count = lv_count + 1.
ENDLOOP.
CALL METHOD o_grid->refresh_table_display.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
ENDIF.
ENDFORM. " delete_modified_information
Regards
Kathirvel
2007 Jan 09 9:10 AM
Hi,
thank you very much for your help!,
i tried to implement your code, but i have problems when i create a dynpro to your code, can you give me a little advice ?
Posting you the error message tomorrow.
Thanks in advance.
Marcus
2007 Jan 09 9:43 AM
you can just use this program
RK_SE16N
which uses function SE16N_START
Regards
Raja
2007 Jan 09 12:02 PM
Marcus,
We had to go through the same excercise in our system. We had two standards that we have to follow on Z tables:
1. All Z Tables must have and authorization group
2. All Z tables that should be maintained in a productive system must have either a table maintenance or another type of program such as module pool to maintain.
We used two techniques to address this. For both techniques we used table maintenance generator to create table maintenance for the tables. Once you have done that you have a couple of options:
1. Create a parameter transaction that calls transaction SM30 that starts the table maintenance for that table
2. Create an ABAP program using function module VIEW_MAINTENANCE_CALL. This function module is also the same as calling SM30. With this you could create a program where the user selects that table that they want to maintain, and then just change the parameters you are passing.
Regards,
Chris H.
2007 Jan 09 1:03 PM
You could change the settings of the tables and make changes via the transport system.
Or you could activate the maintenance generator for several tables and change them vias SM31.
Kind regards, Rob Dielemans