Monday, May 7, 2012

ABAP Dictionary

ABAP dictionary is the information base for all developers. This manages all the definitions required for different applications in SAP. ABAP dictionary is completely integrated into ABAP development workbench. All component of ABAP development workbench can access the data definitions stored in data dictionary.

OBJECTS TYPES OF ABAP DICTIONARY

  1. Domain
  2. Tables
  3. Data element
  4. Views
  5. Types
  6. Search help
  7. Lock object

DOMAIN
This describes the technical characteristic of a table field. Specifies the value range which describes allwed data for the fields.Fields referring to the same domain are changed when there is a change made to the domain.
TABLES
They are defined in ABAP dictionary independent of the database.A table having the same structure is then created from this table definition in the underlying database.

DATA ELEMENT
They defines role played by the field the technical context. Fields of the same semantic meaning can refer to the same data element.

TYPE GROUP
While waiting prog we use type command to define data. SAP has defined some frequently used types. For ex SLIS , ABAP. In a prog u can write type-pools and mention the name. Then u can use the types mention in the type goup.


SEARCH HELP
We can create search help for the ztables . U have to use the key field and other fields u wish to create help for.

LOCK OBJECT
In SAP when a person access a particular prog or table it immediately locks  that thing for the user. Similarly when u create a table or anything in SAP u should put a lock, u should also unlock the table after u execute it. 

VIEW
This is used to a view a table or multiple tables combined.



Tuesday, May 1, 2012

Lock Object

In a normal SAP screen. SAP will already have a lock on the screen. By lock we mean that when a user first clicks a prog, sap locks the prog for this user. When some other user tries to operate that same prog, then the user can not access the prog.
When u create a t code you have to put a lock for that t code. So to create a lock  go to se11 and click lock object. The name for lock object will always start with ez.
Then give a short description.
u should give the name of the table .
For ex the table name is zsc_data, the lock object name will be ezsc_data.

Now u should give whether it should be a write lock or read lock or exclusive lock.
Read lock means it will not display or let u change.
write lock means it will not let u change, it will display.
exclusive lock means it is exclusive lock.

Then go to the Lock parameter tab.
The mandt and the primary key will already be there, u want lock on any other field u should mention it.

When u create a lock there will be enque and deque object. Enque  is for locking and deque is for unlock.
In se38 u use call function

CALL FUNCTION 'ENQUEUE_EZSC_DATA1'
 EXPORTING
*   MODE_ZSC_DATA1       = 'E'
*   MANDT                = SY-MANDT
   MATNR                =
*   X_MATNR              = ' '
*   _SCOPE               = '2'
*   _WAIT                = ' '
*   _COLLECT             = ' '
 EXCEPTIONS
   FOREIGN_LOCK         = 1
   SYSTEM_FAILURE       = 2
   OTHERS               = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'DEQUEUE_EZSC_DATA1'
 EXPORTING
*   MODE_ZSC_DATA1       = 'E'
*   MANDT                = SY-MANDT
   MATNR                =
*   X_MATNR              = ' '
*   _SCOPE               = '3'
*   _SYNCHRON            = ' '
*   _COLLECT             = ' '
          .
If u want to view the lock object u need to go to sm12.
then enter the table name.and press f8.
if u want to delete the lock u can right click on it and release the lock. U can release the lock only when u have authorization to do that. U will have authorization release your own lock. But to release others lock u will need authorization.



ABAP SCREENS

TCODE SCREEN NAME
SE01/SE09 TRANSPORT ORGANISER
SE11 ABAP DICTIONARY
SE19 BADI BUILDER
SE21 CREATING A PACKAGE
SE24 CLASS BUILDER
SE37 FUNCTION MODULE BUILDER
SE38 ABAP EDITOR
SE80 OBJECT NAVIGATOR, MODULE POOL PROG
SE84 REPOSITORY INFORMATION SYSTEM
SE93 MAINTAIN TRANSACTION CODE (TCODE)
SHDB TRANSACTION RECORDER
MM01 MATERIAL CREATION
FI01 BANK CREATION
LSMW LSMW
SMARTFORMS SMARTFORMS
SAPSCRIPTS SAPSCRIPTS
I18N MSWORD AS SMARTFORM EDITOR
NACE OUTPUTCONTROL FOR DIFF MODULE CONFIG
NAST CHECK ENTRIES IN A LOG
SM30 MAINTAIN TABLE
SM12 LOCK OBJECTS
SPRO CUSTOMIZING TABLE
SU53 DISPLAY AUTHORIZATION DETAILS

How to create a functional module

A function module can only be created within a function group.
To create a function group click goto-function groups- create function group.
give a name for the function group then give a short text.

click Goto -main prog.
It will have 2 include prog.
1-maintop
1-mainuxx
in the first prog u can define variables and other things which u can use in the any of the function modules which come under that.
in the second one all the function module which falls under it will appear.

Go to SE37.
give a functional module name with z  and press f5 or press create.
In Import tab type parameter name type data element name in associated type and if you want to give it a default value. u can give it now in the default value column and u press enter, the short text will get filled automatically.


In export tab give a it table name. For that create a table type in se11.
Creating in se11.
click on table type. give a name with z  and press f5 or press create.
in short text  give a short description. In line type give the table name, u want it to take the structure of .
and press activate and save.

now go to se37 screen and give the table type in the function module creation screen and press enter.

go to exceptions. Give the possible exceptions that the system will throw out.
now goto source code and do a  select command. write a sy-subrc in that in the else command give RAISE and the name of the exception.

In Attributes, u can select either normal function module or remote enabled module(RFC).
If it is RFC then it can be accessed by softwares other than SAP. It is mainly helpful for BAPI.
If it is rfc the all the field in the function module should be passed only by value.
That means in Import , export and other tabs u should put tick on pass by value field.
If it is not rfc it is not nessary to pass by value.
Now save and activate.