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: 

Creating a custom table

Former Member
0 Kudos

Hi guys,

I am creating a custom table in 4.6c.

I want to create a maintenance view for the custom table for a transaction.

Hw do i do this?

thanks and regards,

Frank.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Go to ABAP Dictionary: Initial Screen (Transaction Code SE11).

Select the ‘View’ radio button.

Then, type in a custom name for the View.

Click on the create button.

Four different view types are supported. These differ in the way in which the view is implemented and in the methods permitted for accessing the view data.

Database views are implemented with an equivalent view on the database.

Projection views are used to hide fields of a table (only projection).

Help views can be used as selection method in search helps.

Maintenance views permit you to maintain the data distributed on several tables for one application object at one time. Database views implement an inner join. The other view types implement an outer join.

Choose a View Type in this Pop-up screen. If the desired fields are from multiple tables choose DATABASE as the view type. If the desired fields are from a single table choose PROJECTION as the view type.

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

For DATABASE view there will be one primary table and there can be zero, one or more secondary tables. The first table listed is automatically considered as the other primary table. List any desired secondary tables immediately after the primary table.

If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys

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.

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

On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to be displayed with the view.The selection conditions define the data records that can be selected with the view.

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 Package.

Activate the view.

Assign points if useful.

Regards

(YUGANDHAR.P)

Former Member
0 Kudos

In the initial screen of the ABAP Dictionary, select object class Database table, enter the table name and choose Create.

The maintenance screen for the table is displayed.

Enter an explanatory short text in the field Short text.

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

On the Delivery and Maintenance tab, enter the delivery class of the table.

On this tab, choose an entry from the dropdown box for the Data Browser/Table View Maintenance field. Choose Table maintenance allowed on this tab page if users with the corresponding authorization may change the data in the table using the Data Browser (Transaction SE16). For more information refer to the available options in Data Browser/Table View Maintenance.

On the Fields tab page, enter the table fields. Perform the following steps for each table field:

Enter a name for the table field in the column Fields. The field name may only contain letters, digits and underlining, and it must begin with a letter. A field name may not be longer than 16 characters.

Select the Key column if the field should be part of the table key.

Enter the name of a data element in field Field type. In this case the field takes the data type, length, decimal places and short text from this data element. If there is no suitable data element, you can go to the data element maintenance screen by entering a name and double-clicking.

With Data element/Direct type, you can directly enter the data type, field length, decimal places and short text. Press this key again if you want to enter data elements for further fields.

Only a limited functionality is provided for fields without data elements. No foreign keys or fixed values may be defined for such fields, and there is no F1 help.

You must also define the reference field and reference table on tab page Currency/quantity fields for fields of types CURR (currency) and QUAN (quantity)

You also can include the fields of an existing structure in the table. Note that the field names in the structure may not be longer than 16 places in this case.

Maintain the technical settings for the table. The corresponding maintenance screen is displayed with Goto ® Technical settings.

The technical settings are a separate object and can be activated and transported separately from the table.

Maintain (if necessary) the foreign key relationships of the table to other tables.

The corresponding maintenance screen is displayed if you place the cursor on the check field and choose .

Create (if necessary) secondary indexes for the table.

To do this choose Goto ® Indexes.

Save the table.

A dialog box appears in which you have to assign the table a development class.

For tables with the Delivery Class G or E, you must also maintain a customer namespace (key block of the table) for the table entries. SAP cannot change table entries or import new entries in the customer namespace during upgrades. To navigate to the appropriate maintenance transaction, choose Define Customer Namespace on the Attributes tab.

Choose an enhancement category. For more information, see Structure Enhancements.

Choose .

Result

During activation, the table and all the indexes on the table are automatically created in the database (if not explicitly excluded when the index was defined). You can display the table definition in the database with Utilities ® Database object ® Display.

At activation, the runtime object for the table is also created. You can display the runtime object with Utilities ® Runtime object ® Display.

You can find information about the activation flow in the activation log, which you can display with Utilities ® Activation log. The activation log is displayed automatically if errors occur when the table is activated.

Other Options

Assign a search help to a field: You can assign a search help to a field with Goto ® Search help ® For field. The search help can be used by all screen fields that refer to this field. See Attaching a Search Help to a Table or Structure Field.

Assign a search help to a table: You can assign a search help to a table with Goto ® Search help ® For table. This search help can be used by all screen fields that are checked against the table. See Attaching a Search Help to a Check Table.

Create documentation: With Goto ® Documentation you can create a text that describes the use of the table and maintenance of the table data more precisely.

Assign activation type: With Extras ® Activation type you can assign the table an activation type. This is only relevant for tables in the runtime environment.

Enter or display data: If you set the Table maintenance allowed flag, you can enter data in the table with Utilities ® Table contents ® Create entries. You can display existing data with Utilities ® Table contents ® Display.

Constraints

All the key fields of a table must be stored together at the beginning of the table. A non-key field may not occur between two key fields.

A maximum of 16 key fields per table is permitted. The maximum length of the table key is 255.

If the key length is greater than 120, there are restrictions when transporting table entries. The key can only be specified up to a maximum of 120 places in a transport. If the key is larger than 120, table entries must be transported generically.

A table may not have more than 249 fields. The sum of all field lengths is limited to 1962 (whereby fields with data type LRAW and LCHR are not counted).

Fields of types LRAW or LCHR must be at the end of the table. Only one such field is allowed per table. There must also be a field of type INT2 directly in front of such a field. The actual length of the field can be entered there by the database interface.

In the field maintenance screen of the table, select the check field and choose

If the domain of the check field has a value table, you can have the system create a proposal with the value table as check table. In this case a proposal will be made for the field assignment in the foreign key.

If the domain does not have a value table or if you reject the proposal, the screen for foreign key maintenance appears without proposals. In this case, enter the check table and save your entries. The check table must have a key field to which the domain of the check field is assigned.

You can then let the system make a proposal for assigning of the foreign key fields to the key fields of the check fields. The system attempts to assign the key fields of the check table to fields of the table with the same domain. If you do not want a proposal, the key fields of the check table are listed and you must assign them to suitable fields of the foreign key table.

Enter an explanatory short text in the field Short text.

The short text provides a technical documentation of the meaning of the foreign key.

Choose Copy. The foreign key is saved and you return to the maintenance screen for the table.

Other Options

Remove fields from the assignment: You can remove foreign key fields (with the exception of the check field) from the assignment to the key fields of the check table (see Generic and Constant Foreign Keys).

Select Generic to remove a field from the check against the key fields of the check table. If you want to assign a constant to a foreign key field, you must enter it in the Constant field enclosed in apostrophes (for example ‘Constant ’ ). In both cases you must remove the entries in fields For. key table and Foreign key field.

Deactivate value check: If the foreign key should not be used for a value check, cancel the selection in the Check required field. This definition is valid for all screens in which the field appears. It could be advisable to deactivate the check for example if the foreign key is only used to define maintenance views, help views or lock objects.

Assign a message: A standard message is output if the value check by the foreign key on the screen field results in an invalid input. You can replace this standard message with any message. To do this, you must enter the message class of the message in the field AArea and the message number in the field MsgNo. See Error Message in the Foreign Key Check.

Semantic attributes: Optionally you can define the semantic attributes of the foreign key. These are primarily for documentation purposes.

If the foreign key is derived from a field of an included table or structure (see Includes), the Inherited from the include flag is also displayed. Foreign key definitions are usually inherited from the included table or structure to the including table or structure, so that the foreign key depends on the definition in the included table.

The flag is normally set. If you cancel the selection, the link between the foreign key and the included table or structure is canceled. The foreign key no longer adjusts itself when its definition in the included table or structure changes.

In the field maintenance screen of the table, choose Technical settings.

The maintenance screen of the technical settings appears.

Select the data class and size category of the table.

The input help for the Size category field shows how many data records correspond to the individual categories.

The buffering permission defines whether the table may be buffered.

If you permitted table buffering, define the buffering type of the table.

You can find further information about when to buffer tables and what buffering type you should choose in Buffering Database Tables.

Select Log data changes if you want to log changes to data records of the table (see Logging).

To log changes, system logging must be switched on with the profile parameter rec/client. The Log data changes flag on its own does not cause the table changes to be logged!

Choose .

Errors that occurred during activation are displayed in the activation log.

Other Options

The Convert to transparent table flag is displayed for pooled tables (and tables that were converted to a transparent table with this flag at an earlier time). You can convert the pooled table to a transparent table with this flag (see Converting Pooled Tables to Transparent Tables).

Constraints

If the key length of the table is larger than 64, the table cannot be buffered generically.

If the key length of the table is larger than 120, the table cannot be buffered.

If the key of the table has more than 86 places or the data part of the table has more than 500 places, it is not possible to log the table.

In the maintenance screen of the table, choose Indexes.

If indexes already exist on the table, a list of these indexes is displayed. Choose .

In the next dialog box, enter the index ID and choose

The maintenance screen for indexes appears.

Enter an explanatory text in the field Short text.

You can then use the short text to find the index at a later time, for example with the R/3 Repository Information System.

Select the table fields to be included in the index using the input help for the Field name column.

The order of the fields in the index is very important. See What to Keep in Mind for Secondary Indexes.

If the values in the index fields already uniquely identify each record of the table, select Unique index.

A unique index is always created in the database at activation because it also has a functional meaning (prevents double entries of the index fields).

If it is not a unique index, leave Non-unique index selected.

In this case you can use the radio buttons to define whether the index should be created for all database systems, for selected database systems or not at all in the database.

Select for selected database systems if the index should only be created for selected database systems.

Click on the arrow behind the radio buttons. A dialog box appears in which you can define up to 4 database systems with the input help. Select Selection list if the index should only be created on the given database systems. Select Exclusion list if the index should not be created on the given database systems. Choose .

Choose .

Result

The secondary index is automatically created in the database during activation if the corresponding table was already created there and index creation was not excluded for the database system.

You can find information about the activation flow in the activation log, which you can call with Utilities ® Activation log. If errors occurred when activating the index, the activation log is automatically displayed.

The delivery class controls the transport of table data for installation, upgrade, client copy and when transporting between customer systems. The delivery class is also used in the extended table maintenance.

There are the following development classes:

A: Application table (master and transaction data).

C: Customer table, data is only maintained by the customer.

L: Table for storing temporary data.

G: Customer table, SAP may insert new data records but may not overwrite or delete existing ones. The customer namespace must be defined in table TRESC. To define the customer namespace use report RDDKOR54. You can start it directly from the table maintenance by choosing Customer namespace definition on the Attributes tab.

E: System table with its own namespace for customer entries. The customer namespace must be defined in table TRESC. To define the customer namespace use report RDDKOR54. You can start it directly from the table maintenance by choosing Customer namespace definition on the Attributes tab.

S: System table, data changes have the status of program changes.

W: System table (e.g. table of the development environment) whose data is transported with its own transport objects (e.g. R3TR PROG, R3TR TABL, etc.).

Behavior during Client Copy

Only the data of client-dependent tables is copied.

Class C, G, E, S: The data records of the table are copied to the target client.

Class W, L: The data records of the table are not copied to the target client.

Class A: Data records are only copied to the target client if explicitly requested (parameter option). It normally does not make sense to transport such data, but this is supported nevertheless to permit the entire client environment to be copied.

Behavior during Installation, Upgrade and Language Import

The behavior of client-dependent tables differs from that of cross-client tables.

Client-Dependent Tables

Class A and C: Data is only imported into client 000. Existing data records are overwritten.

Class E, S and W: Data is imported into all clients. Existing data records are overwritten.

Class G: Existing data records are overwritten in client 000. In all other clients, new data records are inserted, but existing data records are not overwritten.

Class L: No data is imported.

Cross-Client Tables

Classes A, L and C: No data is imported.

Classes E, S, and W: Data is imported. Existing data records with the same key are overwritten.

Class G: Non-existent data records are inserted, but no existing data records are overwritten.

Behavior during Transport between Customer Systems

Data records of tables having delivery class L are not imported into the target system. Data records of tables having delivery classes A, C, E, G, S and W are imported into the target system (for client-dependent tables this is done for the target clients specified in the transport).

Use of the Delivery Class in the Extended Table Maintenance

The delivery class is also used in the Extended Table Maintenance (SM30). The maintenance interface generated for a table makes the following checks:

It is not possible to transport the entered data using the transport connection of the generated maintenance interface for tables having delivery classes W and L.

Data that is entered is checked to see if it violates the namespace defined in table TRESC. If the data violates the namespace, the input is rejected.

The activation type defines whether the table can be activated directly from the ABAP Dictionary, or whether the runtime object of the table must first be generated with a C program. This entry is optional and only important for tables of the runtime environment.

The following entries are possible for the activation type:

Tables having activation type 01 cannot be activated from the ABAP Dictionary. The runtime object must be generated using a C program. The table can then be activated from the ABAP Dictionary. This activation type ensures that important system tables cannot be changed and activated directly.

Tables having activation type 02 are also used in C programs. The data structure in the C program must therefore be adjusted manually when the table is changed. There is a relevant comment in the activation log for such tables.

Tables having activation type 10 are needed before R3TRANS runs. Such tables must exist before all other tables when upgrading.

Tables having activation type 00 can be activated directly from the ABAP Dictionary. This is the default setting for the activation type

Former Member
0 Kudos

Hi,

Go to SE 11, Utilities --> Table Maintenance Generator --> in this give the authorization group as &NC& and Function group same as the table name and Maintenance view on One Screen and save that.

After this in the same screen click on Environment and Modification and Maintenance Screen and double click on : "View Maintenace Overview screen Z...". Here u will go to the table view, change the view as per your requirement and activate that.

Thanks.