2005 Feb 23 1:44 PM
Hi All,
I have created a Parameter transaction for SM30 by which I am able to maintain entries in my user-defined table. But, I would like to restrict the entries displayed (not using the conditions in SM30) by creating the selection screen where only the few fields of the user-defined table are presented for selection and based on that I get output. I want the full functionality of the parameter transaction(creation , deletion of the entries) though.
if some one has any ideas kindly let me know.
Thanks,
Manish
2005 Feb 23 1:50 PM
2005 Feb 23 2:45 PM
Have you tried maintenance type: 2 step so that you can get a selection type screen? If so, what do you not like about it?
2005 Feb 23 4:06 PM
Hi Manish,
I don't know if a two-step maintenance is good for you as suggested in one reply here, but if your requirement is to give user a SM30 feature but have a selection screen of your own, then here is an example of how you can achieve that with a custom program. I don't think you can achieve that with just parametric transaction and without using conditions and without modifying the maintenance screens.
Let me know if you have any questions regarding this code. This program is for a Z table mainetnance which has two fields, a code and a description. Users are given a choice of entering their criteria for either the code or the description or both. This criteria is internally converted to a format that the table maintenance function module understands. The result is that users get to see and maintain only the records that they wanted.
REPORT test.
*----------------------------------------------------------------------*
* DB TABLES AND STRUCTURES *
*----------------------------------------------------------------------*
TABLES: sscrfields,
z_group.
*----------------------------------------------------------------------*
* INTERNAL TABLES *
*----------------------------------------------------------------------*
*-- Internal table for seltab
DATA : i_seltab LIKE vimsellist OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF i_excl_tab OCCURS 0,
pfkey LIKE sy-pfkey.
DATA: END OF i_excl_tab.
*----------------------------------------------------------------------*
* VARIABLES *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* CONSTANTS *
*----------------------------------------------------------------------*
*------------------------ Selection Screen ---------------------------*
*-- Maintain EOQ Tables: Initial Screen
SELECTION-SCREEN BEGIN OF BLOCK selscr WITH FRAME TITLE text-000.
SELECTION-SCREEN SKIP 1.
*-- Select the table you want to maintain
SELECTION-SCREEN BEGIN OF BLOCK program WITH FRAME TITLE text-001.
PARAMETERS : p_table LIKE dd02l-tabname DEFAULT 'Z_GROUP'.
SELECTION-SCREEN END OF BLOCK program.
SELECTION-SCREEN BEGIN OF BLOCK fursel WITH FRAME TITLE text-002.
*-- Selections for EOQ groups
SELECT-OPTIONS: s_group FOR z_group-group,
s_descr FOR z_group-descr NO-EXTENSION
NO INTERVALS.
SELECTION-SCREEN END OF BLOCK fursel.
*-- display or maintain options
SELECTION-SCREEN PUSHBUTTON: /10(20) update USER-COMMAND upda
MODIF ID ind,
35(20) display USER-COMMAND disp
MODIF ID ind.
SELECTION-SCREEN END OF BLOCK selscr.
*--------------
INITIALIZATION.
*--------------
PERFORM initialize_variables.
*--------------------------
AT SELECTION-SCREEN OUTPUT.
*--------------------------
*-- set the PF Status for the selection screen
PERFORM set_sel_screen_pf_status.
LOOP AT SCREEN.
CHECK screen-name = 'P_TABLE'.
screen-input = 0.
MODIFY SCREEN.
ENDLOOP.
*-------------------
AT SELECTION-SCREEN.
*-------------------
CHECK NOT p_table IS INITIAL.
PERFORM call_maintenance USING sscrfields-ucomm.
*------------------
START-OF-SELECTION.
*------------------
*----------------
END-OF-SELECTION.
*----------------
*--------------------- Routines used in the program -------------------*
*---------------------------------------------------------------------*
* FORM initialize_variables *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM initialize_variables.
MOVE: 'Update'(006) TO update,
'Display'(007) TO display.
ENDFORM. " initialize_variables
*---------------------------------------------------------------------*
* FORM SET_SEL_SCREEN_PF_STATUS *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM set_sel_screen_pf_status.
MOVE 'ONLI' TO i_excl_tab-pfkey.
APPEND i_excl_tab.
CLEAR i_excl_tab.
MOVE 'SJOB' TO i_excl_tab-pfkey.
APPEND i_excl_tab.
CLEAR i_excl_tab.
MOVE 'PRIN' TO i_excl_tab-pfkey.
APPEND i_excl_tab.
CLEAR i_excl_tab.
MOVE 'DYNS' TO i_excl_tab-pfkey.
APPEND i_excl_tab.
CLEAR i_excl_tab.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = '%_00'
p_program = 'RSSYSTDB'
TABLES
p_exclude = i_excl_tab.
ENDFORM. " SET_SEL_SCREEN_PF_STATUS
*&---------------------------------------------------------------------*
*& Form call_maintenance
*&---------------------------------------------------------------------*
* To display the maintenance of the table entered.
*----------------------------------------------------------------------*
FORM call_maintenance USING action LIKE sy-ucomm.
DATA: l_view_action.
IF action = 'UPDA'.
l_view_action = 'U'.
ELSEIF action = 'DISP'.
l_view_action = 'S'.
ELSE.
EXIT.
ENDIF.
*-- prepare the select statement for the call
PERFORM prepare_sel_statement.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = l_view_action
* CORR_NUMBER = ' '
* GENERATE_MAINT_TOOL_IF_MISSING = ' '
* SHOW_SELECTION_POPUP = ' '
view_name = p_table
* NO_WARNING_FOR_CLIENTINDEP = ' '
* RFC_DESTINATION_FOR_UPGRADE = ' '
* CLIENT_FOR_UPGRADE = ' '
* VARIANT_FOR_SELECTION = ' '
* COMPLEX_SELCONDS_USED = ' '
TABLES
dba_sellist = i_seltab
* EXCL_CUA_FUNCT =
EXCEPTIONS
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
OTHERS = 14
.
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. " call_maintenance
*---------------------------------------------------------------------*
* FORM prepare_sel_statement *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM prepare_sel_statement.
CLEAR: i_seltab, i_seltab[].
PERFORM prepare_seltab_for_grp.
ENDFORM. " PREPARE_SEL_STATEMENT
*---------------------------------------------------------------------*
* FORM PREPARE_SELTAB_FOR_GRP *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM prepare_seltab_for_grp.
IF NOT s_group[] IS INITIAL.
*-- if any criteria is entered for the GROUP field
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
fieldname = 'GROUP'
* APPEND_CONJUNCTION = ' '
TABLES
sellist = i_seltab
rangetab = s_group.
ENDIF.
IF NOT s_descr[] IS INITIAL.
*-- if any criteria is entered for the GROUP DESCRIPTION field
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
fieldname = 'DESCR'
append_conjunction = 'AND'
TABLES
sellist = i_seltab
rangetab = s_descr.
ENDIF.
ENDFORM. " PREPARE_SELTAB_FOR_GRP
Hope this helps.
Srinivas