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

Maintenance View Validations

Former Member
0 Likes
4,440

I have a custom table for which I am maintaining a Maintenance View.

I want to provide some validations and checks on the fields entered by the user in that maintenance view.

For example, if the user enters a value greater than 1000 in quantity field, I want to display a message saying that " enter only values below 1000". This is part of customer requirement.

Can I provide validations on fields in Maintenance view and if yes, then how ?

Thanks,

Urmila

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,505

Hi Urmila....

U can very well give such validations at the view level. there are certain event-handlers for the same.

In the table Maintenance screen, follow the menu path:

Environment>Modification>Events

Click on the new entries in the screen. Select a desired dialog event. (in ur case as u need it on entery of new fields , use the event 05). Now specify a form routine name.

On clicking on the editor , a new include name is proposed. Select the desired one and you can insert your lines of code here.

Write the code inside a “FORM…. ENDFORM”, since these routines are dynamically called corresponding to the dialog events we have specified.

Hope this helps.

5 REPLIES 5
Read only

Former Member
0 Likes
2,505

its better to do it through enhancements like badi.

Read only

Former Member
0 Likes
2,505

Hi Urmila,

Are you familiar with dialog/module pool programming? If you are then the solution is simple.

When you create a table maintenance for a Z table, you create it under a Z function group. You also assign a screen number which contains the data entry table control.

All you need to do is, change the PAI module of the screen in the function group, e.g. in the LOOP...ENDLOOP. in PAI, add a module and perform your validations within the module.

There is another way, i.e. modification events. But try the first (above) method.

Regards,

Aditya

Read only

Former Member
0 Likes
2,505

Hi this may help u.

Maintenance views offer easy ways to maintain complex application objects.

Data distributed on several tables often forms a logical unit, for example an application object, for the user. You want to be able to display, modify and create the data of such an application object together. Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables.

A maintenance view permits you to maintain the data of an application object together. The data is automatically distributed in the underlying database tables. The maintenance status determines which accesses to the data of the underlying tables are possible with the maintenance view.

All the tables in a maintenance view must be linked with foreign keys, that is the join conditions for maintenance views are always derived from the foreign key (see Foreign Key Relationship and Join Condition). You cannot directly enter the join conditions as for database views.

There are some restrictions for the attributes of the foreign keys with which the tables in a maintenance view can be linked (see Restrictions for Maintenance and Help Views).

A standardized table maintenance transaction is provided (SM30), permitting you to maintain the data from the base tables of a maintenance view together.

Maintenance mechanisms, like screens and processing programs, must be created from the view definition with the transaction Generate Table View (SE54). This makes it possible to create easy-to-use maintenance interfaces in a simple manner.

You can find out how to create such maintenance mechanisms in the documentation BC - Generate Table Maintenance Dialog.

Creating Maintenance Views

Procedure

Enter an explanatory short text in the field Short text.

You can for example find the view at a later time using this short text.

Enter the primary table of the view under Tables in the Tables/Join conditions tab page.

Only those tables that are linked with the primary table (indirectly) with a foreign key can be included in the maintenance view.

If required, include more tables in the view. In a maintenance view you can only insert tables that are linked to one another with foreign keys.

Place the cursor on the primary table and choose Relationships. All existing foreign key relationships of the primary table are displayed. Select the required foreign key and choose Copy. The secondary table used in such a foreign key is included in the view. The join conditions derived from the foreign keys (see Foreign Key Relationship and Join Condition) are displayed.

You can also insert tables that are linked by foreign key with one of the secondary tables that was already inserted. To do this, place the cursor on the secondary table and choose Relationships. Then proceed as described above.

For maintenance and help views, there are certain restrictions on the foreign keys with which the tables can be included in the view (see Restrictions for Maintenance and Help Views). The foreign keys violating these conditions are displayed at the end of the list under the header Relationships with unsuitable cardinality.

On the View fields tab page, select the fields that you want to copy to the view.

Choose Table fields. All the tables contained in the view are displayed in a dialog box. Select a table. The fields of the table are now displayed in a dialog box. You can copy fields by selecting them in the first column and choosing Copy.

All key fields of the primary table must be included in a maintenance view. In addition, all key fields of secondary tables that are not involved in the foreign key (that is, which are not linked via a join condition to a key field already included in the view) must be included in the view.

This ensures that the records inserted with a maintenance view can be written correctly in the tables contained in the view.

On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records that can be displayed with the view (see Maintaining Selection Conditions for Views).

The selection conditions define the data records that can be selected with the view.

In the Maintenance status tab page, define the maintenance status of the view.

The maintenance status defines how you can access the view data with the standard maintenance transaction (SM30).

Choose .

At activation, a log is written; it can be displayed with Utilities ® Activation log. If errors or warnings occurring when the view was activated, the activation log is automatically displayed.

Go to Transaction SE54 with Environment ® Tab.maint.generator.

From the view definition you can generate maintenance modules and maintenance interfaces that distribute the data entered with the view to the base tables of the view. You can find more information in Creating a Maintenance Dialog.

Other Options

Recording documentation: You can create information about using the view with Goto ® Documentation. This documentation is output for example when you print the view.

Changing the data element of a view field: Select column Mod (modification) for the view field. The Data element field is now ready for input. You can enter a data element that refers to the same domain as the data element of the assigned table field here. Cancel the Mod flag if you want to use the data element of the assigned table field again.

Enter the delivery class of the view: In the Maintenance status tab page, select the delivery class of the maintenance view. If you assign the delivery class G or E to the view, you must also maintain a customer namespace (key block) for the view entries. To navigate to the appropriate maintenance transaction, choose Define Customer Namespace.

Entering the maintenance attributes of the view field: In the View fields tab page you can define the Maintenance Attributes of the view field in column F.

Check functions: With Extras ® Runtime object ® Check you can determine whether the definition of the view in the ABAP Dictionary maintenance screen is identical to the definitions in the runtime object of the view. With Extras ® Runtime object ® Display you can display the runtime object of the view.

table maintai9nenece generator

The Table Maintenance Generator is used to create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator.

Table maintenance allows you to create entries for that table

Follow these steps to generate table maintenance

1) Go to SE11 and check table maintanance check box under attributes tab.

2) Go to menu Utilities -> Table Maintanance Generator ->

Create function group and assign it under function group input box. You can enter same as table name for function group. Also assign authorization group default &NC& .

3) Select standard recording routine radio in table table mainitainence generator to move table contents to quality and production by assigning it to request.

4) Select maintenance type as single step.

5) Maintainence screen as system generated numbers this dialog box appears when you click on create button.

6) Save and activate table.

useful links

http://www.saptechies.com/how-to-create-table-maintenance-generator/

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecdf446011d189700000e8322d00/content.htm

http://www.saptechies.com/table-maintainance-generator/

with regards,

Hema Sundara.

pls reward if u find it helpful.

Read only

Former Member
0 Likes
2,505

Hi Urmila,

You gave function group while creating maintenance. open function group in T.Code se80. you will get screen in node 'screen' which you gave. you can modify the screen as well as flow logic. add your coding for additional validation.

L.Velu.

Read only

Former Member
0 Likes
2,506

Hi Urmila....

U can very well give such validations at the view level. there are certain event-handlers for the same.

In the table Maintenance screen, follow the menu path:

Environment>Modification>Events

Click on the new entries in the screen. Select a desired dialog event. (in ur case as u need it on entery of new fields , use the event 05). Now specify a form routine name.

On clicking on the editor , a new include name is proposed. Select the desired one and you can insert your lines of code here.

Write the code inside a “FORM…. ENDFORM”, since these routines are dynamically called corresponding to the dialog events we have specified.

Hope this helps.