Extended Table Maintenance Events

2
Added by Deepti T U, last edited by Bhumika Mahawar on Feb 11, 2009 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 Extended Table Maintenance Events We can generate database table and view maintenance dialogs to maintain customizing data and also modify maintenance dialogs flexibly to the requirements by defining variants of an existing maintenance view, or adding our own modules to existing maintenance dialogs. Such modules will be called as a PBO event or PAI event as defined and required. Let's consider a simple example where in we need to populate the customer name when the customer number is entered in the cust-id field in SM30 screen. On the creation of this new entry, i.e., when we press the "ENTER" key. The possible solution of populating the cust-name in SM30 screen might be accomplished with a PAI event. But in SM30 screen, the table fields are referred in system defined structures (example : <vim_extract_struc>). And populating them back to this standard ALV will be a cumbersome task. Here is where table events come handy. It can be summarized as: Events allow us to change the generated table maintenance dialog at predefined positions, which cannot be reached by user modules in the screen flow logic. The user routines are called dynamically at runtime. For this reason, the routines must be in a user include in the table/view maintenance dialog function group. All extended table maintenance global data is available. Implementing Table maintenance Events The table maintenance generator screen is accessed either via SE54 or via SE11. SE11->Database Table->Utilities->Table Maintenance Generator. In the table maintenance generator screen follow the path Environment->Modificationà Events 2. In the Screen, Click on the new entries. Select a desired dialog event. The events can be additions or replacements. (follow the link to learn more) http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm 4. Now specify a form routine name. On clicking on the editor (the 3 rd field in display), a new include name is proposed. Select the desired one and you can insert your lines of code here. Write the code inside a "FORM.... ENDFORM", since these routines are dynamically called corresponding to the dialog events we have specified.We do not need to specify the PERFORM explicitly. The record created can be referred dynamically as <table-name> - <fieldname>. For example- Ex: The values can be assigned as: ZTRIAL-ZDATE = sy-datum General Case Study: Consider a case when we have to enter the timestamp when a record was created or entered in the table. This requirement is such that, the timestamp should be calculated only when the record is created, not at the time of saving. We create the required table which holds the information of customer in each company code. We create the table maintenance generator. And then create the event. SAP Community Network Wiki - ABAP Development - Extended Tab... http://wiki.sdn.sap.com/wiki/display/ABAP/Extended+Table+Mainten... 1 de 2 22/03/2013 14:38

description

Extended Table Maintenance Events

Transcript of Extended Table Maintenance Events

  • Added by Deepti T U, last edited by Bhumika Mahawar on Feb 11, 2009

    Welcome, GuestLoginRegister

    Getting StartedNewslettersStore

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

    Extended Table Maintenance Events

    We can generate database table and view maintenance dialogs to maintain customizing data and also modify maintenance dialogs flexibly to the requirements by defining variants of an existingmaintenance view, or adding our own modules to existing maintenance dialogs. Such modules will be called as a PBO event or PAI event as defined and required.

    Let's consider a simple example where in we need to populate the customer name when the customer number is entered in the cust-id field in SM30 screen. On the creation of this new entry, i.e.,when we press the "ENTER" key. The possible solution of populating the cust-name in SM30 screen might be accomplished with a PAI event. But in SM30 screen, the table fields are referred insystem defined structures (example : ). And populating them back to this standard ALV will be a cumbersome task.

    Here is where table events come handy.

    It can be summarized as:

    Events allow us to change the generated table maintenance dialog at predefined positions, which cannot be reached by user modules in the screen flow logic.

    The user routines are called dynamically at runtime. For this reason, the routines must be in a user include in the table/view maintenance dialog function group. All extended table maintenance globaldata is available.

    Implementing Table maintenance Events

    The table maintenance generator screen is accessed either via SE54 or via SE11.

    SE11->Database Table->Utilities->Table Maintenance Generator.

    In the table maintenance generator screen follow the path

    Environment->Modification Events

    2. In the Screen, Click on the new entries. Select a desired dialog event.

    The events can be additions or replacements. (follow the link to learn more)

    http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm

    4. Now specify a form routine name.

    On clicking on the editor (the 3rd field in display), a new include name is proposed. Select the desired one and you can insert your lines of code here.

    Write the code inside a "FORM.... ENDFORM", since these routines are dynamically called corresponding to the dialog events we have specified.We do not need to specify the PERFORM explicitly.

    The record created can be referred dynamically as - .For example-

    Ex: The values can be assigned as: ZTRIAL-ZDATE = sy-datum

    General Case Study:

    Consider a case when we have to enter the timestamp when a record was created or entered in the table. This requirement is such that, the timestamp should be calculated only when the record iscreated, not at the time of saving.

    We create the required table which holds the information of customer in each company code.

    We create the table maintenance generator. And then create the event.

    SAP Community Network Wiki - ABAP Development - Extended Tab... http://wiki.sdn.sap.com/wiki/display/ABAP/Extended+Table+Mainten...

    1 de 2 22/03/2013 14:38

  • Since this event has to be called during the creation of the record, we choose the event - 05.

    And insert this piece of code after creating a new include (click on the "Editior" tab).

    After activating and running the SM30 transaction, we can get the field populated accordingly.

    Enter labels to add to this page:

    Looking for a label? Just start typing.

    Child Pages (1) Using selection-screen in Table Maintenance Generator

    Follow SCN

    Contact UsSAP Help Portal

    PrivacyTerms of UseLegal DisclosureCopyright

    SAP Community Network Wiki - ABAP Development - Extended Tab... http://wiki.sdn.sap.com/wiki/display/ABAP/Extended+Table+Mainten...

    2 de 2 22/03/2013 14:38