Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SM30- Dynamic modifications in the screen

Former Member
0 Kudos
1,669

Hi Guru's,

I have got a requirement to make table maintenance(SM30) for a Z table. Its been used by 2 user groups(each having different Auth for display). For ex. If a table has 4 fields, one section of users should be able to see all the 4 fields in display mode and the other usergroup should have the 2 fields be in editable mode. I think for this, i need to modify the table control dynamically under the PBO event of maintenance screen. Please suggest.

1 ACCEPTED SOLUTION

alejandro_bindi
Active Contributor
0 Kudos
632

I think the easiest would be to create two different Maintenance views pointing to the same table (one with four fields plus read only attribute, the other with two fields plus change attribute). You can generate them in the same function group but using different dynpros, so each group of users can access one or the other. That way you can even use different authorization groups.

A word of caution with this solution though, each view will probably lock on view level and not table level, hence it would teoretically be possible to access the same record simultaneously in both views. I don't think that would be much of a problem since one of the views is read only, but still I would test this scenario.

Edited by: Alejandro Bindi on Feb 18, 2012 5:29 AM

Well out of curiosity I tested this. The lock is set on table level, and read only views don't set locks.

So the only problem would be on the read only view, since you could be viewing records which were modified or deleted from the editing view. That's all there is to it.

Edited by: Alejandro Bindi on Feb 18, 2012 6:26 AM

17 REPLIES 17

vijaymanikandan
Contributor
0 Kudos
632

Hi

Create the maintenance generator and then create a custom program and use the FM 'VIEW_MAINTENANCE_CALL'. Here you can control using the authorizations.

example

  • Data Declarations

DATA:

lt_sellist TYPE STANDARD TABLE OF vimsellist INITIAL SIZE 0,

ls_sellist TYPE vimsellist,

lt_xfuns TYPE STANDARD TABLE OF vimexclfun INITIAL SIZE 0,

ls_xfuns TYPE vimexclfun,

ld_action TYPE c.

SELECTION-SCREEN begin of BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS: r_maint TYPE c RADIOBUTTON GROUP gr,

r_disp TYPE c RADIOBUTTON GROUP gr.

SELECTION-SCREEN end of BLOCK b2.

ls_sellist-viewfield = 'BUKRS'.

ls_sellist-operator = 'EQ'.

ls_sellist-value = p_bukrs.

APPEND ls_sellist TO lt_sellist.

  • Change or Display

IF r_disp = 'X'.

ls_xfuns-function = 'AEND'.

APPEND ls_xfuns TO lt_xfuns.

ld_action = 'S'.

ELSE.

ld_action = 'U'.

ENDIF.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

ACTION = ld_action

VIEW_NAME = lc_viewname

TABLES

dba_sellist = lt_sellist

excl_cua_funct = lt_xfuns

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.

Regards,

Vijay V

Former Member
0 Kudos
632

Go to the screen number (overview screen) of the Table miantaince generator and write the code to activate and deactivate the fields according to the user.

Former Member
0 Kudos
632

It's a bad idea to change the screens manually that are created by the TMG. When the TMG is changed, the screens may be recreated and the changes lost.

Rob

0 Kudos
632

Thanks to you all for prompt responses.

I am able to change the screen table in the PBO module but as i mentioned i want it for 2 user groups(1user Grp has display all and another Grp has only few fields as editable ). I want to know how can i distinguish the users (dont want to do on the basis of SY_UNAME).

Do i need BASIS help for this? If yes, what exactly?

Thanks

0 Kudos
632

Hi

Did you try to create a program and use the function module and do the activity ? Changing the screen is not the right way.

Regards,

Vijay V

0 Kudos
632

Modifying screen is an issue thats true but sometime we dont have an option. Secondly user group check will be put in the pbo only based on user name you will get group and modify fields

Nabheet

0 Kudos
632

Hi Vijay,

I explored FM "VIEW_MAINTENANCE_CALL" and i can make use of it. I will be creating a Type 1 program having 2 radio buttons for each user but in this soln also I need to statically modify the table cntrl paramter (Ouput Only).

I am looking for a solution in which i can make screen modifications dynamically. For ex. There are 5 fields in the maintainance view. I have the auth of editing 2 columns whereas you have the auth of editing all five.

0 Kudos
632

Hi

BAsed on the authorisation try to loop at screen and make the fields in the column as output only.

You can do this in the Events in the table maintenance as well,

Regards,

Vijay V

0 Kudos
632

Hi ,

can i make use of event 25 "Individual authorization checks" ?

event 26 is not stopping in PBO. Or is there some other event i can make use of ?

Last alternative i am thinking is making an editable ALV if its not possible through this.

alejandro_bindi
Active Contributor
0 Kudos
633

I think the easiest would be to create two different Maintenance views pointing to the same table (one with four fields plus read only attribute, the other with two fields plus change attribute). You can generate them in the same function group but using different dynpros, so each group of users can access one or the other. That way you can even use different authorization groups.

A word of caution with this solution though, each view will probably lock on view level and not table level, hence it would teoretically be possible to access the same record simultaneously in both views. I don't think that would be much of a problem since one of the views is read only, but still I would test this scenario.

Edited by: Alejandro Bindi on Feb 18, 2012 5:29 AM

Well out of curiosity I tested this. The lock is set on table level, and read only views don't set locks.

So the only problem would be on the read only view, since you could be viewing records which were modified or deleted from the editing view. That's all there is to it.

Edited by: Alejandro Bindi on Feb 18, 2012 6:26 AM

0 Kudos
632

Hi Alejandro,

How can we create two maintenance generators for a single transparent table?

0 Kudos
632

What I'm suggesting is that you create two Maintenance Views (another type of View, similar to Database Views) pointing to the same database table. For each view you can restrict the visible fields, specify if the view allows Changes or not, and also generate their own maintenance dynpros for SM30. So you can maintain or read the same table but using two different views to do so.

It seems to me that this is a lot simpler and safer than all the other alternatives you mention. Modifying the generated program must be avoided if possible.

The alternative Vijay mentions is also valid (calling function VIEW_MAINTENANCE_CALL after some AUTHORITY-CHECKs).

Edited by: Alejandro Bindi on Feb 20, 2012 5:22 PM

0 Kudos
632

I think Alejandro's solution is the best. You will have two separate transactions and table maintenance generators to maintain two different views. And you can assign each transaction to different roles or authorization objects, so you don't need to do any programming.

Rob

0 Kudos
632

Many thanks to all of you.

I have finally made a Type 1 program and made use of FM "VIEW_MAINTENANCE_CALL"

I tried to implement Alejandro's solution but i could not see an option to create 2 Maintenance dialogs for the same database table(Neither through SE54 nor SE11).

0 Kudos
632

I think you can create as many views as you want for a table and then create separate TMGs for each.

Rob

0 Kudos
632

Hi Rob,

For database and projection view's we have Table Maintenance Generator in hidden mode.

0 Kudos
632

Please read http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21ec5d446011d189700000e8322d00/frameset.htm

There are four types of views: Database, Projection, Help and Maintenance views.

You have to create Maintenance, not Database or Projection views. Each of them has their own generator.