Sunday 29 July 2012

Basics of ABAP : Creating T-Code for a Table maintenance generator


Create a transaction code to run the table maintenance generator.
Go to Tcode SE93
Transaction code: ZTAB
Short text: Test Table Maintenance Events
Start Object: Transaction with parameters (Parameter Transaction) 
Transaction: SM30
Skip first Screen: Check ON
Default Values:
View Name      ZTAB
Update           X

Execute the transaction code:

Execute the transaction code ZTAB and click on New Entries button. 

Now press the new entries button, You can able to enter the new entries into the table.

Basics of ABAP- Adding Custom Events in Table maintenance generator



While creating the tables, sometimes we may need to update the table fields in the background. For example, if we create a table with 10 fields and in those 10 fields there are 2 fields which are User name and the Date, these 2 fields should update automatically when a record Inserted/Updated in the table. It also can be used when we want provide various validations on creating, changing or saving entries in a table.

Event Handling

When we provide event handling on table maintenance, table fields will be updated automatically when a new record inserted into the table or an existed record changes through the table maintenance generator.
To achieve the event handling in table maintenance, we need to create a table maintenance generator and then create events. Process is as follows:


Create a table maintenance generator for the table:

To create table maintenance generator go Utilities -> Table Maintenance Generator and provide following information:
Authorization Group: &NC&
Function group: Any suitable FC 
Maintenance type: Two Step
Maint. screen no: Overview screen 8005
                             Single screen    8006
Click on Create. 

Create Events for table Maintenance:

To create events on table maintenance go to Environment -> Modification -> Events -> New Entries 

List of events available:
Choose maintenance event 05-Creating New Entry and provide a name of the event (This will become perform/subroutine).
Click on Editor Button to provide event handling code. 

A popup will be appear, It will ask to create an include program, in which we'll write the event handling code.
Click on continue.

 
Write the code in include for the event in the include created