EVENTS IN TABLE MAINTENANCE.pdf

6
Added by sumit j, last edited by Moshe Naveh on Jul 11, 2010 Welcome, Guest Login Register Getting Started Newsletters Store Solutions Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation EVENTS IN TABLE MAINTENANCE Link to Content's target Space : http://wiki.sdn.sap.com/wiki/ Applies to: SAP ECC 6.0. Summary This document provides a detailed description on how to implement the table maintenance events which is very helpful while creating new entries in a table. Many validations and checks can be performed while creating or saving entries in a table. Author(s): Sumit Joshi Company: L&T InfoTech Created on: 30 June 2010 Author(s) Bio Sumit Joshi is a software engineer working with L&T InfoTech for the past one year as an ABAP developer. Table of Contents Link to Content's target Space : Applies to: Summary Author(s): Sumit Joshi Validation on table maintenance Event Handling Create a table ZTAB with the following fields: Create a table maintenance generator for the table: Create Events for table Maintenance: Create Transaction Code: Execute the transaction code: Related Content Validation on table maintenance 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 ZTAB with the following fields: Useful Information Short quick summary to catch the reader's attention and of course the search engine SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL... 1 de 6 22/03/2013 14:49

Transcript of EVENTS IN TABLE MAINTENANCE.pdf

  • Added by sumit j, last edited by Moshe Naveh on Jul 11, 2010

    Welcome, GuestLoginRegister

    Getting StartedNewslettersStore

    SolutionsServices & SupportAbout SCNDownloadsIndustriesTraining & EducationPartnershipDeveloper CenterLines of BusinessUniversity AlliancesEvents & WebinarsInnovation

    EVENTS IN TABLE MAINTENANCE

    Link to Content's target Space :

    http://wiki.sdn.sap.com/wiki/

    Applies to:

    SAP ECC 6.0.

    Summary

    This document provides a detailed description on how to implement the table maintenance events which is very helpful while creating newentries in a table. Many validations and checks can be performed while creating or saving entries in a table.

    Author(s): Sumit Joshi

    Company: L&T InfoTechCreated on: 30 June 2010Author(s) BioSumit Joshi is a software engineer working with L&T InfoTech for the past one year as an ABAP developer.

    Table of Contents

    Link to Content's target Space :Applies to:SummaryAuthor(s): Sumit Joshi

    Validation on table maintenanceEvent Handling

    Create a table ZTAB with the following fields:Create a table maintenance generator for the table:Create Events for table Maintenance:Create Transaction Code:Execute the transaction code:

    Related Content

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

    Event HandlingWhen we provide event handling on table maintenance, table fields will be updated automatically when a new record inserted into thetable 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 isas follows:

    Create a table ZTAB with the following fields:

    Useful InformationShort quick summary to catchthe reader's attention and ofcourse the search engine

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    1 de 6 22/03/2013 14:49

  • 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 Eg: ZBC420XX

    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

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    2 de 6 22/03/2013 14:49

  • 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 following code in include for this event.

    FORM new_entry.

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    3 de 6 22/03/2013 14:49

  • DATA: v_nchar TYPE i. CONSTANTS: c_conlimit TYPE i VALUE 3.

    ztab-changed_by = sy-uname. " current user ztab-create_date = sy-datum. " current date ztab-create_time = sy-uzeit. " current time

    * Validation on Country Field v_nchar = STRLEN( ztab-country ). IF v_nchar NE c_conlimit. MESSAGE i536. ENDIF.ENDFORM. "New_Entry

    Create Transaction Code:

    Create a transaction code to run the table maintenance generator.Go to Tcode SE93Transaction code: ZTABShort text: Test Table Maintenance EventsStart Object: Transaction with parameters (Parameter Transaction)

    Transaction: SM30Skip first Screen: Check ONDefault Values:View Name ZTABUpdate X

    Execute the transaction code:

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

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    4 de 6 22/03/2013 14:49

  • Now provide a valid value in country field and remain blank another fields.

    Click Enter (NEW_ENTRY event will trigger) and current User, date and time will be automatically filled in respective fields.

    Save the entry and check in table.

    One more entry by table maintenance:Write country code as US in place of USA and press EnterInformation message shown that entry was not saved.

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    5 de 6 22/03/2013 14:49

  • Now provide USA as country code and save entry.

    Related ContentPlease include at least three references to SDN documents or web pages.Reference 1

    Reference 2

    Reference 3

    Labelsstandard standard Deletetemplate template Deletedocument document Deletepaper paper Deletearticle article DeleteEnter labels to add to this page:

    Looking for a label? Just start typing.

    Comments (3)

    Follow SCN

    Contact UsSAP Help Portal

    PrivacyTerms of UseLegal DisclosureCopyright

    SAP Community Network Wiki - ABAP (ABAP Development) ... http://wiki.sdn.sap.com/wiki/display/ABAPch/EVENTS+IN+TABL...

    6 de 6 22/03/2013 14:49