Friday, January 31, 2014

Events in ABAP program

There are following types of programs :


  • Executable program: These are the I program represented with the keyword REPORT. created through transaction SE38. an executable program can be called in other program using two ways - using SUBMIT keyword, using call transaction.

    These are mainly event driven program:triggered when an ABAP program loads in the memory.

  1. Load of program: this is the first to execute before any of the ABAP code is actually processed. Ideally this event trigger before the program loaded in the memory for execution. this can be used for the functions like we have to send mail every time a program is load in the memory.
  2.  Initialization: this is the first event which triggered in the ABAP program, before the selection screen loaded. this is executed after all the selection screen events are processed (i.e. parameters , select options) but not actually displayed.  so we can use this block to initialize values to selection screen elements whenever required.
  3. At selection screen output: This is the block which executed just before selection screen displayed, here we can manage the display properties of selection screen elements. like we can loop the whole selection screen and assign values for them.
  4. At selection screen: This is the first event triggers when user do any action in the selection screen. we can use this event for the selection screen validations. also in report programming we can use this to provide F1 and F4 functions to the any selection screen fields.
  5. Start of selection: This event is trigger when we press execute button in the selection screen, if no other event exist in the program this event is automatically called on F8. generally we define all our data selections inside this block.
  6. End of selection: Generally used in logical database, but in normal report programming triggers after start of selection and its last event triggered before displaying the report.
  7. Top of Page: Triggered every time a list is generated. Triggered when first write statement is executed (also ULINE, SKIP, VLINE).Top of page triggered whenever control found a write statement in the program it go to top-of-page and then come back and executes this write statement.

  •  Module pool program: These are the M type program represented with the keyword PROGRAM. there must be a transaction code with an initial screen to execute these programs. following are the four components of a module pool program.
  1.  Screens
  2. transaction codes
  3. GUI status
  4. ABAP Programs
   Module pool program also support following four events :
  1. PBO
  2. PAI
  3. POV
  4. POH

Wednesday, January 29, 2014

DATA Dictionary questions ABAP4 - Technical settings

1) What is a data class
     DATA Class in technical setting in ABAP dictionary is actually defines the physical space in the database (oracle and time space) in which your table actually stored.

You can choose data class while creating tables in ABAP dictionary and your table will automatically stored in to the correct place in database.

There are three mainly used data classes are available in R/3 system:
1) APPL0 (Master Data) : data that is frequently read but rarely updated. an example may be the address book (name address telephone etc..)
2) APPL1 (Transaction Data) : data that is frequently updated. an example may be goods in the ware house which are changed after each purchase order.
3) APPL2 (Organisational data / customization data) : these are the data stored when system are initialized and then rarely changed. like in table with the country codes.

there are USR and USR1 data classes which are reserved for user developments. You can create your own data class (not recommended though) under USR and USR1.

2) What is Size Category 
we use size category to define the expected space for the table in the database.
Size category determines the probable space requirement for your table in the database. you can select the storage category from 0 to 4, each storage category have specified fixed storage area in the database. total size category are 0 to 8.
while creating table in the data base an initial space is assigned to the table. later if more space is required due to the data stored in the table.

3) Buffering status
buffering status specifies whether or not table will be buffered.
Buffering not allowed
Buffering allowed but not activated - buffering type is only a suggestion
Buffering allowed - buffering type mandatory

Single record buffering: 
Only records of table that are really accessed are buffered. useful when we have a large table data and we frequently used SELECT SINGLE to this table.
Generic Buffering:
When a record of the table is accessed all the record in the table having this field in the generic key fields are loaded in the buffer.
Full buffering:
The system buffer all the records of the table when one record of the table is accessed.

4) Log save data changes : logs of the table can be viewed through through SCU3 transaction.

5) Enhancement category : 
=======================================================================
Data dictionary 
Table : carry data 
structure : no data 
internal table : data 
work area : data but only 1 record at a time. 
master data: Frequently used but data which not frequently updated. 
Transactional data/business data : frequently used and frequently updated. 
SAP data management sales order:  
TCODE : VA01 - Sales order creation. VA02 VA03. 
Tables : VBAK - header table for sales order (sales document header data) 
VBAP - Sales order line data 

------------------------------------------------------------------------------------------------------------------------ 
Package: package is a kind of grouping. 
Delivery class: A,C.L,O,E,S,W 
  • Application table : (A) : master and transactional data 
  • Customized table : © : like something provided by SAP and you want to change/customize it. maintained only by customer. 
Accessed by functional consultant. 
  • Key fields : Primary Index generated automatically with primary key. 
  • Secondary index: SAP sort the data and store it in the buffer called index. we should try to limit the number of the secondary indexes. 
  • Foreign key check : check table key field of one table is field in other table. 
  • Currency/quantity field:  
  • Data Element : Semantic meaning.  
  • Domain : technical attributes fro data element. (CHAR10 ex) 
Technical Settings: 
  • Data Class: type of data we are going to store. master data , transactional data APPL0 , APPL1. 
The data class defines the physical area of the database (for ORACLE the TABLESPACE) in which your table is logically stored. If you choose a data class correctly, your table will automatically be assigned to the correct area when it is created on the database. 
 The most important data classes are (other than the system data): 
 APPL0    Master data 
APPL1    Transaction data 
APPL2    Organizational and customizing data 
Master data is data which is frequently read, but rarely updated. Transaction data is data which is frequently updated. Organizational und customizing data is data which is defined when the system is initialized and then rarely changed. 
 There are two more data classes available, USR and USR2. These are reserved for user developments. The tables assigned to these data classes are stored in a tablespace for user developments. 
 Note:The data class only has an effect on table storage for the database systems ORACLE and INFORMIX. 

  • Size Category: data range. how much data you want to store. number of records. 
The size category determines the probable space requirement for a table in the database.  
You can select the categories 0 to 4 for your table. Each category is assigned a specific fixed storage area value in the database. When you create a table, initial space is saved for it in the database. If more space is required later as a result of data that has been entered, the storage space is increased in accordance with the category selected.  
Press F4 on the field Size category to see the number of data records that can be maintained for the individual categories of your table without complications ensuing. These complications could be for example a reorganization becoming necessary because the maximum space to be reserved for the table was exceeded due to the maintained size category. 
  •  buffering status: The buffering status specifies whether or not a table may be buffered. 
This depends on how the table is used, for example on the expected volume of data in the table or on the type of access to a table. (mainly read or mainly write access to the table. In the latter case, for example, one would not select buffering). 
You should therefore select 
- Buffering not allowed if a table may not be buffered. 
- Buffering allowed but not activated if buffering is principally allowed for a table, but at the moment no buffering  should be active. The buffering type specified in this case is only a suggestion. 
- Buffering allowed if the table should be buffered. In this case a buffering type must be specified. 
  • Single record buff 
  • Generic area buffered 
  • full data  

  • Append Structure:  
  • Include Structure: 

  • Maintenance view:  

  • Transparent table : one to one relationship between the key fields and other fields of table. the against one key field there will be only one entry in the table. 
  • Table Cluster (cluster table): one to many relation ship. Against the one key field there may be many entries in the table. key fields of the cluster tables must be same. (or at least few starting key fields on which we define a cluster table.) 
Several logical data records from different cluster tables can be stored together in one physical record in a table cluster. 
Field 
Data type 
Description 
CLKEY1 
* 
First key field 
CLKEY2 
* 
Second key field 
... 
... 
... 
CLKEYn 
* 
nth key field 
Pageno 
INT2(5) 
Number of the continuation record 
Timestamp 
CHAR(14) 
Time stamps 
Pagelg 
INT2(5) 
Length of the string in Vardata 
Vardata 
RAW (n) 
Contains the entries from the data fields of the assigned cluster tables as a string. The maximum length n depends on the database system used. 

  • Table pool : many to many relation. no concept of key fields.  
A table pool corresponds to a table in the database in which all records from the pooled tables assigned to the table pool are stored. 
The definition of a pool consists of two key fields (Tabname and Varkey) and a long argument field (Vardata). A pool has the following structure: 
Field 
Data type 
Description 
Tabname 
CHAR(10) 
Name of pooled table 
Varkey 
CHAR (n) 
Contains the entries from all key fields of the pooled table record as a string. The maximum length for n is 110. 
Dataln 
INT2(5) 
Length of the string in Vardata 
Vardata 
RAW (n) 
Contains the entries from all data fields of the pooled table record as a string. The maximum length n depends on the database system used. 





  • Table maintenance Generator:  
 - one step maintenance : only one screen. 
               - two step maintenance : one screen for entry data and other for display data. 

View in SAP ABAP SE11: 
  • Maintenance View : SM30 (TMG) 
  • Database view : View for displaying data for more than one table. this is based on the common key fields of both the tables. or it is called reference key. 
  • Help View: ??????? 
  • Projection View: ?????? 

Lock Objects :  ?????????? 

Currency and quantity fields : always when we declare these fields in our SE11 table we must add a reference to another standard SAP table. 

Search Help :  ???????????? 

Include and append structure: 
  • Append structures are used for enhancements that are not included in the standard. An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure. 
  • Append structures can only be added to one table. 
  • if a table/structure with append structure is copied , fields of the append structure will become field of the target table. 

  • Includes are used to group fields, an include structure can be assigned to many tables. If you add a fields to an include structure, all tables/structures, which contain that include structure, will be updated too. 

 ========================================================================================