Вы находитесь на странице: 1из 40

Comparison of Transparent, Pool and Cluster tables

By YSP, Defiance technologies

Transparent Pool Cluster


Contain a single table. They are used to hold a They are used to hold
Used to store master large number of very data from a few number
data small tables(stores of large tables.(stores
customizing data or system data)
system data)
It has a one-to-one It has a many-to-one It has a many-to-one
relationship with a table relationship with a table relationship with table in
in the database in the database the database
For each transparent It is stored with other Many cluster tables are
table there is one pooled tables in a single stored in a single table
associated table in the table called table pool in in the database called a
database the database table cluster
The database table has The database table has The database table has
the same name, same different name, different different name, different
number of fields and the number of fields and number of fields and
fields have the same fields have different fields have different
names names names
There is only a single Table pools contain Contains less tables
table more tables than table than table pools
clusters
Single table can have Primary key of each Primary key of each
one or more primary key table does not begin table begins with same
with same fields or fields fields or fields
Secondary indexes can Secondary indexes Secondary indexes
be created cannot be created cannot be created
They can be accessed They can be accessed They can be accessed
using open and native using open SQL only using open SQL only
SQL
USE: They are used to USE: They reduce the USE: They would be
hold master data e.g. amount of database used when the tables
Table vendors or table resources needed when have primary key in
of customers. Example many small tables have common and data in
of transaction data is to be opened at the these tables are all
orders placed by same time accesses
customers simultaneously
Adding new values in Standard Domain
Open any domain in which you want to add new values.

In Menu, Goto->Fixed Values Append and click OK for information message.

Give Append Name and ok.

Then add new values in the value append.


Save and Activate it. If you go back to Domain, you can view your values.

Creation of a table pool and pool table


In this Tutorial, we create a Table pool first and then create/ (add a table to Table pool) a Pooled Table.

Step 1:

Go to transaction SE11. Go to Utilities à Other Dictionary Objects


Step 2:

Select Radio button Table pool/Cluster Give table Pool Name: ZTBL_POOL.

Then press F5 or choose Create.


Step 3:

Then Select Radio button Table Pool. Press Enter.

Step 4:

Then you go to maintain Poll Screen there give Short Description.


Step 5:

Then go to Technical settings.

Step 6:

In the “Maintain technical Settings” screen Provide Size category.


Save and activate the table Pool. Go back to SE11.

Step 7:

Go to SE11 ABAP Dictionary: Initial Screen.

Create a Z table.
Step 8:

Maintain Delivery and Maintenance attributes for the Z table.

Add fields to the Z table.


Maintain Technical settings and Enhancement Category.

Step 9:

Then Go to Extrasà Change table category

Step 10:

Choose Table type.


In our Example it is Pooled table.

Step 11:

Go back to Delivery and Maintenance tab and provide Pool/Cluster value.

We have successfully created Table pool and Pooled table.


Row level locking of database table
Normally if a person opens table maintenance generator and tries to maintain the table, no one
else can maintain the same table at the same time. This is because of table level lock by default
in SAP. Only one user can maintain any table at a time through SM30 or any transaction that
calls table maintenance generator. In the tutorial below we will see how to remove table level
lock and apply row level lock. This way any number of users can modify the table at same time.
But any particular row can be modified by only one user at a time. We will create a transaction
for this purpose. The transaction will call our custom report. This custom report will call the
table maintenance generator of the table after deleting table level lock.

In current example let’s create following:

Report: ZREP_SHUKS3

Transaction: ZTEST_SHUKS3

Table: ZTEST_SHUKS3 with table maintenance generator.

Using transaction ZTEST_SHUKS3 we will delete the table level lock and put row level lock so that
multiple users can maintain table at same time. Rows locked by one user will not be editable by other
user.

1. Create table ZTEST_SHUKS3.

2. Create table maintenance generator for the table.


We will make single screen maintenance for this table. Save it. So finally we have table maintenance
code automatically generated in function group ZTEST_SHUKS3.

3. Create lock object EYTSS_E433SH in SE11. Give it name as EZTEST_SHUKS3.


Now save and activate the Lock object. SAP creates two function modules corresponding to lock object
for enqueue and dequeue of the table.

4. Now create a report ZREP_SHUKS3 and transaction code ZTEST_SHUKS3 to call this report. This
tcode will call table maintenance generator of table ZTEST_SHUKS3 .
5. Normally if a person opens table maintenance generator and tries to maintain the table, no one else
can maintain table at the same time. This is because of table level lock by default in SAP. Only one
user can maintain any table at a time. In report ZREP_SHUKS3 we will delete the table level lock and
put row level lock so that multiple users can maintain table at same time. Rows locked by one user
will not be editable by other user. Check the report and comments given below.

*&---------------------------------------------------------------------*
*& Report ZREP_SHUKS3
*&
*&---------------------------------------------------------------------
*& Author : Swetabh Shukla
*& Date : 05/22/2009
*& Description : To delete table level lock from table.
*&---------------------------------------------------------------------*
REPORT zrep_shuks3.

**Selection range for view maintenance


DATA:
BEGIN OF selekttab OCCURS 1. "Selektionsbereich
INCLUDE STRUCTURE vimsellist.
DATA: END OF selekttab,

**Table of inactive CUA functions for view maintenance


BEGIN OF excl_cua_funct OCCURS 1. "inaktive CUA-Fkt bei View-Pflege
INCLUDE STRUCTURE vimexclfun.
DATA: END OF excl_cua_funct.

DATA: lt_enq_del TYPE STANDARD TABLE OF seqg3,


lt_enq_read TYPE STANDARD TABLE OF seqg7,
lw_enq_read TYPE seqg7,
lw_enq_del TYPE seqg3,
lv_subrc TYPE sy-subrc.

*Read all the lock details in system


CALL FUNCTION 'ENQUE_READ2'
EXPORTING
gclient = sy-mandt
gname = ' '
guname = '*'
TABLES
enq = lt_enq_read.

*We will search entry for table level lock for our table
LOOP AT lt_enq_read INTO lw_enq_read
WHERE gname EQ 'RSTABLE'
AND garg CS 'ZTEST_SHUKS3'.
MOVE-CORRESPONDING lw_enq_read TO lw_enq_del.
APPEND lw_enq_del TO lt_enq_del.
ENDLOOP.
*Delete table level lock entry for our table
CALL FUNCTION 'ENQUE_DELETE'
EXPORTING
check_upd_requests = 1
IMPORTING
subrc = lv_subrc
TABLES
enq = lt_enq_del.

*Now call the table maintenace generator.


CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U'
view_name = 'ZTEST_SHUKS3'
show_selection_popup = 'X'
TABLES
dba_sellist = selekttab
excl_cua_funct = excl_cua_funct.

6. Just one more change in table maintenance screen. Now open table maintenance function
group(ZTEST_SHUKS3) in SE80.We know for table maintenance SAP automatically creates code in
the function group. Now we will make some modification in that existing code to change the behavior.
Open the screen you created through table maintenance and add one module.

Open the screen 0001 and add one module in PBO of the screen as shown in figure below.
Check the code below to be added in the module m_change_locking.

MODULE m_change_locking OUTPUT.


*Call the function module corresponding to the lock object we created
CALL FUNCTION 'ENQUEUE_EZTEST_SHUKS3'
EXPORTING
matnr = ztest_shuks3-matnr
werks = ztest_shuks3-werks
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc NE 0.
* row is locked..hence gray..
LOOP AT SCREEN.
screen-input = 0.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE. " m_change_locking OUTPUT

7. Now we are ready for testing. Call the transaction once and make some entries in table. In below
screenshot I have entered some random values. Since we have not maintained any check tables etc,
so values may be invalid. That can be taken care in real scenario.
Save data.

Let’s call two sessions of the transaction ZTEST_SHUKS3.

Session 1

In first session we will call the transaction ZTEST_SHUKS3 and try to open some existing values for table
maintenance.

Let’s open an existing value material = MAT1 and Plant = 0678.


So the entry opens in change mode.

Now open a second session of the transaction and see. Now the same material and plant combination
can not be changed by any other user or session.

Session 2

Open transaction ZTEST_SHUKS3


So we can see that our transaction is able to achieve a row level locking and has removed table level
locking.

Creation of a View cluster


By T.N.Swapna

View Cluster

A view cluster is the set of objects, such as views, reports or tables, which belong to one business
function. The data can be arranged either hierarchically or non-hierarchically in view cluster. A view-
cluster transaction edits the complex cross-table data in a view cluster. The transaction navigation box
shows the complex business object with its components or sub objects.

Example:

Let us create a View Cluster on Material Details. The view cluster would include three tables namely,
MARA, MARC and MARD. We need to create maintenance views for each of these tables.

Maintenance view for Table MARA

To create maintenance view for the table MARA follow the procedure below. Go to transaction SE11.
Give a view name say ZMM_V_MARA and click on ‘Create’. Give a short description, enter the table
name as MARA and click on the tab View fields.
By default all the key fields would be added. We can add more fields by clicking on the button Table
fields.

Now Save and activate the view.

Maintenance view for Table MARC

Follow the same procedure as above. In the Tab View fields, give ‘S’ in the column ‘P’ for the fields
MANDT and MATNR as shown in the screen shot below:
This is because the fields MANDT and MATNR would be filled in the view for MARA and thus they act as
subsets and appear as header data when we create entries in view cluster.

Maintenance view for Table MARD

Follow the same procedure as above. In the Tab View fields, give ‘S’ in the column ‘P’ for the fields
MANDT, MATNR and WERKS as shown in the screen shot below:

This is because the fields MANDT, MATNR and WERKS would be filled in the view for MARC and thus
they act as subsets and appear as header data when we create entries in view cluster.

Table Maintenance Generator for ZMM_V_MARA

Now, for each view we need to create a table maintenance generator, which has to be done as follows:
The table maintenance screen appears. Here give the details as in the screen shot below. This table
maintenance is for the view ZMM_V_ MARA.

Before creating a table maintenance generator, create a function group say ZFG_MATERIAL from the
transaction SE80. After the function group is successfully created, enter the function group name as
shown in the screen shot. Also select Maintenance type as ‘One Step’ and give the Maintenance Screen
no. as ‘1’ in the Overview screen and click on the button ‘Create’.

Similarly, create the Table maintenance Generators for the views ZMM_V_MARC and ZMM_V_MARD.
The screen shots for these views would be as follows:

Table Maintenance Generators for ZMM_V_MARC and ZMM_V_MARD


Note that the Overview screen numbers would change for each view. It would be ‘2’ for the view
ZMM_V_MARC and it would be ‘3’ for the view ZMM_V_MARD.

Creating view cluster

The pre-requisites for creating the View Cluster are now ready. Go to transaction SE54 and select the
button ‘Edit View Cluster’. Enter the view cluster name as say ‘ZMM_VC_MATERIAL’ and click on
‘Create’.
An information message would pop up saying

Continue by pressing ‘Enter’. The following screen appears. Give a short description and click on ‘Object
Structure’ as shown in the screen shot below:
On Clicking the ‘Object Structure’ the following screen appears. Select the ‘New Entries’ button to enter
the maintenance views created to form a cluster.

Enter the values as shown below:

The entries would be entered in a hierarchical manner. The short text is the description of the view. The
‘Predecess’ column specifies the predecessor of that view. So in this case, the predecessor of
ZMM_V_MARA is ZMM_V_MARA itself. The predecessor of ZMM_V_MARC is ZMM_V_MARA and the
predecessor of ZMM_V_MARD is ZMM_V_MARC. The ‘DEP’ column explains whether the entry is a
Header entry or a Dependent entry. It is ‘R’ for the view ZMM_V_MARA, because it is a header entry and
does not depend on any other view. Whereas, it is ‘S’ for ZMM_V_MARC and ZMM_V_MARD, because
ZMM_V_MARC is dependent on ZMM_V_MARA and ZMM_V_MARD is dependent on ZMM_V_MARC.
The column ‘POS’ specifies the sequence of the views. In the column ‘Start’ select the radio button
against the entry for ZMM_V_MARA as it comes first in the hierarchy.

After entering the above entries, press ‘Enter’. Three pop-ups for each view would appear as shown
below. Proceed further by clicking on ‘Enter’ key.
Now select each line and click on ‘Field-dependence’ button. A pop-up appears saying ‘Field
dependencies successfully generated’.

Generate the field dependence for the views ZMM_V_MARC and ZMM_V_MARD in the same way. Now,
save the entries and go back to ‘Header Entry’ folder. Activate the view cluster. A pop-up appears as
shown below. Click on ‘Yes’.
The view cluster is now created successfully.

Note:

1. The view cluster can be created on the tables whose data has to be stored in a hierarchical
manner.

2. One has to check whether proper foreign key relationships are maintained between the tables
appearing in the cluster. Sometimes while generating the Field-dependencies, errors may occur if
the foreign keys are not maintained properly.

Testing the View Cluster

From the initial screen of the transaction ‘SE54’ give the view cluster name and click on ‘Test’.

Since we have created the view cluster on standard tables MARA, MARC and MARD we observe that all
the existing entries would appear. The screen shot below shows all the existing entries of the table
MARA. In order to see the corresponding Plant details for the material, just select an entry and double
click on Plant details as shown below.
The plant details would appear. In the same way for the corresponding storage location details,
select an entry and double click on Storage details as shown below.

In the above screen shot the material selected in the Material details view would appear as a header
entry. The storage location details are as follows:

In the above screen shot the material selected in the Material details view and the plant selected in the
Plant details view would appear as header entry.
Creating Search Helps (Elementary and Secondary)
By Vikram Chellappa, Mouri Tech Solutions

Go To SE11 T-code.

Select the radio button of search help.

Provide the search help name. Select the create button.

Select ELEMENTARY search help.


Press Enter.

Provide the short description, the selection method.

Provide the fields.

Save it, Check It & Activate it.

Then execute it.


We can see the screen like this, and then press F4 in this page.

Then press F4 View the output like this.


This is the output for elementary search help.

The Collective Search Help is like this.

Goto T-Code Se11.

Provide name. Select collective search help button.

Press enter.
Provide the Values

Select include search help.

Then provide search help name, which is already define by the same fields.

Then save it, activate it & execute it.


Press F4 we can see the output like this.

Diff Between Elementary search helps & Collective search helps


1) Elementary search helps describe a search path. The elementary search help must define where
the data of the hit list should be read from (selection method), how the exchange of values
between the screen template and selection method is implemented (interface of the search help)
and how the online input help should be defined (online behavior of the search help).

2) Collective search helps combine several elementary search helps. Collective search help thus
can offer several alternative search paths.

3) An elementary search help defines the standard flow of an input help.

4) A collective search help combines several elementary search helps. The user can thus choose
one of several alternative search paths with collective search help.

5) A collective search help comprises several elementary search helps. It combines all the search
paths that are meaningful for a field.

6) Both elementary search helps and other search helps can be included in a collective search
help. If other collective search helps are contained in collective search help, they are expanded to
the level of the elementary search helps when the input help is called.

Creating a secondary index


By Neha Kapoor

There are two types of indexes: Primary index and secondary index. Primary index is
automatically created using the primary keys defined.

Secondary index could be created as per the user requirement. This article discusses about creating a
secondary index.

Go to transaction SE11.
For our demo purpose, we have considered the table ZAUTHOR.

To know if there are any secondary indexes available, click on Goto à Indexes

Following popup appears:


From the above screenshot, it is evident that there are no secondary indexes already created.

Click on Create à Create Index

Enter the name of the index.

Fill in the details – Short description and the fields in the index.
Save and activate.

Now you can observe the index created above in the list now:
Maximum number of secondary indexes we can have are 9.

How to make SELECT statement to make use of any particular secondary index?

Consider the following example:


SELECT * FROM SPFLI
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'
.......
ENDSELECT.

In the above example, 001 is the secondary index of the table SPFLI. It's a well-known fact that
the efficient way of retrieving data from the database tables is by using secondary indexes. Many
database vendors provide the optimizer hints for the same. From SAP® v4.5, optimizer hints can
be provided by the %_HINTS parameter. This is dependent on the database systems that support
optimizer hints. The point to be noted here is these optimizer hints are not standardized by the
SQL standards. Each database vendor is free to provide the optimizer hints.
Now to know which index to use for our table:
1. Go to SE11 and there specify the table name
2. Now from the menu, goto --> indexes
3. select the required index.

Now suppose that the identifier 001 represents a non-unique secondary index comprising of the
columns CITYFROM and CITYTO. The index name should be defined as:

<tablename>~<Index Identifier>
like SPFLI~001 in the above example.

The sequence of fields in the WHERE condition is of no relevance in using this optimizers
index. If you specify hints incorrectly, ABAP ignores them but doesn't return a syntax error or
TM

runtime error.
The code was written in R/3 4.6C.

Code

Consider the following example:

REPORT Suresh_test.

TABLES: spfli.

DATA : t_spfli LIKE spfli OCCURS 0 WITH HEADER LINE.

SELECT * FROM spfli


INTO TABLE t_spfli
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'.

LOOP AT t_spfli.
WRITE :/ t_spfli.
ENDLOOP.

Вам также может понравиться