2014 Jun 19 2:58 PM
Hi,
I have a custom table with some 10 fields.When users assigned to a particular role acess the maitenance view of the table to edit the contents, they should only be allowed to change the contents of 3 fields.
Can this restriction be done using the table events without changing the attributes in the screen painter and coding in the PBO to modify screen ? . The changes done in the PBO would be lost once a new field is added to the table and maitenence screen is regenerated and so looking if there is any alternate way to do it.
Any hint would be helpful.
Thanks
Kavitha
2014 Jun 19 5:56 PM
Kavitha,
I guess one option could be to modify table x_namtab in event19 (After initializing global variables, field symbols, etc.)
LOOP AT x_namtab.
* if Criteria Matches.
x_namtab-readonly = 'R'. " Set field to Read only.
MODIFY x_namtab.
* endif.
ENDLOOP.
Hope this helps,
Thanks,
VM.
Hi,
I have a custom table with some 10 fields.When users assigned to a particular role acess the maitenance view of the table to edit the contents, they should only be allowed to change the contents of 3 fields.
Can this restriction be done using the table events without changing the attributes in the screen painter and coding in the PBO to modify screen ? . The changes done in the PBO would be lost once a new field is added to the table and maitenence screen is regenerated and so looking if there is any alternate way to do it.
Any hint would be helpful.
Thanks
Kavitha
2014 Jun 19 5:56 PM
Kavitha,
I guess one option could be to modify table x_namtab in event19 (After initializing global variables, field symbols, etc.)
LOOP AT x_namtab.
* if Criteria Matches.
x_namtab-readonly = 'R'. " Set field to Read only.
MODIFY x_namtab.
* endif.
ENDLOOP.
Hope this helps,
Thanks,
VM.
2014 Jun 19 6:30 PM
Hi Kavitha,
You can do it by using the events in table maintenance generator.
Try and let me know if you need any help..
2014 Jun 20 5:55 AM
Hi,
Table Maintenance Events
The value to be displayed on the maintenance screen for any field can also be altered as per the requirement like for every new entry in the table one of the field should have the constant value appearing automatically. For this purpose, the event needs to be chosen which performs the action. In this case event "05 creating a new entry".
List of Events available in Table maintenance
01 Before saving the data in the database
02 After saving the data in the database
03 Before deleting the data displayed
04 After deleting the data displayed
05 Creating a new entry
06 After completely performing the function 'Get original'
07 Before correcting the contents of a selected field
08 After correcting the contents of a selected field
09 After getting the original of an entry
10 After creating the header entries for the change task (E071)
11 After changing a key entry for the change task (E071K)
12 After changing the key entries for the change task (E071K)
13 Exit editing (exit main function module)
14 After lock/unlock in the main function module
15 Before retrieving deleted entries
16 After retrieving deleted entries
17 Do not use. Before print: Event 26
18 After checking whether the data has changed
19 After initializing global variables, field symbols, etc.
20 after input in date sub screen (time-dep. tab. /views)
21 Fill hidden fields
22 Go to long text maintenance for other languages
23 Before calling address maintenance screen
24 After restricting an entry (time-dep. tab./views)
25 Individual authorization checks
26 Before creating a list
27 After creation or copying a GUID (not a key field)
28 After entering a date restriction for time-dep. views
AA Instead of the standard data read routine
AB Instead of the standard database change routine
AC Instead of the standard 'Get original' routine
AD Instead of the standard RO field read routine
AE Instead of standard positioning coding
AF Instead of reading texts in other languages
AG Instead of 'Get original' for texts in other languages
AH Instead of DB change for texts in other languages
ST GUI menu main program name
AI Internal use only
2014 Jun 20 6:08 AM
Hi Kavitha,
Please follow the best simplest Approach,
When you open the table maintainence screen, the screen same as in any Module Pool Program,
then navigate to element list tab beside attributes Tab, then check the checkbox with header text, output only and your required approach will be fulfilled.
Please validate the same at your end as well, let me know in case any further inputs from my end are required.
BR/Thanks
Pranav Agrawal
2014 Jun 23 1:52 PM
hi,
I was able to do it using the x_namtab in the event . thanks Venkat Muthyala
for the tip
Thanks Kavitha
2019 Aug 26 7:43 AM
Hi
Defining fields to be non-editable in TMG can be achieved usingUtilizing maintenance screen for the manipulation of fields can be easy but as known for every regeneration of TMG would cause the settings of Maintenance screen to be erased and implementing all settings would be inefficient so embrace using Events.
Case scenario
Before making the fields non-editable

Steps to be followed to make fields non-editable using events

Go to SM30 -> maintain-> new entries-> you get the required format ( if you are debugging execute the steps and then go to SM30
Case scenario
After making the fields non-editable

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
FORM znon_edit.
LOOP AT x_namtab.
CASE x_namtab-viewfield.
WHEN 'RE_BDRE_ID'.
x_namtab-readonly = 'R'. " Set field to Read only.
MODIFY x_namtab.
WHEN 'LAST_UPDATE_DATE'.
x_namtab-readonly = 'R'. " Set field to Read only.
MODIFY x_namtab.
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
ENDCASE.
ENDLOOP.
ENDFORM.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |