Search This Blog

Friday, February 19, 2010

ABAP Dictionary: Table Creation in SAP


  • We create tables in SAP by using the transaction SE11.
  • We have three Major parts to be defined while creating a table.
1) Delivery & Maintenance
2) Technical Settings
3) Fields

In Delivery & Maintenance we have different options.


Delivery:
  • A à Application table à Table cannot be altered. I.e., the structure of the table cannot be altered. But Read/Write/Delete and Change permissions are allowed for data.             
  • C à Custom table à Table structure can be altered. R/W/C & D permissions are allowed.
  • Gà Custom table with no modifications. à No update and no delete.
  • L à Temporary table. à This is used for session management. Data is stored only from login time to logout time and not permanently.
  • S à System table à SAP tables. These are used to hold application server information. ABAPer cannot use this option.
Maintenance :
This has three options.

1) Allowed
2) Allowed with restrictions
3) Not allowed.


Technical Settings:
We have two sub options in this.

  1. Data Class à APPL0 à Master table. Writes are less, Reads are more.

        à APPL1 à Transaction table. Writes are more, Reads are less.
  2. Size Category à 0 to 6.    (Determines the expected number of rows in the table. However this will not limit the number of rows created)

Fields: While creating fields in tables, we should associate some DATA TYPES to them. We can create tables with direct data types associated to the fields or by associating the Dictionary data types.
  1. Creation of tables with direct data types has the following drawbacks.
    1. Data is global for all clients.
    2. Data in current R/3 can't be communicated with another R/3.
    3. Table to Table relation is not possible.
    4. Search Helps can't be created. 
Dictionary DATA TYPES:                    


INT1 à Integer with 1 byte of memory (Can accept 255)
INT2 à Integer with 2 bytes of memory (Can accept upto 35,000)
INT4 à Integer with 4 bytes of memory (Can accept upto 10 digits)
FLTP à Float data type.
DEC à Decimal data type. Similar to packed data type.
CHAR à Character data type. Similar to type C.
NUMC à No. in form of character. Similar to type N.
TIMS à Time data type. Similar to type T.
DATS à Date data type. Similar to type D.
LANG à Language data type.
QUAN à Quantity data type.
CURR à Currency data type.
CUKY à Currency key. This is used along with above data type.
CLNT à Client data type.
RAW à Large objects.                            
LRAW à Large objects with binary format.

Primary Key:Whenever a table is created in SAP, the first field must be a primary key field. Else, SAP generates error.

    Primary key has three properties.
        1) Unique.
        2) Not Null.
        3) Tables Relationship.
  • All department tables are Transaction tables.
  • Table creation has two processes. Top to Bottom approach and Bottom to Top approach.
  • SAP uses Bottom to Top procedure. It is preferable.

DATA ELEMENT: It is a dictionary object in SAP assigned to a domain as label, to be reused by TABLES, IDOCS and Search-helps.

DOMAIN: It is also a dictionary object in SAP assigned with a data type and with constant size.
FAQ: Can we create tables in SAP without DATA ELEMENTS?
Ans à YES (But not recommended).


Navigations to create a table:

à SE11.                       
à Select Object type as 'TABLE'.
à <Create>,
à Opens an interface. Enter description.
à Set delivery class as 'A'.
à set 'Table Maintenance is allowed'.
à Click on 'fields' tab button.
à <Built in type>.
à Name the field. Assign with data type.
à Set the size (Ex: Cname: char(30), city: char(30). )
à Select first field as key field.
à <save>. Assign a request number.
à Click on 'Technical Settings' tab button.
à Opens another interface. Set the data class as 'APPLO/APPL1'.
à Set the size ( o to 6 ). <save>
à F3
à Activate the table.

No comments:

Post a Comment