Events in SM30

Hello Everyone,
I am trying to restrict the value of a field in SM30. The idea is the value of this field cannot be duplicate. Also, I can't make it the key field as there can be only 1 key field in the table.
Let me be more clear. The field name is 'Priority'. If the value of field is entered as '1', then in the next record the value of priority can't be '1' again.
I am trying to create an event for this, but I am not clear with the concept of TOTAL & EXTRACT. Can some one explain me the same.
Please do not refer any links as I have thoroughly searched SDN and SAP help and they are not of any use. I have read each and every document available for events on SM30 and didn't find anything related to my query.
Regards,
Snehal

Solved it on my own........
Thanks everyone.
Regards,
Snehal

Similar Messages

  • SM30: table Maintenance - appropriate event while changing existing entries

    Can anyone please let me know which event is appropriate to validate data while changing existing entries in database table using SM30.
    Thanks & Regards,
    Nilesh Kumar

    Hallo,
    You have to create two events for sm30.
    05 FETCH_VALUE_NEW
    21 FETCH_VALUE_CHANGE
    The first event-05 triggers when you create new entry where you can update created by/created date etc.,
    and in the second event-21 you can update Changed by/Changed date.
    Please let me know if you need any further information in this regards.
    BR,
    Rajesh Gupta.

  • Event for preventing a new entry in DBTable

    hi all,
    please suggest me a event in table maintenance to have a check for preventing the entry into the table. i tried event 18 but wen the error msg is displayed it comes out of record entry window which is to be avoided.
    regards
    Madhu

    My friend  it is  not
    18 . it is 05 -> Creating New Entry. 
    so that  you can validate with the User   and  do the validation  and update the table .
    "Below is the code for  it
    Select 05 for an event for “Creating a new entry”.
    This event will be triggered while creating a new entry in SM30 or using the TCODE.
    Form Name: AT_NEWENTRY (Enter key)
    Double Click on the editor.
    form at_newentry.
    Ztab-ZCOUNTRY = ‘India’.
    Ztab-ZCREATEDATE = sy-datum.
    Ztab-ZCREATETIME = sy-uzeit.
    endform.
    Create another event: 02 for “After Save”
    FORM after_save.
    Ztab-mandt = extract+0(3).
    Ztab-ZCOUNTRY = extract+3(3)..
    Ztab-ZCREATEDATE = sy-datum.
    Ztab-ZCREATETIME = sy-uzeit.
    MODIFY ztab.
    ENDFORM. "after_save
    Step 4: Create Transaction Code.
    Go to SE93.
    Transcation code: ZTAB
    Transaction text Test Table Maintenance Events
    Transaction: SM30, Skip first Screen
    Default Values:
    VIEWNAME ZTAB
    UPDATE X
    Reward  points if it is usefull....
    Girish

  • How to default a value in the tablecontrol field?

    hi
    i have created a maintenance view for a z table and this table has a currency field. So when i go to SM30 to maintain the z table i want that when the user clicks on NEW ENTRIES button the system should automatically default the currency field to 'GBP'.
    Any idea where to set the default value on a field in the table control or in the maintenance view.
    thanks in advance

    Hi
    Use events in SM30 view
    this thread should be useful
    Code in View?
    regards
    vivek

  • Validations in MAintainance View

    HI all,
    I have assigned a Tcode to a maintainance view..So when i insert a new record , i want to check  if a primary key field is left blank while saving or if all fields are blank while saving. In these cases it should not save. So what do i do? another validation requires to check if the start date is lesser than the end date.. IS this possible without having to create a new module pool or anything similar? if so how? Is it possible using Events in table maintance generator? CAn u please give me the detailed steps?
    thanx,

    Hi
    Check below link:
    Its step by step guide for using Events in SM30.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc
    Thanks
    Praveen

  • Update a table Z using SM30 events

    Hi experts,
    I've been told to do the following:
    I have a table ZYOPER that the user can modify through a SM30 (actually by another transaction that calls the SM30).
    Now they want every time you update/create/delete a record in this table ZYOPER, save a log in another table ZYOPERLOG indicating the action completed and the data contained in these records.
    I implemented the following events but it's not fine...
    - 03 (new entry, field ZYOPERLG-action = 'INSERT')
    - 05 (delete entry, field ZYOPERLG-action = 'DELETE')
    - 02 (Modify the new table ZYOPERLOG)
    The issue is that in the 02 event I have tables Total and Extract, which are all the records contained in ZYOPER even if they have been modified or not. Can I do it with import and export? Is it possible to declare a global internal table i_zyoperlog in order to keep the records updated/deleted/created ?
    Thanks in advance...
    Mary

    Your requirement is a good use-case for [Event 01: Before Saving the Data in the Database|http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/content.htm].
    Why do you need this custom table anyway? You can set the "log data change" setting & evaluate it via trxn SCU3.
    BR,
    Suhas

  • Highlight rows in SM30 that are in error  using Event 01

    I have created an Event 01 (via SE54) to validate the data that is entered in my custom table using SM30.  In my code, how can I highlight the row(s) of data that have invalid data.  Event 01 is executed before saving the data.
    Thanks.
    Ryan

    Hi Dimitri,
    I guess I have included it in my page header (in bold letters). Here is a portion of my page source..
    <html lang="en-us" xmlns:htmldb="http://htmldb.oracle.com">
    <head>
    <script src="/i/javascript/htmldb_html_elements.js" type="text/javascript"></script>
    <script src="/i/javascript/htmldb_get.js" type="text/javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    /*Global JS Variables*/
    var htmldb_Img_Dir = "/i/";
    //-->
    </script>
    <link rel="stylesheet" href="/i/css/core.css" type="text/css" />
    <style type="text/css">
    td.t2data {color:red}
    td.t2dataalt {color:blue}
    </style>
    <script language="JavaScript" type="text/javascript">
    <!--
    htmldb_delete_message='Would you like to perform this delete action?';
    //-->
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Store Class Local Information</title>
    <link rel="stylesheet" href="/i/themes/theme_2/theme_V2.css" type="text/css" />
    </head>
    <body ><form action="wwv_flow.accept" method="post" name="wwv_flow" id="wwvFlowForm" >
    <input type="hidden" name="p_flow_id" value="2007" id="pFlowId" /> <input type="hidden" name="p_flow_step_id" value="42" id="pFlowStepId" /> <input type="hidden" name="p_instance" value="16705997569361941904" id="pInstance" /> <input type="hidden" name="p_page_submission_id" value="318155" id="pPageSubmissionId" /> <input type="hidden" name="p_request" value="" id="pRequest" /><table width=983 border=0 cellpadding=0 cellspacing=0>
    <tr>
    <td>
    <img src="wwv_flow_file_mgr.get_file?p_security_group_id=22816117248010841&p_fname=bgADW2_01.jpg" width=600 height=57 alt="">
    </td>
    <td>
    <img src="wwv_flow_file_mgr.get_file?p_security_group_id=22816117248010841&p_fname=bgADW2_02.jpg" width=383 height=57 alt="">
    </td>
    </tr>
    </table>
    ....... some more codes .....
    but still its not working... Thanks for bearing with me..

  • 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

  • How to carry out entry validation in SM30 with events

    Hi people,
    I'm creating a Z table with Maintenance view in SM30...i've modified the view so all fields are required as Rich H explained in some other post. But now i need to validate user input for a particular field against a standard table, and force to reenter if data is not valid. I've been looking up the available events...event 05 triggers when the line is new, but not when modifying. I've tried a couple of other events but don't serve my purpose. What i want is to validate data upon user's entered all the required fields (whether the line was preeexistant or  not). If data is valid then go on, if not trigger a message and force correction prior continuing (disallowing saving).
    Anyone knows how to do this?
    Many thanks

    I get what you suggest, but unfortunately i've already done that, it's not enough.
    Here's the situation: The table has this fields:
    KSCHL (PK-FK T685)
    LIFNR (PK-FK LFA1)
    EBELN (FK EKKO)
    EBELP (FK EKPO)
    Besides the implicit foreign key validations (i.e. the PO item exists in EKPO), i need to validate that it's not deleted (LOEKZ = 'L') and that the PO vendor is the one entered (i must not enter any PO which vendor isn't the one in that line). Hope I make myself clear.
    This code works but in event 05 (new lines). I need to find out an event for the modified lines as well:
    FORM f_validate_po.
      CHECK NOT ( ztmmiv001rps-lifnr IS INITIAL OR
                  ztmmiv001rps-ebeln IS INITIAL OR
                  ztmmiv001rps-ebelp IS INITIAL ).
      SELECT COUNT(*)
      FROM ekko
      WHERE ebeln = ztmmiv001rps-ebeln AND
            lifnr = ztmmiv001rps-lifnr AND
            exists ( SELECT *
                     FROM ekpo
                     WHERE ebeln = ztmmiv001rps-ebeln AND
                           ebelp = ztmmiv001rps-ebelp AND
                           loekz <> 'L' ).
      IF sy-dbcnt = 0.
        MESSAGE e000.
      ENDIF.
    ENDFORM.

  • SM30, events and custom code.

    Hello friends,
    I have the following requirement. There is a custom Z table and there are 4 fields inside the table. When i change a field, i have an event before_save_database, where i go and update the value of the 4th field if field 3 changes. On display it shows data was saved although the 4th fields still has the old value.
    Only when SM30 is entered is the new value for field 4 seen.
    I want it to display the new value in the first run itself when the message comes 'Data is saved'. Kindly mention how the following can be achieved.
    Regards,
    Jaydeep.

    i´m not a 100% sure that i got your requirements, but i think it´s a commit problem.
    if you enter SM30 you have a dynpro change, which means you loose your dialog work process.
    This again leads to an implicit commit on your DB.
    now i would try to do an manual commit and see if your problem still exists.

  • SM30 events.

    Hello friends,
    I have the following requirement. There is a custom Z table and there are 4 fields inside the table. When i change a field, i have an event before_save_database, where i go and update the value of the 4th field if field 3 changes. On display it shows data was saved although the 4th fields still has the old value.
    Only when SM30 is entered is the new value for field 4 seen.
    I want it to display the new value in the first run itself when the message comes 'Data is saved'. Kindly mention how the following can be achieved.
    I did a COMMIT WORK also before the save in the database, but the changed values get reflected only in the next opening of the SM30 screen.
    Regards,
    Jaydeep.

    hi friend,
    i face the same problem once, it is purly depend upon the keyfields, in your Z table put 4th field as a key field and adjust the data base or regenerate that function group and try once..
      i think it is very help ful for you
    Thanks,
    Reddy

  • Table Event - SM30 - Entering into transaction

    Hi All,
    Before posting this message I looked for a solution in the forum, but from the messages I found none of them has what I need.
    I would like to know which event code I have to use to update a field in a table in SM30 when entering it.
    Thanks in advance!
    Robson

    Seshu,
    Thank you for your reply, but doesn't work.
    I have a table with 2 fields: Code and Description.
    I need when entering in transaction, before display data on screen, an event update Description based on Code. The event 01 is not called at this moment. I've found events 19 and 25, but inside them, data still not charged in table.
    Thanks,
    Robson

  • 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

  • Modify records with SM30 events.

    Hi,
    I try to modify one record using SM30 even 01 (before save). When the user add new record and push the save buttom, I need to modify the previous record in the table. I try to modify a key field (end date of validate). This is one example:
    Records in table:
    Init date of validate    End date of validate    Value
    01.01.2008                 31.12.2008                1
    The user add new record:
    10.01.2008                   31.12.2008               2
    I need change the first record, and the final result must be this:
    Init date of validate    End date of validate    Value
    01.01.2008                 09.01.2008                1
    10.01.2008                 31.12.2008                2
    Thanks for yours replys.

    I was just reading your first post and observed that you mentioned
    "_I try to modify a key field (end date of validate). This is one example_"
    Does this means that you are trying to modify a field that is part of table primary key? If yes, then please note that primary key fields cannot be changed. The only way is to delete that row and insert a new one with different value.
    However if the fields you are changing are non key fields (not part of table primary key) than following can help you.
    Have a look at the code here.
    http://help.sap.com/saphelp_nw04/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm
    Now suppose your table name is ztable with following fields
    MANDT
    FLD1
    FLD2
    SDATE
    EDATE
    So you will declare a work area like
    data: begin of wa_total.
    INCLUDE STRUCTURE ZTABLE.
    INCLUDE STRUCTURE VIMTBFLAGS.
    data: end of wa_total.
    Now basically work area wa_TOTAL will have a structure like
    MANDT
    FLD1
    FLD2
    SDATE
    EDATE
    VIM_ACTION
    VIM_MARK
    VIM_TXTACT
    SO the scenario you defined in your first post, where row 1 is already in table and row 2 is added, row 2 will have value N in vim_action field.
    to update row 1 you will do something like
    read table total index 1.   "1 is the row number to be changed
    if sy-subrc = 0.
    move total to wa_total
    wa_total-edate = "enter new date here
    wa_total-vim_action = 'U'.
    modify total from wa_total.
    endif.
    similar logic for "EXTRACT"
    I hope this helps.

  • Need to validate a existing field in the table maitainence Generator events

    Hi EXPERTS,
    There is one Z-table and for that TMG also there. There is custom transaction for sm30. Now I need to validate one field BNAME for new entries I have created event -05(creating new entry) it is validating correctly. But now another requirement is if user also wants to change the existing values for the field BNAME it should also be validated needs to populate error mesg and does not allow to save it. I used event 01(before saving data) 07 ( before correcting the contents of selected field) 18 ( after checking whether data has changed)but not working any of these events. Please suggest me which event is  suitable for my requirement. Orelse I need to put the code in the  flow logic of the screen under PAI module I think this is not a good practice.
    Code:
    FORM data_changed.
      DATA     : l_bname TYPE xubname.
      CONSTANTS: c_mesg      TYPE char16   VALUE 'Invalid SAP User',
                 c_error     TYPE char1    VALUE 'E'.
    * Validation on BNAME field
      IF zps_capex_appr-bname IS NOT INITIAL.
        SELECT SINGLE bname FROM usr01 INTO l_bname
               WHERE  bname = zps_capex_appr-bname.
        IF sy-subrc NE 0.
          MESSAGE c_mesg TYPE c_error.
        ENDIF.
      ENDIF.
    ENDFORM.                              "DATA_CHANGED
    Please suggest me how to proceed.
    <Added code tags>
    << Priority normalized >>
    Awaiting for your replyu2026
    Thanks in Advance.. 
    Edited by: Rob Burbank on Mar 2, 2012 9:23 AM

    Hello Sreekanth,
    How are you populateing the field zps_capex_appr-bname ? I'm pretty much sure that this is not getting populated at runtime.(put a break-point & check)
    In order to access the data in the TMG [Event01|http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/content.htm], we have to use the TMG system tables - TOTAL & EXTRACT.
    If your validation of BNAME fails, remember to:
    1. Set SY-SUBRC to a non-zero value,
    2. Set the flag VIM_ABORT_SAVING to 'X'.
    BR,
    Suhas

Maybe you are looking for

  • Apply custom name not working correctly

    Wow... I am beginning to lose hope, again, that FCPX will ever be relatively bug free.  When applying custom clip names in 10.1, the software is very buggy and gets some things flat wrong.  For example, if you create a custom clip name with a counter

  • Use HYPERLINK In ALV

    Hi i have requirement to add a hyperLink in ALV Report Output. i have added the following code in my code but hyperlink('www.google.com' ) is not showing in the report output and when i execute the report then 'www.google.com' opens in the web browse

  • How do I retroactively tag a photo with a Facebook profile?

    I tagged a number of photos before we "friended" on Facebook and would like to connect that profile to her Facebook profile, now that we friended. How do I retroactively get that set up?

  • Question about character encoding

    Hey everyone, I've been trying to read about character encodings and how Java IO uses them, however, there is something I still don't understand: I am trying to read an HTML file encoded in UTF-8 and which contain some Arabic characters. I used this

  • Black Picture

    Hello all, Oddest thing. Have a project I've brought into IDVD 6.02. In ANY theme if I drag a picture into a drop menu for the first time it shows up fine. If I drag that picture out and try and new one and try to go back to that picture it shows the