Application Development and Automation 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: 
Read only

SM30 Defaulting values

Former Member
0 Likes
3,506

Hi

I am using a custom Z transaction for maintaining my table. This comes up with a selection screen where the user gets to choose one of 4 values for a field in the table (ID). Based on the selection, only the relevant entries are displayed in the SM30 screen.

However when the user wants to make new entries he has the option to pick any of those 4 values in the drop down for ID field. I want the ID field to default the value selected in the 1st selection screen.

Any ideas? I tried looking at form maintenance routines but none of the events trigger prior to clicking on "New Entries".

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,683

One approach can be that you create a maintenance view for this table hiding the ID field. Fill up the value of that field with the user selected ID from the initial screen in one of the events (typically I have used before saving event). Are you calling VIEW_MAINTENANCE_CALL function module or are you calling the transaction SM30? Use the function module, you will have better control.

8 REPLIES 8
Read only

Former Member
0 Likes
2,683

Did you try event 05?

Read only

Former Member
0 Likes
2,683

Yes, I've tried event 05. It gets triggered too late

Read only

Former Member
0 Likes
2,683

Even though you default it, the user can still change it unless you are passing the ID as a restriction in the initial screen of SM30. In that case, even if the user tries to select the other values, it will not allow them to. Is that what you are currently seeing?

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,683

Hi Suparna,

I too had a similar problem. We solved it in the following manner:

Create a Domain with the 4 values as your default values.

Sounds simple & it works. Does it satisfy ur requirement ?

Please reward points if helpful.

Suhas ...

Read only

Former Member
0 Likes
2,684

One approach can be that you create a maintenance view for this table hiding the ID field. Fill up the value of that field with the user selected ID from the initial screen in one of the events (typically I have used before saving event). Are you calling VIEW_MAINTENANCE_CALL function module or are you calling the transaction SM30? Use the function module, you will have better control.

Read only

Former Member
0 Likes
2,683

I am using the FM View Maintenance call. I am passing the user selected value to this FM so that it will display only table entries corresponding to the user selection.

The issue is to retain this value and determining where to pass it when the user tries to make new entries. Right now, he can choose any of the 4 values and he gets an unhelpful message " Specify key within workarea" if he tries to enter values for a field other than the one he selected initially.

Read only

0 Likes
2,683

Exactly that is what will happen when you are passing values to this call. It is nothing but the same way SM30 works where you have the restrictions option. Once you have restrictions, any new entries that you insert should also follow the same restrictions. So the best thing to do is to hide that column altogether since your user already decided which ID to use upfront and any new entries should be made only for that ID not for any other IDs.

Read only

Former Member
0 Likes
2,683

Oh ok, I get your point. To me that sounds like a great idea, let me run it by the "Superuser" and see what they have to say. Thanks