Tuesday, January 6, 2009

Search Help

SEARCH HELP:

-SE11 -Search Help –Names –Create – Elementary Search Help- Short Description.

In Selection methods, enter a table or view.
We cant enter here maintenance view.

In Search Help parameter, enter the field names.
Select check box – importing and exporting.
First Line LPOs = 1, SPOs = 1
Second Line LPOs = 2, SPOs = 2
…and so on…
-Save Check and Activate.

ATTACHING SEARCH HELP TO THE TABLE:

Open the Table in change mode
Place cursor where you want to create F4 help.
Click on search help button.
Enter the search help name and press enter (copy).
Save Check and Activate.


Dialog Type:
1. Display values immediately: As soon as F4 is pressed, values will be displayed.
2. Display values with restrictions: As soon as F4 is pressed, restriction box is displayed.
3. Dialogue depending on set of values: In this option, if number of values is less than 100, it behaves as display values immediately, if more than 100, behaves as dialogue with value restrictions.

Importing – Values are copied from screen to search help
Exporting – Values are copied from hit list to screen fields.

If we have two fields in F4 Plant and Material:
For locking we can see: Plant is not copied, rather material is copied, but user can choose material based on plant.
SPOs – Position of field in hitlist
LPOs – Position of field in restriction box.

Activation – When we activate any object, a series of SQL statements will be generated which will trigger database to create object in database.

Lock Objects

Lock Objects: Are used for synchronizing the access by multiple users for a single object.

Lock Objects start with ‘e’
Whenever we activate lock objects ( eg : EMARA), automatically two function modules will be created:
1. Enqueue_EMARA to lock the object
2. Dequeue_EMARA to release the lock.

SM12 is the transaction code to analyze the locks.

Creating Lock Objects:

- SE11 - Select lock object radio button – Enter lock object name (eg – emara)
- Enter short description – Enter Primary table name – enter lock mode
– enter secondary tables.

example - While creating Sales Order, MM02 should not change the material attributes.

Whenever we do changes to an object, there are other dependent objects which should not changed by any other objects.

Click on Lock Parameter – all key fields will appear, we can change it.
Save Check and Activate.
Automatically system gives two function modules.

Order of a lock mechanism:
Lock
Read
Change
Release

Structures

STRUCTURES: It is a group of logically related fields.

Difference between Structure and tables
- Table contains data, structure doesn’t contain data.
- Table must have key fields, structure doesn’t require key fields
There are two types of Structures:
- Include Structure
- Append Structure

Creating Structures:
1. SE11
2. Select Datatype radio button
3. Enter Structure name
4. Click on create
5. Select structure radio button
6. Enter short description
7. Components tab – enter field names, component type enter data element
8. Save Check and Activate

Including a structure: Can be included in any number of tables.
Appending Structure:
- Open a table in change mode
- Click on append structure button
- System proposes a name which we can modify.
But the name should start with Y or Z.

Append structure is always done at the end of structure.

Generally naming convention for fields of append structure are starting with ZZ.

If we have a table with Lchar (long character) as a field datatype, it append at last of the table, we can not have append in that case.

• Include Structure are pre-planned.
• Append Structures are not pre-planned.
• Both are part of enhancements.

Views

Views: They are virtual tables.

  1. Projection View (can make changes if the view contains a single table).
  2. Database View (one or more than one table) using inner join

When we create a database view on more than one table, we can not change the underlying table values by using the view.

  1. Maintenance View

- Uses outer join

- It allows changing values in the underlying tables.

  1. Help View

- Uses Outer Join

- Uses for F4 help

Creating Projection View:

  1. Go to TCODE SE11
  2. Select Radio Button
  3. Enter View Name
  4. Click Create
  5. Select Project View Radio Button
  6. Enter Short Description
  7. Enter Basis Table (Database Table)
  8. Click on Table Fields
  9. Select the required Fields
  10. Select Maintain Status Tab.
  11. Read and Change.

Creating Database View:

  1. Go to TCODE SE11
  2. Select Radio Button
  3. Enter View Name
  4. Click Create
  5. Select Database View Radio Button
  6. Enter Short Description
  7. Enter Basis Table (Database Table)
  8. Enter Table Name in tables column
  9. Click on relationship
  10. Select relationships and click on copy.

Between 2 tables can select only one relationship.

  1. Click on View fields
  2. Click on table fields
  3. Select a table and click choose
  4. Select fields of table and enter.
  5. Do same for other table.
  6. In select conditions tab: Enter condition based on which need to be displayed.
  7. Save, Check and Activate.

NOTE: Check Table is Foreign Key Table.

Maintenance View: Create same a database view. But after activating, we need to create table maintenance generator.

We can write selection query using common fields also ( foreign key fields are never mandatory).

HELP VIEW: Similar to database view.

T-Codes, Tables and Descriptions

List of frequently used transactions for users which may be helpful to know:

T.Code(s) Related Tables

MM01 MM02 MM03(Material) MARA, MARC, MARD, MAKT

XD01 XD02 XD03 (Customer) KNAL KNFL KNCL KNUV KNVP

XK01 XK02 XK03 (Vendor) CFAI CFBI LFMI

VA01 VA02 VA03 (Sales Order) VBAK, VBAP, VBEP, VEKD, VBP6,

VBFA, VBUK, VBUP

VL01n VL02n VL03n LIKP LIPS

(Delivery Note)

VB01 VB02 VB03 VBRK VBRP

(Listing/Exclusion)


ME21N ME22N ME23N EKKO EKPO EKKN EKET

(Purchase Order)


Few common TABLES and description:

TABLE DESCRIPTION KEY FIELDS DESCRIPTION

1. MARA General Material MATNR Material Number

Data

2. MARC Plant Data for MATNR Material Number

Material WERKS Plant

3. MARD Storage location MATNR Material Number

data for material WERKS Plant

4. MVKE Sales data for MATNR Storage Location

Material VKORG Material Number

VTWEG Sales Organization

Distribution Channel

5. MAKT Material MATNR Material Number

Description SPRAS Language Key

6. KNAI General Data in KUNNR Customer Number

Customer Master

7. KNBI Customer Master KUNNR Customer Number/

(Company Code) BUKRS Company Code

8. KNCI Customer Master KUNNR Customer Number/

(Transaction Figures) BUKRS Company Code/

GJAHR FY

9. KNUV Customer Master KUNNR Customer Number/

(Sales Data) VKORG Sales Organization

VTWEG Distribution Channel/ SPART Division

Friday, January 2, 2009

Data Dictionary Notes

Data Dictionary exists in R/3 Repository. R/3 Repository is in Database but the full image is available in Application Server for real time processing.

Data Dictionary stores and manages metadata i.e. centrally manages the metadata.

Domain = Technical Attributes.
It is a reusable object which contains technical attributes of a field.

Data Element = Short Description + Technical Description

Data Element is a reusable object which contains short description or a business context and technical attributes about a field.
We can not assign a domain directly to a field, rather we assign domain to a data element and data element to a field.

To create a field there are two methods, can be named as : Bottom up and Top Down.

Bottom Up method: Domain  Data Element  Table
Top Down: method Table  Data Element  Domain.

Steps to create domain:
1. Goto SE11.
2. Select domain radio button and click create
3. Enter domain name
(Naming convention: user defined object will start with Y or Z)
4. Click Create
5. Enter Short Description
6. Enter Datatype and no. of characters.
7. Save
8. Enter the package name OR Click on Local Object if you don’t want to assign to any package.
9. Check
10. Activate.

Steps to create Data Element
1. Goto TCODE SE11
2. Select data type  zdept-phone
3. Click on create (F5).
4. Select Data Element
5. Enter short description ( more meaningful the better)
6. In Datatype tab  Enter Domain
7. Click on Field Label
8. Enter field labels of short, medium and long
9. Save Check and Activate (ctrl + S, Ctrl + F2, Ctrl F3)
In case you want to add further description: Click on documentation.

Steps to Create Table:
1. Goto TCODE SE11
2. Select Database Table radio button
3. Enter Table name
4. Click on create
5. Enter Short Description
6. In delivery class enter A.
Delivery class (there r seven delivery classes)
7. Select A (application table, master transaction data)
8. Select check box
9. Click on fields tab
10. You can write fields names
11. Select key & int checkboxes (1st filed must,
should be primary key)
12. Click on the data element/direct type
13. Then data type will be enabled
14. Enter data & length
15. Place at cursor at sal (if ur write Sal then ) & click
on currency/quant fields
16. (Sal asks reference table i.e. same table name & ref
field is Sal type.)
17. Click on fields
18. Save(ctr+s)
19. local object
20. click on technical settings
21. type data class(APPLO)
22. click (bcoz A is master data so data class is APPLO)
23. size category 0
24. save
25. back(F3)
26. activate ( ctr F3)
27. to add records utilities – table contents – create entries
28. then you can type records
29. save
30. reset & store another records
31. back
32. to display the records utilities – tale contents – display
NOTE: - All key fields should come first.
-If a data element doesn’t exist, first double click on data element and it takes you to data element browser.
- For more info refer ABAP for newbie: Creating the database tables



Creating Table Maintenance Generator: because end user will not be able to access SE11.
Prerequisites: Need to have function group.
Function Groups  SE80  Dropdown Select function group.
Enter function group name  short description  Save.
Open the Database Table in change mode
Utilities  Table Maintenance generator.
Authorization Group  Enter &nc& (for no authorization).
Enter function group name.
Select Maintenance type as one step.
Over the View Screen  Click on find screen number.
Save and activate.

Creating Transaction Code for a table:
1. Goto SE93
2. Enter desired TCODE name
3. Click on Create (F5)
4. Enter Short Text.
5. Transaction with parameters
6. Transaction SM30
7. Click on GUI attribute
8. Name of screen field ( VIEWNAME UPDATE)
9. Give Value as ZDEPT_DETAILS i.e. the table name.

Domain  Data type, description
Attributes  Decimal Places  for Decimal data type.
Allows to enter how many decimal places.
It is enabled for only data type.
Output Length  When the display format is different than that of input format, we use output length,
Generally Output Length will be same or more than input length,
Color Color Code
Yellow 1
Red 2
Green 3
White 4

Conversion Routines  ZCLR
CONVERSION_EXIT_ZCLR_INPUT  YELLOW  1.
CONVERSION_EXIT_ZCLR_OUTPUT  1  YELLOW

Whenever input storage format is different from output display format (format or value), we use conversion routines.

Eg: if zclr is conversion routine, which we assign in a domain, then create two function modules 
1. Conversion_exit_zclr_input
2. Conversion_exit_zclr_output
 Sign
To display values with leading sign – we use sign for integers.

 Lower Case:
Into the database, everything is taken as upper case, if one wants to make it as mixed case – select this check box.

Value Range  In order to restrict the entries into the field, specify single value limit or intervals (value range).

Tables

Delivery Class – Specifies how table data should behave during a client copy or while upgrade.
 Data Browser / Table View Maintenance
1 – Display maintenance allowed - We can create entries into the table, we can change and we can display.
2 – Display maintenance allowed with restrictions. We can only display the data in this case user creates data through transaction.
3 – Display Maintenance not allowed. You cannot do maintenance.


Technical Settings specify how effectively we are managing table in the Database.

Data Class:
Master Data – APPL 0
Transactional Data – APPL1
Organizational Data APPL2

SIZE Category: Specifies in which portion of database, table is stored.
Size Category  0 – 0 to 24000
When 24,001 record is entered, database allocates another 24,000 records to memory but database has to take overhead of storing extra records.

NOTE: Initial chunk is same for all size category that of 24,000.

Wednesday, December 10, 2008

Data Dictionary - Introduction

Data Dictionary

The ABAP/4dictionary is central workbench repository utility providing the data definition and the information relationship that are later used in all the business application within R/3

The ABAP/4 dictionary can be seen as a logical representation or a superior layer over the physical underlying database. This database must support the relational data model. This model is strictly followed by data dictionary.

About Data Dictionary
A Data dictionary in computing terms is the source of information in which system data is defined. The data dictionary is the centralized and structured source of information for business applications. You can say that it is core of a well-structured development environment.

The elements that make up a dictionary are known as metadata. Metadata is the term for the data whose function is to describe other data. Data in dictionary is not the actual data like emp. name or emp. address but rather a type of data whose function is to define the properties of the data such as type, length, and relationship.

Advantages
Advantage of using data dictionary is avoiding inconsistencies when defining data type that will later be used in different applications. This avoids redundancies.

When a type is defined in the dictionary, it is available to any program in the application. A change in the definition of a type of data in the dictionary automatically affects any other data or program, which has this data.

Again, data dictionary is a fast and efficient way to answer questions such as which entries exist in a table of the database, what the structure of table is.


Activation of dictionary objects

For a dictionary object to be effective at runtime, that is, for a dictionary object to be available for use within a program, transaction, and so on, it must be in active status. For objects to become active, R/3 includes the ACTIVATION function.

When a table or aggregated object is activated, it is placed at the disposal of the system as a runtime object in a way that makes it available quickly for the application program to access relevant information of new activated objects.

When a dictionary object is modified, that means that the object previously existed and activated. You need to reactivate the object after modification.

When mass activation is performed massively, it might take a quite a long time. Then it should be in the background system. This type of activation is known as background activation.

The ABAP/4 Data dictionary is the central component of ABAP/4 repository. A Data dictionary is centralized and structured source of information for business application. The ABAP/4 dictionary is the core of the R/3 development system. It is the source of every definition, within R/3, from the very basic domain to the company data model. It is totally integrated with other tools of the development environment like screen painter, menu painter, and editor.

Some of the main available functions in the ABAP/4 dictionary are as follows:

• Add, delete, modify, and manage the definition of the dictionary data.
• Preserve the data integrity.
• Be the central source of information e.g. from the dictionary you get the information about the defined relationship between two tables or even the directory tells whether table is active or empty.
• It also permits documentation of system data.

In the R/3 system instead of working with original objects, you work with internal representation of objects. With this type of operation the system performance is enhanced and has the advantage that the development tools, screen interpreters always access current data.

When any of the data dictionary objects are used in other parts of the development workbench for example, in program, programmer only has to enter a table name or field name. The system automatically knows all the properties and information of the field.



To call ABAP/4 dictionary, from the main menu, Tools  ABAP/4 workbench  data dictionary or enter transaction SE11.


Data dictionary objects:

• Table: is a 2D data matrix containing rows and columns. Rows contain data while column indicates fields. Table can contain 0 or multiple rows.
• Structure: is a skeletal view of a table. It contains the definition of columns and don’t have any contents. Structure is generally a template based on which a table is created. The basic difference between structure and table is that the structure does not exist at the underlying database system level. Structure exists as definition in the dictionary.
• Views: A view is an imaginary table. It contains data, which is really stored in other tables. The contents for the view are dynamically generated when called from program.
• Data element: is definition of the properties and type for a table field. It is an intermediate object between the object type domain and the table field. A field in R/3 system is always associated with a data element, which at the same time is related to domain.
• Domain: is formal definition of the data type from a technical point of view. It sets the attributes such as data type, length, possible value range and so on.
• Lock objects: These types of objects are used for locking the access to database records in table. This mechanism is used to enforce data integrity that is two users cannot update the same data at the same time. With lock objects you can lock table-field or whole table.
• Search Help Objects: , which gives list of possible values for either primary keys or non-primary keys.


Tables in ABAP/4 dictionary

Tables are the basic objects in R/3 application. There are almost 8000 tables in R/3 system. Following types of tables are available

• Transparent tables
• Pool tables
• Cluster tables

From user point of view, all tables are used to store data whatever be the type of table. There is no difference in the behavior or operation of these tables. All of them can be managed by using standard OPEN SQL. However from an administrator point of view transparent table do exists with the same structure both in the dictionary as well as in the database, exactly with the same data and fields. While other two are not transparent in the sense that they are not manageable directly using database system tools. You can access these tables in R/3 environment from the ABAP/4 dictionary. You cannot use native SQL on these tables. Pool or cluster tables are logical tables, which are arranged as records of transparent table.

A table is made up of rows and columns. When the table is created, its columns are named; data type is supplied for each column. There can be only one data value in each column of each row in a table. Record or as it is called in different RDBMS is nothing but group of fields. While a column is a field of a table, a table is an indexed file. The main index is called as primary key, which can be a single field or combination of keys or fields. A primary key can be defined as a field, which indefinites a single unique record of the table. A table cannot have record with duplicate primary key.

In any RDBMS, tables are related to each other. But to relate table to each other it is necessary that one of the tables contain some information of other table. Mostly tables are related to each other through primary keys. The primary key of one table, if it exists in other table then it is called foreign key. This type of database management system means that there is some redundancy of data. But using normalization procedures available can minimize it. One of the most important functions of foreign key is to ensure data integrity. For example say you have EMP table, which has fields: emp. no., emp.name, dept.code, salary and you have DEPT tables, which has dept.code and dept.desc. Then in DEPT table dept.code is primary key while dept.code in EMP table is foreign key. If you enter dept.code for particular employee in EMP table the dept.code should exist in DEPT table. System will check the value for dept.code in DEPT table, and if does not exist then will flash error. In this case DEPT is called check table while EMP is foreign key table.