You are on page 1of 84

DATA DICTIONARY IN SAP ABAP

CONTENTS

● WHAT IS DATA DICTIONARY IN SAP ? WHAT ARE MAIN FUNCTIONS


OF DATA DICTIONARY IN SAP ?

● DATA TYPES DOMAINS DATA ELEMENTS IN SAP

● HOW TO CREATE DOMAIN AND DATA ELEMENT IN SAP?

● WHAT ARE THE COMPONENTS OF SAP TABLES IN SE11?

● WHAT ARE THE TYPES OF DATABASE TABLES IN SAP?

● HOW TO CREATE A DATABASE TABLE IN SAP SE11?

● HOW TO CREATE A STRUCTURE IN SAP SE11?

● TABLE TYPE IN SAP ABAP

● WHAT IS THE DIFFERENCE BETWEEN STRUCTURE AND TABLE IN


SAP DATA DICTIONARY?

● WHAT IS THE DIFFERENCE BETWEEN TRANSPARENT, POOLED AND


CLUSTER TABLES IN SAP ?

● WHAT IS A CHECK TABLE? HOW TO CREATE A CHECK TABLE IN


SAP?

● FIXED VALUES OF A DOMAIN IN SAP ABAP

● CREATING VIEWS IN SAP ABAP

● SEARCH HELPS IN SAP ABAP

● LOCK OBJECT IN SAP ABAP

WHAT IS DATA DICTIONARY IN SAP ? WHAT ARE MAIN


FUNCTIONS OF DATA DICTIONARY IN SAP ?
The SAP Data Dictionary is a central repository for the development of Objects,
SAP Data Dictionary is used to create and maintain metadata (data definitions) .
T-Code for Data Dictionary is SE11.

SQL Can be divided into two parts


● DML -- Data Manipulation Language
● DDL -- Data Definition Language

Where DML consists of SELECT, INSERT, UPDATE, MODIFY, DELETE


etc, this will be handled by ABAP Programs and DDL consists of commands
like CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE INDEX
etc, this will be handled by Data Dictionary, hence Data Dictionary is the
central repository for the development of objects.

The Main Functions of Data Dictionary are :


● Database Tables
● Views
● Data Elements
● Domains
● Structures
● Search Helps
● Lock Objects

An ABAP Consultant may need to work on below areas of data dictionary :


● Creating Tables
● Creating Data elements and Domains
● Creating structures and Table types
● Creating search helps
● Creating Lock objects
● Creating database views

In Next lessons we will learn how to create tables, data elements, domains and
other data dictionary objects. Navigation: T-code : SE11
DATA TYPES DOMAINS DATA ELEMENTS IN SAP

ABAP uses different types of Data Types for Objects, basically there are three
types of data types Elementary Data types, Complex Types, Reference Types .
In Elementary types there are again two types of data types (Categories) Fixed
Length and Variable Length .

Fixed Length:
● C Text Field
● N Numeric
● D Date
● T Time
● H Hexadecimal
● P Parked Number
● I Integer
● F Float

Variable Length
● STRING Character Sequence
● XSTRING Byte Sequence

Complex Types includes Structure Types and Table Types.


Reference Types includes Data References and Object References

What is a Date Element in SAP ABAP ?


Data element is an object which specified semantic information of a field, ex:
field label , heading.

(We all know that table is a collection of fields, ex: STUDENT is a table with
fields STUDENT_ID, STUDENT_NAME ext, data element specifies the field
labels and headings for these fields )

What is a Domain in SAP ABAP ?


Domain is an object which specified technical information of a field in a table
ex: Data type, length, value range etc

Why we use Data elements and Domains in SAP ?


When ever we are creating a new table or adding a field to existing table, we
need to specify field labels and data types for the field, in SAP we maintain
these values in the form of Data elements and Domains.
Navigation : T-code - SE11
HOW TO CREATE DOMAIN AND DATA ELEMENT IN SAP?

Creating a Domain in SAP


Go to SE11 T-code, select domain radio button, provide a name
(ZSAPN_DOMAIN) and create.
Provide short description, no of characters and save (Ctrl S ).

Select local object ( non transportable object ).

Activate.
Domain is created.

How to create Data Element in SAP


Creating data element in SAP
Go to SE11, select data type radio button, provide a name
(ZSAPN_DATAELEMENT) and create.

A popup will open, select data element radio button

Enter short description and domain name (ZSAPN_DOMAIN) and select field
label tab.
Select field label tab and maintain field labels.

Save and Activate, Data element is created.


WHAT ARE THE COMPONENTS OF SAP TABLES IN SE11?

Before creating a table, we must know the components of the table.


What is a key field in ABAP Dictionary Table?
A field which does not accept duplicate data is called as the key field.
What is a foreign Key in ABAP Dictionary
Foreign Key is a concept which is used to define relations between tables in
ABAP Dictionary.
A relationship which can be defined between tables and must be explicitly
defined at field level. Foreign keys are used to ensure the consistency of data.

Data entered should be checked against existing data to ensure that there are
now contradiction. While defining foreign key relationship cardinality has to be
specified. Cardinality mentions how many dependent records or how referenced
records are possible.

What are Compound Foreign Key in ABAP Dictionary?


A compound foreign key is a foreign key composed of two or more fields. In
other words, a check is done to compare two fields in the foreign key table
against two fields in the check table. The combination of values must exist in
the check table before they can be inserted into the foreign key table. However
only one field on the screen will trigger the compound foreign key check.

What is a delivery class in ABAP Dictionary?


It specifies the type of data stored in a database table ex: master data,
Transaction data, system data etc.

Options available under delivery class:


A- Application Table (Master and Transaction data).
C-Customizing table, maintenance only by customer not SAP.
L-Table for storing temporary data.
G, E, S, W - These are used to store system data (Basis data).
Display and Maintenance
It specifies whether the user can display the data and maintain the data, the
following options are available under display and maintenance.
1. Display/Maintenance Allowed. - User can display and maintain data.
2. Display/Maintenance allowed with restrictions - Some users can display
and maintain data.
3. Display/Maintenance not allowed - No user can display data.

What is data class ?


It specifies the physical area of a table in the database, the following options are
available under data class.

APPL0 - Master data


APPl1 - Transaction data
APPL2 - Organization and Customizing
DDIM, DFACT, DODS etc., is used by BI and BW.

What is size category in Data Dictionary?


It specifies the number of records that can be stored in a database table, options
available under size category are below.

Size Category No of expected records

0 0 - 7,100
1 7,100 - 28,000

2 28,000 - 1,10,000

The above numbers may vary from company to company.

Size category will be incremented dynamically based on increase in records.


Buffer
It is a temporary memory for storing the data.
It is same as cache memory.

WHAT ARE THE TYPES OF DATABASE TABLES IN SAP?

There are three types of database tables available in SAP, explained below

Transparent table
There is a physical table on the database for each transparent table. The names
of the physical tables and the logical table definition in the ABAP/4 Dictionary
correspond.
All business data and application data are stored in transparent tables.

Pooled table
Pooled tables can be used to store control data (e.g. screen sequences, program
parameters or temporary data). Several pooled tables can be combined to form a
table pool. The table pool corresponds to a physical table on the database in
which all the records of the allocated pooled tables are stored.

Cluster table
Cluster tables contain continuous text, for example, documentation. Several
cluster tables can be combined to form a table cluster. Several logical lines of
different tables are combined to form a physical record in this table type.

This permits object-by-object storage or object-by-object access. In order to


combine tables in clusters, at least parts of the keys must agree. Several cluster
tables are stored in one corresponding table on the database.
HOW TO CREATE A DATABASE TABLE IN SAP SE11?

A table can be created in two ways, one is top to bottom approach and another
one is bottom to top approach.

Top to Bottom:
In this approach, first table fields are defined and later domain and data element
are defined.

Bottom to Top:
In this approach, first domain and data element are defined and later table will
be created.

In this example we are going to learn creating an SAP transparent table using a
top to bottom approach (I suggest a simplest way).

Go to SE11 T-code, provide table name to be created ZSTUDENT_TABLE and


create.
Provide short description, delivery class (A), Display Maintenance Allowed and
select fields tab.

Select Fields tab, add a field STUDENT_NO, data element as ZSTUDENT_NO


and check Key and Initial Value check boxes.

A table must contain at least one key field, without a key field we can not create
a table.
Double click on data element ZSTUDENT_NO (Not yet created), a pop up will
open, click yes and one more information message will come press enter.

Now a pop up will come asking to create date element, click yes.

Provide short description, domain and label


Save, double click on domain name ZSTUDENT_NO, click on yes.
Provide short description, data type, no. Characters, save and activate.
Similarly create remaining fields with data elements and domains as below

Once all fields are created click on 'Technical Settings' button.

Provide data class and size category, save and activate.


You will get a warning message just click on No, table is created.
Now add entries to table.
HOW TO CREATE A STRUCTURE IN SAP ABAP?

Structure
The structure is a list of fields defined under a name, which is used to process
data at run-time in SAP ABAP applications.

Structures are two types one is global structure and another one is local
structure. Local structure can be created in ABAP programs and global structure
can be created in the data dictionary and can be reusable in different objects.

In this lesson we will be learning how to create  a structure in the data


dictionary.
Go to SE11, select Data Type radio button and click on create.
A pop up will open, select structure radio button and continue.

Provide short description, add some fields, save and activate.

The structure is created, now we can use this structure in our ABAP programs.
HOW TO CREATE TABLE TYPE IN SAP ABAP

Requirement analysis: For this requirement we need to get materials from


MARA(material Master) table for the specified material type, a material type
may have more than one materials, so we have to get materials into an internal
table.In SAP classes we don't have options to directly specify tables, for this one
we need to create table type in SE11(Data Dictionary).

For the above requirement we need to create a class method to get details of a
material for a material input, for this method the importing parameter is material
no (to pass material input to method) and exporting parameter is of type
MARA(work area one material no contains only one record in MARA).Go to
SE24, provide class name as ZCL_SAPN_MATERIALS.
Provide description, save.

Save, save it in a local object, go to methods tab and declare a


method.GET_MATERIAL_DETAILS-INSTANCE-PUBLIC-Get Material
details
Select parameters button and declare two parameters as belowIM_MATNR-
IMPORTING- TYPE-MARA-MATNR-Material NumberEX_MARA-
EXPORTING-TYPE-MARA-General Master Data

Double click on CODE icon or Go back to methods and double click on method
name and add below code.
*Select material data from mara table into exporting parameter ex_mara (work

area) for a material no im_matnr


SELECT SINGLE * FROM MARA
INTO EX_MARA
WHERE MATNR = IM_MATNR.
Save, activate and execute the method( press F8).

Click on execute.

Provide a material no and execute.

You will get material details for that material, now class with method is created
we have to use it in our program.

Using Class method in SE38 Program


Go to SE38 and create a program ZSAPN_GET_MATERIAL_DETAILS and
follow below steps to add code.
Step1: Declare class and create object.
DATA : LO_MATERIAL TYPE REF TO ZCL_SAPN_MATERIALS.
CREATE OBJECT LO_MATERIAL.

Step2: Program declarations.


PARAMETERS : P_MATNR TYPE MARA-MATNR.
DATA : WA_MARA TYPE MARA. "work area to store material details

Step3: Call class method and print out put.


CALL METHOD LO_MATERIAL->GET_MATERIAL_DTAILS
EXPORTING
IM_MATNR = P_MATNR
IMPORTING
EX_MARA = WA_MARA.
WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS.

Final code will be


REPORT ZSAPN_GET_MATERIAL_DETAILS.
DATA : LO_MATERIAL TYPE REF TO ZCL_SAPN_MATERIALS.

PARAMETERS : P_MATNR TYPE MARA-MATNR.


DATA : WA_MARA TYPE MARA.
CREATE OBJECT LO_MATERIAL.

START-OF-SELECTION.
CALL METHOD LO_MATERIAL->GET_MATERIAL_DTAILS
EXPORTING
IM_MATNR = P_MATNR
IMPORTING
EX_MARA = WA_MARA.
WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS.

Go to SE11, select data type radio, provide name as ZSAPN_MARA, create.


A popup will open, select table type radio, enter.

Provide short text, provide line type as MARA.

Save and Activate.


Now table type is created for MARA, to create a method to get material details
for a material type, go to SE24, provide class name as
ZCL_SAPN_MATERIALS( we previously created this class see previous
lesson) and click change.

Go to methods tab and add a method with name


GET_MATERIALS_FOR_TYPE-INSTANCE-PUBLIC-Get materials for
material type.

Click on parameters button and add parameters as below.

Save, go back to methods and double click on GET_MATERIALS_FOR_TYPE


and add the below code.
*Get data from mara for a material type MTART
SELECT * FROM MARA
INTO TABLE ET_MARA
up to 50 rows
WHERE MTART = IM_MTART.
*For testing purpose im getting first 50 rows for a material type

Save, activate and test the method.


Using class method in SE38 program to get Material details for a material type.
Go to SE38 and create a program ZSAPN_GET_MATERIALS_FOR_TYPE
and add below code.
REPORT ZSAPN_GET_MATERIALS_FOR_TYPE.
DATA : IT_MARA TYPE TABLE OF MARA. "internal table to store materials
DATA : WA_MARA TYPE MARA. "work area for materials to loop
DATA : LO_MATERIALS TYPE REF TO ZCL_SAPN_MATERIALS. "declare materials
class

PARAMETERS : P_MTART TYPE MARA-MTART. "material type input

CREATE OBJECT LO_MATERIALS. "Create object for material class

START-OF-SELECTION.
CALL METHOD LO_MATERIALS->GET_MATERIALS_FOR_TYPE "call method to
get materials
EXPORTING
IM_MTART = P_MTART
IMPORTING
ET_MARA = IT_MARA.

LOOP AT IT_MARA INTO WA_MARA.


WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS.
ENDLOOP.

Program input.

Program output.

WHAT IS THE DIFFERENCE BETWEEN STRUCTURE AND TABLE


IN SAP DATA DICTIONARY?
Table and structure have lots of differences in the sense of behavior and
properties, the below are the main differences between tables and structure in
the data dictionary.

Table and Structure Difference

Table Structure

Tables will store data physically and Structure can not store data physically, it
permanently. can hold data at run time only.

Tables have primary keys. Structure's does not have any primary
key.

Table have technical settings (data class, Structure's does not have any technical
size category, etc), maintenance attributes and maintenance attributes.
attributes (Display maintenance
restrictions).

Table have primary and secondary Structures does not have primary and
indexes. secondary indexes.

WHAT IS THE DIFFERENCE BETWEEN TRANSPARENT, POOLED


AND CLUSTER TABLES IN SAP ?

The below are the major differences between transparent, pooled and cluster
tables in SAP data dictionary.
Transparent Tables Pool Tables Cluster Tables

Contain a single table. Used They are used to hold a large They are used to hold data
to store master data number of very small from a few number of
tables(stores system data). large tables.(stores system
data).

It has a one-to-one It has a many-to-one It has a many-to-one


relationship with a table in relationship with a table in relationship with table in
the database. the database. the database.

For each transparent table It is stored with other pooled Many cluster tables are
there is one associated table tables in a single table called stored in a single table in
in the database. table pool in the database. the database called a table
cluster .

The database table has the The database table has The database table has
same name, same number of different name, different different name, different
fields and the fields have number of fields and fields number of fields and
the same names . have different names. fields have different
names.

There is only a single table . Table pools contain more Contains less tables than
tables than table clusters . table pools .

Secondary indexes can be Secondary indexes cannot be Secondary indexes cannot


created . created . be created .

WHAT IS A CHECK TABLE? HOW TO CREATE A CHECK TABLE IN


SAP?

What are table validations?


Table validation is a concept through which we can restrict invalid entries in a
table.
Possible methods/concepts for table validation

1. Field Level validations: We can validate entries at field level with the help of
check table concept.
2. Domain level validations: We can restrict entries at the domain level with the
help of fixed values of the domain and value table of the domain.

What is a check table?


It is a table which contains all valid entries of a field.

What is value table?


It is a table which contains all valid entries of a domain, this domain can be
reused in multiple tables.

What are fixed values for the domain?


These are allowed values for a domain ex: GENDER (domain).
Creating check table for table validations.
Step1: Go to SE11, create a table ZSTUDENT_CHECK as below
Go to SE11, provide name as ZSTUDENT_CHECK and click on create.

Provide delivery class and display maintenance allowed.


Go to fields tab and add a field as below

Click on technical settings button and provide data class and size category.
Go to utilities- table contents - create entries add some entries to the table.

Similarly add some more entries.


Step2: Add ZSTUDENT_CHECK as check table for ZSTUDENT_TABLE
Go to SE11, provide table name as ZSTUDENT_TABLE( which we have
created already in our previous lessons, if not create a table )

Go to tab Entry help/check, select city fields and click on 'Foreign key' icon.
Provide short text, check table name ZSTUDENT_CHECK and click on
'Generate Proposal' and click on copy.

A Check table will be assigned to CITY field

Save and activate the table(If you get a warning popup when activating just
press no).
Now go to utilities - table entries -> create entries
Provide a city name which is not in ZSTUDENT_CHECK table and try to save,
it will trough an error.
FIXED VALUES OF A DOMAIN IN SAP
SAP Table screen entries can be restricted using domain fixed values, we can
maintain domain fixed values at domain level when creating a domain.
Create domain with fixed values.

Go to SE11, select domain, provide name as ZGENDER, click on create.

Provide short description, data type and length as below and click on value
range tab.

Provide fixed values.


Save and activate.
Create data element with domain
Go to SE11, select data type, provide name as ZGENDER, click on create .

A popup will come, select data element and press enter.

Provide short description, domain and click on field label.


Provide field labels

Save and activate


Add a field in table
Go to SE11, provide a table name ZSTUDENT_TABLE(we have already
created, if not create table ) and click on change
Go to fields tab and add a field as below.

Save and activate


Go to table utilities- table entries - create entries
Provide values other than M, F and N, it will through an error .

CREATING VIEWS IN SAP ABAP

Database View

Introduction
Database views are used to combine application data often distributed over
several tables. The structure of such views is defined by specifying the tables
and fields that are required. Fields which are not required can be hidden,
thereby minimizing the interfaces. A view can be used in ABAP programs for
data selection.
Following demo shows how to create database view for two database tables
having foreign key relationship.

We will be creating a database view for below shown tables YZ14_BANK &
YZ14_ACCOUNTS. Note that YZ14_ACCOUNTS is foreign key table
(dependent table) and YZ14_BANK is check table (referenced table) for field
BRANCH_ID. It should be kept in the mind that we can only include
transparent tables in database view.

Steps
1. Go to transaction SE11 -> select radio button 'View' -> enter the name of
the view -> press 'Create'.
2. Below pop up screen will be displayed. Select 'Database View' and press

button.

3. Below screen gets displayed, enter suitable short description.


4. In 'Tables' enter the name of the base tables which we want to include in
our view. In this case we will be entering tables as YZ14_BANK &
YZ14_ACCOUNTS.
5. Next, we need to link the entered tables by specifying the fields in join
condition. We can also derive the join conditions from existing foreign keys
between the base tables of the view. To do this, position the cursor on the table

names and click on present at the bottom.


6. Below pop up comes wherein linked tables are present. Select the tables
and press 'Copy'.

7. On clicking copy button, join condition will be derived from the base
tables. In our case, we have the below shown conditions.
8. In the 'View Flds' tab, we need to enter all the fields, we want in our view
from the database tables. We can either enter the fields directly or we can copy
them from base tables. Later can be achieved by pressing
button present in the tab 'View Flds'. We can also include complete table in a
view by entering * in 'View field' & table name in 'Table'. If fields are inserted
or deleted from this table, similar modification will be automatically made in
view structure.

9. On pressing 'Table fields' button we get a popup likewise shown below.


Choose the table whose fields we want to include in our view. Another popup
will be shown select the fields we want to include and press 'Copy'.
10. We repeat the above step to include below shown fields from table
YZ14_ACCOUNTS.

11. In above steps do not include 'MANDT' & 'BRANCH_ID' twice. While
activating the view, it will lead to an error.
12. As shown, we have the below fields in our view.

13. We can also formulate the selection criteria using 'Selection Conditions'
tab likewise coded below. Here we have entered the condition for account type
and status. All the data in the base table satisfying the below condition will be
selected based on other condition present.
14. Now save the view by pressing button present in standard toolbar.
Then activate the view with present in application tool bar. Once view got

activated, press to see the contents. Below screen gets displayed, do not
enter any value, just execute it.

15. Because of the condition we have put on acc_typ & status fields, entries in
the base table got filtered. We can see that all the entries have account type as
'CURRENT' & status as 'X'.
Summary
Above steps demonstrate how to create database view from multiple tables
having foreign key relationships.

Projection View
We use projection view to mask unwanted fields and display only relevant
fields in a table. Basically View acts like a database table only, the difference is
view will not occupy storage space.

1. Creating Projection View


2. Choose Projection View in the pop up which appears when you click on
create
3. Give Description & base Table name(In this example we have taken KNA1)
4. After giving table name click on Table fields button
5. Choose the fields which you want to be displayed in output and click copy

6. Now Save, Activate & execute it, output will be


Summary
In standard SAP tables we will have many fields, of which we will use only few
fields. whenever we go and view the data we have to come across unwanted
data, to avoid this and get display of field which relevant to scenario we use this
projection view.

Maintenance View
Go to SE11 transaction enter the view name

Click on create button


Select the maintenance view radio button
Enter the database table KNB1 and select the Relationships button
Select the Checkbox and click on Copy
Maintenance status as Display/Maintenance allowed

Click on Save and activate


Save under package or local object

Go to utilities and table maintenance generator


Enter the Authorization group &NC& and function group ZMAIN_VIEW and
enter the Overview screen 100
Click on save and activate.

Go to SM30 transaction and enter the view name and maintain the entries.
Help View
Introduction: This document deals with a very basic topic of Help View and
step by step procedure to create it and use it in the search help. This document is
useful for beginners who want to learn how to create help view.
What is Help View: Help view can be used in the search help as in the
‘Selection Method’. We can also provide database table or database view name
there, but suppose if we want to get data as outer join then Help View can be
provided. It uses left outer join to select the data while database view uses inner
join. What it means: suppose I have two tables A and B. In help view all the
contents of primary table will be displayed.

And also if we want to show only particular data then in the ‘Selection
Conditions’ tab of the help view, we can also provide condition to select data.
Steps: 1) How to create Help View-
i) Go to transaction SE11
ii) Give View Name that you want to create
iii) Click on create button
iv) Now next screen appears with multiple options choose ‘Help View’
and click ‘Copy’

v) Provide short description and enter the base table name in the tables
field as in below screenshot then click on ‘Relationship’ button
On clicking of relationship button, it lists all the tables that are directly linked
with the base table that we have provided.
vi) Now select the table from the list and click copy. Join condition is
populated automatically.
vii) In the view field we put the fields that we want to show in our view.
Click on Table fields and select the table and fields.
Choose the fields that we want to include

viii) Now in the ‘Selection Conditions’ tab give the selection criteria if we
want to filter on the basis of some conditions as in below screen shot
For example if we want to include only those values for which “Company code
is 1000’ and ‘Item number is ‘010’ “

If we can give multiple conditions with the help of ‘Logical Operators’


AND=> True only in case of all the conditions are true
OR=> True in the case if any of the condition is true
ix) In the next tab maintenance status can be provided. In case of Help
view only two options are available:
Read Only: Data can only be read
Read and change: Existing entries can be changed but deletion or insertion is
not possible
x) Now save and activate the View.
2) Use of help view in search help:
i) To create a search help go to SE11 and provide search help name and
click ‘Create’. For example we want to create ‘Elementary search help’

ii) In next pop-up choose Elementary search help. In the next screen
provide short description and in the selection method input provide the name of
help view. In the parameter, provide the search help parameters and provide the
other properties whether it is import or export parameter their positions etc.
Now Save and activate the search help.
3. Use of search help: we can use this search help with the help of keyword
‘Matchcode object’

Now at the selection screen when we press ‘F4’ in the select-option parameter
‘so_werks’ a list appears for which item is ‘10’ as we had given in our help
view selection condition
Summary: In the above example, steps for creating help view and how to use
that in search help has been explained.

SEARCH HELPS IN SAP ABAP


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.

LOCK OBJECT IN SAP ABAP


Creating a lock object in SAP
Lock Objects are the part of data dictionary objects, lock objects can be created
in SE11 T-code, lock objects always starts with E, (these are the only custom
objects that does not start with Z in SAP).

Lock objects are data dictionary objects, can be created in SE11, follow below
steps to create lock object.

Example: Here I am creating a lock object to insert, delete, update for table
ZSTUDENT table in SAP.

Go to SE11, provide lock object name as EZSTUDENT, create.

Provide short description, select tables tab, provide table name and lock mode,
save and activate.
When ever we create a lock object two function modules will be created, go to
SE37, check FM`s DEQUEUE_EZSTUDENT and ENQUEUE_EZSTUDENT.
Using the lock object to update/insert table
When ever we create a lock object, two function modules(ENQUEUE and
DEQUEUE) will be created, we have to call those function modules before and
after open SQL statements, refer program below.

REPORT ZSAN_LOCKOBJECT.

DATA : IT_STUDENT TYPE TABLE OF ZSTUDENT,


WA_STUDENT TYPE ZSTUDENT.

WA_STUDENT-STUDENTID = '09'.
WA_STUDENT-NAME = 'SAPNuts'.
WA_STUDENT-LASTNAME = 'SAPNuts'.
WA_STUDENT-FATHER = 'SAP'.
WA_STUDENT-DOB = '25/09/2013'.
WA_STUDENT-GENDER = 'Male'.
WA_STUDENT-COURSE = 'SAP ABAP'.
WA_STUDENT-EMAIL = 'admin@sapnuts.com'.
WA_STUDENT-FEE = '0000'.

CALL FUNCTION 'ENQUEUE_EZSTUDENT' "add lock


EXPORTING
MODE_ZSTUDENT = 'E'
MANDT = SY-MANDT
STUDENTID = WA_STUDENT-STUDENTID "record to lock, optional parameter
* X_STUDENTID = ' '
* _SCOPE = '2'
* _WAIT =''
* _COLLECT =''
* EXCEPTIONS
* FOREIGN_LOCK = 1
* SYSTEM_FAILURE =2
* OTHERS =3
.
IF SY-SUBRC = 0.
MODIFY ZSTUDENT FROM WA_STUDENT.
ENDIF.

CALL FUNCTION 'DEQUEUE_EZSTUDENT' "release lock


EXPORTING
MODE_ZSTUDENT = 'E'
MANDT = SY-MANDT
STUDENTID = WA_STUDENT-STUDENTID "record to release lock, optional
parameter
* X_STUDENTID = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT =''
.

Lock Objects
Lock objects are used to synchronize the multiple set of users who are accessing
the same set of data.

There are three types of locks.


1. Exclusive Lock.
2. Shared Lock.
3. Exclusive but not cumulative lock.

Exclusive Lock
The locked data can be read or proceed one user only. A request for another
exclusive lock for a shared lock is rejected.

Shared Lock
Several users can read the same data at the same time, but as same as a user
edits the data,a second user can not longer access this data. Requests for further
shared locks are accepted, but exclusive locks are rejected.

Exclusive but not cumulative lock.


Exclusive locks can be requested by the same user more than once and handled
successfully, but an exclusive but not cumulative lock can only be requested
once by a given user, all the other lock requests are rejected.

Use of lock objects


Lock objects are used when ever we are modifying or updating or inserting or
deleting the database table data using OPEN SQL statements.
Lock objects are part of data dictionary objects, when ever we create a lock
object using data dictionary, two function modules will be generated
automatically in the back end.

All custom objects in SAP starts with Y or Z except lock objects.Lock objects
starts with EZ or EY.

Name of the generated function modules are with following naming


convention .
ENQUE_<LOCK OBJECT NAME>. "USED TO PUT A LOCK ON DATABASE TABLE
RECORD
DEQUE_<LOCK OBJECT NAME>. "USED TO RELEASE LOCK ON DATABASE
TABLE RECORD
*HERE <LOCK OBJECT NAME> IS THE LOCK OBJECT NAME WHICH IS CREATED
IN DATA DICTIONARY

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.

You might also like