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

Similar Messages

  • Can you please help me with validation logic for Events in Table maintenance generator

    Can you please help me with validation logic for Events in Table maintenance generator,i.e if i enter record in 1st internal table then automatically 2nd internal table should be updated.

    Hi Glen Anthony,
        Thanks for replay,
         I used foreign key relationship between those 2 internal tables....
    I used event 05: When creating a new entry. I want to know the custom logic by which my 2nd Internal table gets automatically updated when i update my 1st Internal table
    Thanks Glen.

  • 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,

  • 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

  • Events in table maintenance generator 01

    Hi all,
           I have an urgent requirement regarding the events in table maintenance generator.The requirement is i have a qty field in table i want to change the existing value it should allow only a lesser value.How to use TOTAL and EXTRACT structures.
    it is urgent.please help me out.
    Thanks & regards,
    Kranthi

    Follow the example below:
    form get_vendor_name.
      data w_extract type z_table.
      data begin of w_total.
              include structure z_table.
      data: action,
            mark,
      end of w_total.
      loop at extract into w_extract.
        check not w_extract-z_vend_no is initial.
        select single name1 from lfa1
                           into  w_extract-z_vend_name
                           where lifnr = w_extract-z_vend_no.
        modify extract from w_extract.
      endloop.
      loop at total into w_total.
        check not w_total-z_vend_no is initial.
        select single name1 from lfa1
                           into  w_total-z_vend_name
                           where lifnr eq w_total-z_vend_no.
        modify total from w_total.
      endloop.
    endform.
    Reward points if useful.
    Regards.

  • Table Maintainance Generator Updation problem

    Hello,
    I am having the problem related to table maintainence generator updation.
    I am fetching the data in table maintainance generator from Standard table.
    Now the problem is that, if I fetch  some records ; some records are updated properly but some records are not.
    Please suggest the solution.
    Thanks.
    Swati.

    >
    Swati Khandelwal wrote:
    > Hello All.
    > Thanks for your reply.
    > The field which is not updating is not the key field.
    >
    > Thanks.
    > Swati
    It does't matter.
    But the fields is not updating you need to check its key in table whether it is exsist?
    I'm yes it is there.
    One more thing i would like to confirm are you using Update or modify?

  • 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 .

  • How can organize photos by year?  by putting a folder inside of a folder?  So putting all of the events for one year under one folder so that it keeps them seperate?

    Looking for help in organizing my photos.   I would like to organize them so that i can put all of the events for a year into one folder  (i would like to keep multiple events under a folder)?  Help please?!

    Like Larry suggested:
    Click to view full size
    The top folder could be named 2011.  In it could be 12 smart folders each with the following criteria:
    Date is in the range"  mm/01/yyyy to mm/31/yyyy.
    So the 2011 folder would have 12 month smart albums each with the photos for that particular month.
    Or you can use the search by date function at the bottom of the window to search by year, month, week or day.
    OT

  • Date field is missing in the Table maintainance generator

    Hi,
      A table is created. A date field is there in that table. I tried to create a table maintainance generator for this table using 2 screens. Table maintainance generator is  created. But when I go to SM30 , I am unable to see this <b>DATE</b> field in the SM30 , in the first screen. But when I go to maintainance screen , I am able to see this field. This particularly happening with date field.
    Could you please help me.
    Regards,
    Satya

    go to se11 and type the table what you want.
    utilities, table maintenance generator.
    you config the options that you need.
    press F6 and go to sm30.
    its only this.
    Regards

  • I have a ipod touch and I can't put anything on the events there is no   in the right corner Like my sons

    I have an ipod touch and I can't put anything on the events there is no + sign in the corner like my sons ipod.

    I'm guessing you are referencing the Calendar app.
    Try resetting:
    Hold the home and power buttons at the same time until the Apple boot logo appears. No data will be lost.

  • 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.

  • 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

  • Disable delete button in Table Maintainance Generator

    Hello all,
      How to disable delete button in Table maintainance generator???

    Hi Maya,
    It is very interesting question. If you debug your table maintenance screen, the program of table maintenance screen will not have statically defined pf status. So you cannot exclude delete functionalities using the below statement.
    SET PF-STATUS <the GUI status> EXCLUDING 'DELE'.
    For viewing pf status SAP has programmed in dynamic manner using this FM VIEW_SET_PF_STATUS.
    Before calling above FM you need to exclude delete function. Follow the following step for achieving this
    Go to sm30. Put your table name and press on maintain push button. It will display table entries in maintenance screen.
    Go to system->status
    Click on program name.
    Go to your flow logic of you table maintenance screen number.
    It will have following code in flow logic
    PROCESS BEFORE OUTPUT.
    MODULE LISTE_INITIALISIEREN.
    LOOP AT EXTRACT WITH CONTROL
      TCTRL_ZMAINTAIN CURSOR NEXTLINE.
       MODULE LISTE_SHOW_LISTE.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
    MODULE LISTE_BEFORE_LOOP.
    LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZMAINTAIN-MATNR .
        FIELD ZMAINTAIN-KUNNR .
        FIELD ZMAINTAIN-LIFNR .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZMAINTAIN-MATNR .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
    ENDLOOP.
    MODULE LISTE_AFTER_LOOP.
    Add new module in PBO for excluding delete function. ex  module set_pf.
    PROCESS BEFORE OUTPUT.
    ****here I added my own code for excluding delete function
    ****begin of addion
    module set_pf.
    ****end of addition
    MODULE LISTE_INITIALISIEREN.
    LOOP AT EXTRACT WITH CONTROL
      TCTRL_ZMAINTAIN CURSOR NEXTLINE.
       MODULE LISTE_SHOW_LISTE.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
    MODULE LISTE_BEFORE_LOOP.
    LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZMAINTAIN-MATNR .
        FIELD ZMAINTAIN-KUNNR .
        FIELD ZMAINTAIN-LIFNR .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZMAINTAIN-MATNR .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
    ENDLOOP.
    MODULE LISTE_AFTER_LOOP.
    *****inclule one line of code for excluding delete fucion
    module set_pf output.
          MOVE 'DELE' TO excl_cua_funct-function. COLLECT excl_cua_funct.
    endmodule.
    Basically sap fetching status dynamically from program SAPLSVIM using FM VIEW_SET_PF_STATUS. Status name is EULG.
    Please donu2019t hardcode anything by using set pf status statment, you just add one line of code the PBO by creating new module.
    Let me know if you need any help .
    Cheers.
    Regards,
    Peranandam

  • 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

Maybe you are looking for

  • Link between Oder number, Operations and PRT ?

    Hello, I am trying to find the link between Ordeer number (T-code IW32) , its Operations and PRT linked to Operations. Can someone shed some light on the links for these in PM tables ? Thanks. Regards, Rajesh.

  • Cancellation of 1 line item of miro

    Hi I have done 1 miro which is of 6 line item . Out of which I want 5th line item to get miro reversal. I tried going to miro & pressing copntrol + F10 I have entered the miro no. But I see all the line items are selected and gray out. I am not able

  • Changing a deployment's file name

    I'm trying to debug a large application and I'm having a problem with the Windows File name limit. I have a project called GenericClientCalculationEngine, which creates GenericClientCalculationEngineWebApp.war. Is there a way in JDeveloper to set wha

  • [solved] mounted NFS shows nobody:nobody

    I followed the wiki and found a thread that mentioned using the fsid=0 option in exports file but its not working for me. I enabled rpc-idmapd on the client (Arch), its running I checked with systemctl status rpc-idmapd. The server is running Debian

  • My signal is not working it keeps saying I have full signal then searching!!!

    My signal is not working it keeps saying I have full signal then searching!!