Events in table maintains genrator

hi gurus,
events in table maintains generator..... 
regards,
praveen

While creating the tables, sometimes we may need to update the table fields in the background
Lets take an example, if create a table with 10 fields 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.
For this, we need to create a table maintenance generator for that table. There in the table maintenance generator we have an option to create EVENTS.
In the table maintenance generator, Environment --> Modifications --> Events then a screen will be appear here,we need to create the Events, for updating the fields create 05(Creating a new entry) and 21(Fill hidden fields) .
In the EVENTS screen, press new Entries, there give 05 and give a name(This will become a PERFORM), then click the Editor pushbutton, this will be there at the right side of the entry, then a popup will be appear, you can create an include program, there inside of the include program write the below code
form CREATE_ENTRY.
TABLE-USERNAME = sy-uname.
TABLE-CHANGED_ON = sy-datum.
endform.
Then in the events screen enter 21 and give the form name as HIDDEN_FIELDS, then press the editor button, then in the editor
form HIDDEN_FIELDS.
TABLE-USERNAME = sy-uname.
TABLE-CHANGED_ON = sy-datum.
update TABLE.
endform.
This CREATE_ENTRY Perform will be triggered for every new entry and the HIDDEN_FIELDS fields will be triggered for every changed value in the table, so the Fields USERNAME and the CHANGED_ON fields will be updated automatically when a new record inserted into the table or an existed record changes through the table maintenance generator.
If you want any more functions, and then look at the events, you can press the F4 and look at the description of the event, then you come to know how to use and where to use.
Check these links
http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm
http://abapliveinfo.blogspot.com/2007/12/events-in-table-maintenance-in-sap.html
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-8765287250fc
Regards,

Similar Messages

  • How to add the buttons on the Table maintains genrator

    Hello Experts,
    I have a table maintains generator, I have to add the sort ascending and sort descending button on the screen. and when user select any one column of that generator and then click on sort ascending or sort descending button, then it has to sort accordingly.
    Can anyone please guide me in this issue.
    Thanks
    Chetan.

    Hi,
    Go to the function group that is generated for your table maintanence and edit it and add buttons to the screen layout and handle then in PAI of that screen.
    based on selection sort and display the data.
    hope this solves your question.
    regards,
    Jayaram.M

  • Putting Validations in the event of table maintainance generator

    Hi All,
    I have one table with 4 fields. 3 are key fields. Now requirement is to put a perticular error message in the maintainance screen, when the combination of field1, and field2 is used more than once .
    Currently I am getting the inbuilt error message that entry already present with the same key value.
    I want to put my own error message instead.
    I tried to put the code in event 05--(Creating new entry) . But the problem is  that here it doesnot differentiate between, new , entry, changed entry and unchanged entry. So what ever thing I do...the error message is coming .This is to state that , in this case in the event 05, <action> is not having any value...that we can use for differentiation.
    Is there any way...thru which we can put this error message only for new entries...?
    Hope the above explanation is clear....or else please get back....
    Kindly suggest the needful...
    Regards
    Rudra

    hi
    u need to loop the generic table TOTAL and chek which kind of action is aasigned to certain record:
    LOOP AT TOTAL.
        CHECK <ACTION> = NEUER_EINTRAG.
    *-------> New record
        READ TABLE EXTRACT WITH KEY TOTAL.
      ENDLOOP.
    The value stored in <ACTION> indicates if the record is new or changed
    Max

  • Selection screen event in tbale maintainance generator

    Hi experts,
         I had created Table maintainance for Ztable..Now req is i have to some of the delete the entries of table based on input values of user.Now table maintainance displayin all the entries of database table.but before entries to be deleted i want one selction screen .so user can give the vlaues..based on the it will display that correspoinding entries to be deleted..then user can delete the entries..
    for this can anybody tell me what is correct event in table maintainance generator..i mean before going to display the entries i wnat one selection screen ..
    Can any body plz help me..
    Thanks in advance,
    Praveena.
    Moderator Message: Do some R&D first.
    Edited by: kishan P on Nov 30, 2010 9:48 AM

    Try to check when user requests for batch, not when  batch is running, when sy-batch is initial and function code is execute in background.
    AT SELECTION-SCREEN.
      IF sy-batch = IS INITIAL AND sscrfields-ucomm EQ 'SJOB'.
        IF p_layout IS INITIAL.
          MESSAGE e226(ZMG) "Please fill the layout field.
        ENDIF.
      ENDIF.
    Regards,
    Raymond

  • Genaric Include in event of the table maintainance genatrator

    hi,
    i want to create a include that should be genaric ( it should work for all tables )  to  update the fileds like creator name, create date, change name and change date which are in the include structure .
    this include can be used in the event of the table maintainance genarator . this should work for all tables.
    can any one help me in this regard.
    cheers,
    srak.

    any updates...
    cheers,
    srak.

  • How to get customer name automatically in table maintainance generator

    Hi all,
    I am having a table maintainance generator in which ship to party is the primary key, i need to add another column customer name
    fetched from KNA1, i tried using the event
    5.new entries creation, creating a new perform
    but the code which i am writing gives an error "Statement in accessible".
    Kindly help.

    Hi Manohar,
    Thanks for your help, Its working now.
    Issue resolved.

  • Transporting table and table maintainance generator

    Hi,
    Can i transport the table and table maintainace generator and function group of the table with in single request or not.
    One more thing is when i transport the table maintainance generator,will the entries also be transport to another system or not.
    Thanks in advance,
    Suresh

    Hi Suresh,
    Go to SE54-> Utilities-> Total Transport. The following things are transported.
    The total transport transports the complete maintenance dialog:
    authorization group
    authorization group assignment
    control entry
    events
    function groups
    maintenance objects
    variants
    Content wont be transported it seems.
    Thanks & Regards,
    Nagaraj Kalbavi

  • Problem in table maintainance generator

    Hi,
    I have  a requirement in table maintainance generator i.e. when I clcik on se11,enter the table name and then click on new entries ,my table control that I see on the screen will have some entries that were entered earlier.
    But in my case the entire table control has to be blank when I click on new entries and it should be in output mode only.So please can someone tell me how I can clear the entries .Which event should I use for this?
    Another requirement is that for my table maintaianance generator,I have been asked to remove on field from the table control and place it above the table control as a text field.Now this text field is a key field.When I enter some value in this text field and click on enter,it should give me the values corresponding to this key field.Please can someone help me out with this?Which event should I use for this?
    Regards,
    Sushanth H.S.

    Hi Sushant,
    Considering there are considerable modifications to your table maintenance I would suggest you create a small module pool transaction for your requirement with a table control and code the flow logic (PBO/PAI) yourself.
    For the DB update, you can use the SQL commands. Since it would be an alternative to the table maintenance for a single table, I think the database update part wouldnt be complex to handle at all.
    You would need a table control same as the one in the maintenance however a wizard will make that job very easy for you.
    Finally, assign a transaction to your module pool and you are good to go.
    This is in my opinion not a complex development and also would be easier than trying to modify a SAP generated table maintenance, because adding a text field on top etc. would be drastic changes which cannot be accomplished by events alone.
    Cheers.

  • How to get serial no automatically in table maintainance generator

    Hello Experts,
    I am building table maintainance generator in that i want the serial number shold be displayed or generated for new entry automatically.
    please mind this, i am going to put more that one entry at single time and my serial number field is primary key in table .
    Thanks,
    Gaurav

    In table maintenance we can add an event during new entries creation, in that add code to read the table for the last entry and increment one to it. Hence whenever a new entry is created serial number value is generated.

  • Problem in the table maintainance generator of View J_3RFV_F4VERS

    Hi All,
    I have a problem with View J_3RFV_F4VERS (SAP standard table for Russia).
    Currently i am not able to change the entries in this View through SM30. Currently in the Table maintainance generator of this view "Standard recording Routine" is selected as Recording Routine.
    But when i change this to "no, or user, recording Routine", i am able to change the entries of this view through SM30.
    I would like to know the impact of selecting the alternative Recording Routine. Will it have any adverse impact?
    Please throw some light on this issue.
    Regards,
    Navin.

    Use Events in Table Maintainence Generator.
    Environment-->Modification --> Events
    U can write a subroutine which can be called to increment the numbers .

  • In table maintainance generator

    hi
    in table maintainance generator, how to validate the data entered in the table. If it is only with the events, how?

    hi,
    you can validate the data in tables, after generating a table maintanance generator.
    Environment->Modification->Events.
    After providing the subroutine name you can go to editor( click on icon provided just besides the form routine) and write the logic for validation.
    for example, if changes are to be made to the data of particular controlling area, a check has to be made if the user is authorised to make changes. Below is a sample code that would give you an idea.
    Sample code:
    *&      Form  auth_check_save
          Checks that the user has the correct authorisations to Change
          details of Controlling Area. If not error message is to be
          displayed on the screen.
    form auth_check_save.
    Data Declaration
    Types
      types:  begin of ty_valtab,
               kokrs(4) type c,
               actvt(2) type c,
             end of ty_valtab,
             begin of ty_fieldtab,
               fieldname(10) type c,
             end of ty_fieldtab.
    Internal Tables
      data:  lt_valtab    type standard table of ty_valtab,
             lt_fieldtab  type standard table of ty_fieldtab,
    Structures
             ls_valtab    type ty_valtab,
             ls_fieldtab  type ty_fieldtab,
             ls_costele   type ztf_costele,
    Variables
             l_status     type zss_rfc_status,
             l_st(1)      type c.
    Constants
      constants : c_0(1)        type c value '0',
                  c_01(2)       type c value '01',
                  c_02(2)       type c value '02',
                  c_06(2)       type c value '06',
                  c_authobj(10) type c value 'Z_KOKRS',
                  c_error(5)    type c value 'ERROR',
                  c_partial(7)  type c value 'PARTIAL',
                  c_kokrs(5)    type c value 'KOKRS',
                  c_actvt(5)    type c value 'ACTVT'.
      clear l_status.
      ls_fieldtab-fieldname = c_kokrs.
      append ls_fieldtab to lt_fieldtab.
      clear ls_fieldtab.
      ls_fieldtab-fieldname = c_actvt.
      append ls_fieldtab to lt_fieldtab.
      clear ls_fieldtab.
      loop at total.
        if <action> eq neuer_eintrag.
          move total to ls_costele.
          ls_valtab-kokrs = ls_costele-kokrs.
          ls_valtab-actvt = c_01.
          append ls_valtab to lt_valtab.
          clear  ls_valtab.
        elseif <action> eq aendern.
          move total to ls_costele.
          ls_valtab-kokrs = ls_costele-kokrs.
          ls_valtab-actvt = c_02.
          append ls_valtab to lt_valtab.
          clear  ls_valtab.
        elseif <action> eq geloescht.
          move total to ls_costele.
          ls_valtab-kokrs = ls_costele-kokrs.
          ls_valtab-actvt = c_06.
          append ls_valtab to lt_valtab.
          clear  ls_valtab.
        endif.
      endloop.
    Authorization Check
      call function 'ZAUTH_CHECK'
        exporting
      PIM_REPID               =
        pim_auth_obj            = c_authobj
      PIM_FIELD_TABNAME       =
      PIM_CHECKALL            =
       importing
         pex_status              = l_status
       tables
         pex_val_tab             = lt_valtab
         pim_field_tab           = lt_fieldtab
       exceptions
         no_input                = 1
         others                  = 2.
      if  l_status = c_error.        "Authorization Check
      message under class: zmessclass
        message e000(zmessclass) with text-e02.  "You have no authorization
                                                "for table maintenance
      elseif l_status = c_partial.
        loop at total.
          if <action> ne space.
            move total to ls_costele.
            read table lt_valtab with key kokrs = ls_costele-kokrs
                                 transporting no fields.
            if sy-subrc <> c_0.
              delete table total.
              delete table extract.
            endif.
          endif.
        endloop.
        message e400(zmessclass).    "All the entries could not be saved
                                    "because of  restricted authorization
      endif.                        "End of Authorization Check
    endform.                    "auth_check_save
    The above code should be written in event  01  : Before saving the data in the database
    Regards,
    Farheen

  • SM30- EVENTS in Table maintanance

    Hi All ,
    I have created a table maintainance for  my Ztable . User wants the EXCEL button to down load the data into excel .Hence , I was able to Give the EXCEL Button in Application tool bar  of table maintainance  GUI which is copied from Standard one .
    But what  is the correct EVENT to code the functionality of downloading into excel? . Please adivise me on this . How can i make use of the events insated of Changing in the PAI modules .
    Please revert me if you need any other info to understand the issue ...
    Thanks in advance ,
    Dharma .

    Hi Dharma,
    Your requirement is a functionality of downloading the list of entries to EXCEL. This is not a standard View maintenance Event offered. Events, are usually called when a particular step/process is triggered. In your case, the requirement seems like the download to Excel can be executed at any point of time on the screen, right?
    It is therefore perfectly ok to simply add a button on your screen, and modify the PAI to include the action specifier for your new button. While implementing this PAI, just make sure you do not write it into the standard View Maintenance Generated includes. Use a seperate one for user-modifications.
    If you are very specific about using an EVENT, then you could go for ST - which is a GUI menu main program. But using this just for one extra button is not really necessary, but you could decide.
    Regards,
    Rekha

  • Events in Table Maintenence-for marking Deletion Flg when deleting frm SM30

    Hi All,
    I am tring to create a table maintenence.
    In my table we have a field Deletion flag....
    and as user hit delete in SM30 ..the record should not get delete ..but should mark the Deletion flag...
    I am tring to use Events in the maintenence but didnt find this functionality..
    Please suggest....
    I dont want to use module program...
    Thanks
    RK

    Hi,
    refer below link you will get idea to hide delete button from TMG screen
    Re: Disable delete button in Table Maintainance Generator

  • Write access on event polling table

    Is it mandatory for the bi server to have write access on the event polling table....We dont want bi server to delete the records from the table.
    Thanks.

    BI server works in this way, When there are rows in the event table, it knows there is changed data in the underlying databases. The server then invalidates any cache entries corresponding to the changed physical tables and periodically deletes obsolete rows from the event table. If you dont delete these records, it keeps on purging the cache. So it is must to obsolete the rows finished.
    If you want to maintain history,create same kind of table and insert rows what ever you are filling in the cache filling table. But why you don't want to delete the records?
    - Madan

  • I want to write condition while creating table/maintaining table using SM30

    Hello all,
    I am creating table Z_CUST with only 2 fields Client, Customer number using SE11 transcation then maintain using SM30 transcation.
    User should only be allowed to enter customer number that is in account group(KNA1-KTOKD) ‘Z011’. This  validation should be performed during data entry.

    Hi,
    Crete the table maintenance generator for your Ztable.
    below is the brief procedure to create table maintenance.
    Table maintenance generator is basically used to do table operations like (insert, delete, modify...).
    if you create table maintenance for your table it will build a module pool program, by using you do the above operations.
    below is the procedure to create table maintenance generator.
    1) Create one function group.
    2) after activating your Ztable, choose 'Utilities'----> 'Table maintenance genrator'.
    3) then give the authorization group and function group created abobe in the next screen.
    4) Then choose the "create" button in your application tool bar, which will creates the module pool program.
    5) then create one Tcode by chosing "Transaction with parameters( parameter transaction)".
    6) in transaction field give "SM30", select the check box "Skip initial screen".
    7) in the below of that screen you can find the "Default values" frame.
    8) there under the "name of screen field" select the "View name' and 'update".
    9) in value column against to "view name" give you table name, and against to "Update" put 'X' in capital letters.
    save it then you can straight away use this newly created Tcode to maintain your table.
    Note:- 1) make the modification while saving the data into your table using this newly generated program to carry out your validation (even though it looks like standard program; no need to enter the access key).
    2) if you do any changes to your table and press the activate button automatically the table maintenace generator will be goes off, you need to create this again.
    Reward if useful.
    Thanks,
    Sreeram.

Maybe you are looking for