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

Reg Database view

Former Member
0 Likes
1,340

Dear all

How to mark key field while creating view?

BCOZ , when i am trying to create , all filesds are marked as key filed by default??

Very very urgent

Regards

karthik

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
892

Hi,

How to mark key field while creating view?

The key fields of the table should be marked in a view.

U can see check boxes indicating the key fields.

check them for the key fields and all the key fields must be placed at the top of the filed list.

BCOZ , when i am trying to create , all filesds are marked as key filed by default??

If u click on the relation ship button at the bottom all the key fields will be checked automatically.

For example see the following.

Creating a Database View

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.

Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.

Keep in mind that you can only include transparent tables in a database view.

Link the tables with join conditions.

If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys (see Foreign Key Relationships and Join Conditions).

Place the cursor on a table name and choose Relationships. All foreign keys to other tables defined for this table are displayed. Select the foreign keys and choose Copy. The join condition is now derived from the definitions in the foreign key.

If you only want to see the foreign key relationship existing between two tables, you must first select these two tables (click on the first column of the input area Tables) and then choose Relationships.

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. All the fields contained in this table are displayed. You can copy fields by selecting them in the first column and choosing Copy.

You can also include an entire table in the view (see Includes in Database Views).

On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to 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.

With Goto ® Technical settings, you can (optionally) maintain the technical settings of the database view.

You can define whether and how the database view should be buffered here. Proceed as for the technical settings of a table (see Maintaining Technical Settings). Note that only the settings for buffering can be maintained for database views.

On the Maintenance status tab page, select the maintenance status of the database view.

If the view contains more than one table, the maintenance status read only cannot be altered.

Save your entries. You are asked to assign the view a development class.

You can change this development class later with Goto ® Object directory entry.

Choose .

Result

When a database view is activated, the corresponding view is also automatically created in the database if the base tables of the view were already created there.

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

If the base tables are not yet created in the database, this is recorded in the activation log. The view is nevertheless activated in the ABAP Dictionary. In this case you can create the relevant view on the database later with the database utility.

Other Options

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

Change data element of a view field: Select the Mod (Modify) column in the View fields tab page. 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.

Display view data: With Utilities ® Contents you can determine which data can be selected with the view.

Display create statement: With Extras ® CREATE statement you can display how the view was created in the database. The statement that was executed when the version of the view currently being edited was created in the database is displayed.

Check the definition of the view in the database: With Utilities ® Database object ® Check you can determine whether the definition of the view in the database is consistent with the active version of the view. With Utilities ® Database object ® Display you can display the definition of the view in the database.

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

4 REPLIES 4
Read only

Former Member
0 Likes
893

Hi,

How to mark key field while creating view?

The key fields of the table should be marked in a view.

U can see check boxes indicating the key fields.

check them for the key fields and all the key fields must be placed at the top of the filed list.

BCOZ , when i am trying to create , all filesds are marked as key filed by default??

If u click on the relation ship button at the bottom all the key fields will be checked automatically.

For example see the following.

Creating a Database View

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.

Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.

Keep in mind that you can only include transparent tables in a database view.

Link the tables with join conditions.

If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys (see Foreign Key Relationships and Join Conditions).

Place the cursor on a table name and choose Relationships. All foreign keys to other tables defined for this table are displayed. Select the foreign keys and choose Copy. The join condition is now derived from the definitions in the foreign key.

If you only want to see the foreign key relationship existing between two tables, you must first select these two tables (click on the first column of the input area Tables) and then choose Relationships.

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. All the fields contained in this table are displayed. You can copy fields by selecting them in the first column and choosing Copy.

You can also include an entire table in the view (see Includes in Database Views).

On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to 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.

With Goto ® Technical settings, you can (optionally) maintain the technical settings of the database view.

You can define whether and how the database view should be buffered here. Proceed as for the technical settings of a table (see Maintaining Technical Settings). Note that only the settings for buffering can be maintained for database views.

On the Maintenance status tab page, select the maintenance status of the database view.

If the view contains more than one table, the maintenance status read only cannot be altered.

Save your entries. You are asked to assign the view a development class.

You can change this development class later with Goto ® Object directory entry.

Choose .

Result

When a database view is activated, the corresponding view is also automatically created in the database if the base tables of the view were already created there.

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

If the base tables are not yet created in the database, this is recorded in the activation log. The view is nevertheless activated in the ABAP Dictionary. In this case you can create the relevant view on the database later with the database utility.

Other Options

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

Change data element of a view field: Select the Mod (Modify) column in the View fields tab page. 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.

Display view data: With Utilities ® Contents you can determine which data can be selected with the view.

Display create statement: With Extras ® CREATE statement you can display how the view was created in the database. The statement that was executed when the version of the view currently being edited was created in the database is displayed.

Check the definition of the view in the database: With Utilities ® Database object ® Check you can determine whether the definition of the view in the database is consistent with the active version of the view. With Utilities ® Database object ® Display you can display the definition of the view in the database.

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

Read only

Former Member
0 Likes
892

Hi,

U should observe that there is a relation key button,

u has to click that button to see view the relation between the tables

The key fields of the table should be marked in a view.

U can see check boxes indicating the key fields.

check them for the key fields and all the key fields must be placed at the top of the filed list.

when i am trying to create , all filesds are marked as key filed by default??

If u click on the relation ship button at the bottom all the key fields will be checked automatically.

Input/output fields can be either conventional fields in which the user can enter values using the keyboard or by selecting from a value list, or checkboxes or radio buttons, for which the mouse is required. All input/output fields have a name linking them to a screen field. The data type of the screen field determines the input format. For example, you cannot enter letters in a numeric field. The screen recognizes when you try to enter invalid values. Radio buttons and checkboxes always have the data type char and length 1. A selected radio button or checkbox has the value ‘X’, when empty, both have the value space.

The ABAP program must contain identically-named data objects that correspond to the screen fields, otherwise data may be lost (see Linking ABAP Strings to Screen Fields) The ABAP data types that correspond to the screen data types are listed in a table in the Data Types in the ABAP Dictionary section. The ABAP fields for checkboxes and radio buttons must have type c and length one.

After the PBO event has been processed, the screen fields are filled with the values from the ABAP fields. Before or during the PAI event, the values from the screen fields are written to the ABAP fields. Note that only one radio button within a group can be selected. If more than one of the fields contains the value ‘X’, the program terminates.

To ensure that screen fields and ABAP fields always correspond exactly, use the following procedure

Rewards points if helpful.

Read only

Former Member
0 Likes
892

Hi,

The system automatically derives the key of a view from the key fields

of the tables involved in the view and the join conditions.

While creating view, all fields form the tables selected as Primary Key fields. select the required fields only.

Read this it woul be helpful.

Creating a Maintenance View

Enter the name of the view in the initial screen of the ABAP Dictionary, select object class Views and choose Create. A dialog box appears, in which you must choose the type of the view. Select the type Maintenance view.

The maintenance screen for maintenance views appears. You will see three input areas for tables, join conditions and view fields. Carry out the following actions in this screen:

Enter a short explanatory text in the field Short text.

In Tables, enter the primary tables of the view.

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

Position the cursor on the primary table and choose Relationships. All existing foreign key relationships of the primary table are displayed. Check the foreign keys you require and choose Copy. The secondary tables involved in such a foreign key are included in the view. The join conditions derived from the foreign keys ( Foreign Key Relationship and Join Condition) are displayed.

You can also include tables which are linked to one of the previously included secondary tables with a foreign key. To do this, position the cursor on the secondary table and choose Relationships. Then proceed as described above.

You can only select foreign keys in which the secondary table for the primary table or for the secondary table which transitively preceded it is in an n:1 relationship. This is the case if the secondary table is the check table of the base table and the foreign key was not defined generically. If the base table is the check table, the foreign key fields must be key fields of a text table or the foreign key must have cardinality of n:1 or n:C.

The foreign keys violating these conditions are displayed at the end of the list under the header Relationships with unsuitable cardinality.

Select the fields which you want to include in the view.

You can enter the field names directly. If you do not know the field names, you can copy them from the tables. To do this, position the cursor on a table and choose TabFields. The fields of the table are now displayed in a dialog box. You can copy fields from here by marking the first column and choosing on Copy.

Formulate the selection conditions. To do this choose Goto ® Selection condition. The input area for the selection conditions appears in place of the input areas for the fields. Maintain the selection condition as described in Maintaining the Selection Condition for a View. You can then switch back to the fields display with Goto ® View fields.

Activate the view with View ® Activate. A log is written during activation. You can display it with Utilities ® Activation log. If errors or warnings occurred during the activation of the view, you branch directly to the activation log.

Create the documentation for the view with Goto ® Documentation. This documentation is output for example when you print the view with View ® Print.

Branch to transaction SE54 with Environment ® Tab.maint.generator. From the view definition you can generate maintenance modules and maintenance interfaces there which distribute the data entered with the view to the base tables. You can find more information about using this transaction in the documentation Generating the Table Maintenance Dialog.

Optional Settings

You can make the following optional settings:

Change data element of a view field:

Select the Mod column (modify) for the view field and choose Enter. The Data element field is now ready for input. Enter the new data element there. This data element must refer to the same domain as the original data element. With the F4 help key for the Data element field, you can display all the data elements which refer to the domain of the field. If you want to assign the original data element again, you only have to reset the Mod flag and choose Enter.

Change maintenance status:

The Maintenance Status defines how you can access the view data with the standard maintenance transaction (SM30). Choose Extras ® Maintenance status. A dialog box appears in which you can select the maintenance status of the view.

Define the delivery class of the view:

Choose Extras ® Delivery class. A dialog box appears in which you can enter the delivery class of the maintenance view.

Define the maintenance attribute of a view field

The maintenance attribute defines special access modes for the fields of the view. You can make the following entries in field F in the input area for the view fields:

R : Only purely read accesses are permitted for fields with this flag. Maintenance with transaction SM30 is not possible for such fields.

S : Fields with this flag are used to create subsets when maintaining view data. Only a subset of the data is displayed. This subset is defined by entering the corresponding value in this field.

H : Fields with this flag are hidden from the user during online maintenance. They do not appear on the maintenance screen. You have to ensure in a separate procedure that each such field has the correct contents. Otherwise, they are left empty.

: There are no restrictions on field maintenance.

Check functions:

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

Display foreign key of a view field:

If a foreign key which was automatically included in the view definition is defined for the field of the base table, you can display it. To do so, position the cursor on the view field and choose Extras ® Foreign keys.

Display foreign key on which a join condition is based:

If a join condition was derived from a foreign key, you can display its definition. To do so, position the cursor on the join condition and choose Extras ® Foreign keys.

Regards,

Raj.

Read only

Former Member
0 Likes
892

Thnx