18 Replies Latest reply: Jun 17, 2010 7:52 PM by Siva Kalaiselvan RSS

How to validate data entered in table maintenance for Z table?

Peter Inotai
Currently Being Moderated



I created a Z-table with table maintenance. I'd like to perform some validation on the entered data.


I know there are events for these : "If this pre-defined time is reached in extended table maintenance, the FORM routine specified for the current view and for this time is processed. This is useful, for example, for performing consistency checks before saving or specific actions when creating new entries."


I also found some info in the Online help:



However it's not clear which event I can use for validation.


I tried event 01, however when I added a message, in the SM30 in case of message, I got the SM30 initial screen.


Do you have any example about validation?


Thanks in advance,


  • Re: How to validate data entered in table maintenance for Z table?
    Naimesh Patel
    Currently Being Moderated



    Try to use, the event 05 > when creating a new entry.


    I assume your tabel doesn't contain any data.




  • Re: How to validate data entered in table maintenance for Z table?
    Amit Mishra
    Currently Being Moderated



    Once you are on the table maintenance generator screen.


    GOTO --> Enviornment --> Modification --> Events.


    Here specify Event as '01' and the Subroutine name that will hold the data for the validation.


    As you know we need to specify a function group.


    GOTO SE80 and Open your function group.


    Now in the PBO of the screen write a subroutine for the validation before saving an entry in the table.


    Refer the code below for validation.



    *&      Form  F9000_CHECK_BEFORE_SAVE


    •       Subroutine called dynamically to check values before saving


    FORM f9000_check_before_save.


      TYPES : BEGIN OF ty_flmt,

              zz_flmt_type     TYPE zz_flmt_type,

              zz_gsm_flmt_code TYPE zz_flmt_code,

              END OF ty_flmt.

    • Internal Table

      DATA : lit_flmt_code TYPE TABLE OF ty_flmt,

             wa_flmt_code  LIKE LINE  OF lit_flmt_code.


      DATA: lv_subrc TYPE sy-subrc VALUE '0',

            lv_tabix TYPE sy-tabix,

            lv_total_rec TYPE i,

            lv_rec       TYPE i,

            flg_upd      TYPE flag.


      DESCRIBE TABLE total LINES lv_total_rec.


      LOOP AT total.


        lv_tabix = sy-tabix.



        READ TABLE extract WITH KEY total.

        IF sy-subrc EQ 0.

          IF extract+3(10) IS INITIAL.

            DELETE total.

            DELETE extract INDEX sy-tabix.

    •        DELETE extract INDEX lv_tabix.

            lv_subrc = '4'.

            flg_upd = 'X'.

            MESSAGE s119(zcrm_appl) DISPLAY LIKE 'S'.

            SET SCREEN 0.




        wa_flmt_code-zz_flmt_type = total+13(3).

        wa_flmt_code-zz_gsm_flmt_code = total+16(10).


        APPEND wa_flmt_code TO lit_flmt_code.




      IF flg_upd IS INITIAL.

        SORT lit_flmt_code BY zz_flmt_type zz_gsm_flmt_code.



        DESCRIBE TABLE lit_flmt_code LINES lv_rec.


        IF lv_total_rec <> lv_rec.


          LOOP AT extract.


            READ TABLE total WITH KEY extract.


            IF sy-subrc EQ 0.

              DELETE total INDEX sy-tabix.

              DELETE extract INDEX 1.

              lv_subrc = '4'.


              MESSAGE s289(zcrm_appl) DISPLAY LIKE 'S'.

              SET SCREEN 0.








      sy-subrc = lv_subrc.




    <b>Please reward points and close the thread.</b>



    Amit Mishra

  • Re: How to validate data entered in table maintenance for Z table?
    Kunal Kumar
    Currently Being Moderated

    Hi Peter,


    To validate data entered in table maintenance for Z table, follow the steps :


    1. Go t-code SE11 . Enter your table name. Click change.

    2. Then Utilities - > Table Maintenance Generator .


    Now you are on the Table Maintenance Generator . Enter the required values. the function group, whihc you enter should be activated.


    Then, go to


    Enviornment --> Modification --> Events.


    You will see a pop up message .

      Do not make any changes (SAP data).

    Click continue.


    Click on tab New Entries.

    As you have mentioned that you want to perform consistency checks before saving, write 01 in 1st column ( 01 - Event before saving) . Give a suitable name BEF_SAVE . Press Enter. You will see a blue icon under the column Editor.


    click on that editor.

    A pop up message will come " Creating Subroutine BEF_SAVE " .

    Click on include L***TOP. continue.


    Write the routine for validation in this include.


    Form BEF_SAVE.

    • wirte the code to validate.



    Activate this . Go t-code SM30 . enter the table name. And then check if you have done the validation perfectly.