Skip to Content
avatar image
Former Member

Table Maintainence

Hi,

I am giving end user a table maintainence,

In which if the user enters the employee number in the table table maintainence the

employee name which is the next field the table maintainence has to be populated.

Other fields like AEDTM & SY-UNAME, I am able to get when I use table maintainence events.

Please advice.

Thanks in Advance.

Regards,

Iff

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 22, 2007 at 06:22 AM

    I think you can't, table maintenance is not a program with event ..

    You could only insert data.

    Fred

    Add comment
    10|10000 characters needed characters exceeded

    • [quote]

      I think you can't, table maintenance is not a program with event ..

      You could only insert data.

      Fred

      [/quote]

      [x] not true

      you can create events for table maintenance under SM30

      under the table maintenance generator you can find in the menu Environment _> Modification -> events

      here you can define a function where you can also include fixed values like username etc . use eventid 05 and in my case I used the formname 'GET_NEXT_ZCSID'

      I use it for instance to create autoincrement keys for my Z tables

      * autonummering voor zcs_mailsettings
      FORM GET_NEXT_ZCSID.
      perform GET_NUMBER_NEXT using 'ZCSID'.
      
      ENDFORM.
      
      
      
      FORM GET_NUMBER_NEXT using keyobject.
      
      * Types Declaration
      TYPES: BEGIN OF ztable_wa.
        INCLUDE STRUCTURE zcs_mailsettings.
        TYPES: update_fl TYPE char1,
        mark TYPE char1,
      END OF ztable_wa.
      
      * Workarea Declaration
      DATA: wa TYPE ztable_wa.
      DATA: new_key type ztable_wa-zcsid.
      
      
      * Assign the current workarea
      wa = <table1>.
      
      * Call the function module
      if wa-zcsid is initial.
      CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          nr_range_nr                   = '1'
          object                        = keyobject
      *   QUANTITY                      = '1'
      *   SUBOBJECT                     = ' '
      *   TOYEAR                        = '0000'
      *   IGNORE_BUFFER                 = ' '
        IMPORTING
          NUMBER                        = new_key
      *   QUANTITY                      =
      *   RETURNCODE                    =
      * EXCEPTIONS
      *   INTERVAL_NOT_FOUND            = 1
      *   NUMBER_RANGE_NOT_INTERN       = 2
      *   OBJECT_NOT_FOUND              = 3
      *   QUANTITY_IS_0                 = 4
      *   QUANTITY_IS_NOT_1             = 5
      *   INTERVAL_OVERFLOW             = 6
      *   BUFFER_OVERFLOW               = 7
      *   OTHERS                        = 8
                .
      IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      
      
      
      * Assign the value.
      wa-zCSID = new_key.
      <table1> = wa.
      endif.
      .
      
      
      ENDFORM.
      

      works well.

      kind regards

      arthur

      Message was edited by:

      A. de Smidt

  • avatar image
    Former Member
    Aug 22, 2007 at 08:57 AM

    I have solution to ur requirement, just follow the steps carefully

    Create the table maintenance generator,say of ZTABLE, and assign a Function Group(FG) to it, say ZFG.

    Now go to se80, open Function Group ZFG. double click on the name 'ZFG' which is displayed in the Left pane of ur screen, under 'Object Name', a dialog box "Display Function Group" will appear, this dialog box will have a button "Main Program", press that button.

    it will take you to the source program, this will contain all includes used by the ZFG.

    At last of the source, write your own code like this

    INCLUDE ZMYINCLUDE.

    now double click on ZMYINCLUDE, dialog of 'Create object' will appear,press YES.

    then another dialog of 'Exit editor' will appear, asking you to save, press YES again.

    then warning will come "Include ZMINCLUDE will not be created in fun group ZFG", press ENTER.

    now an include ZMYINCLUDE would be created. Activate it and press BACK, u now return to the main program ZFG, activate it too.

    now go to sm30, write ur table name, ZTABLE, and press maintain.

    now when ur table is displayed, go to menu bar 'System -> Status'. You will find screen No. here., say 1, double click on that screen no. You now reach the flow logic of the screen, in this flow logic you will find a statement MODULE LISTE_UPDATE_LISTE.

    Insert a line before this statement MODULE MYCODE.

    now double click on MYCODE.dialog of 'Create object' will appear,press YES.

    another dialog of 'Create PAI Module' will appear showing the list of includes and asking u to choose. If you browse to the end of the list, u will find the include ZMYINCLUDE that we had created earlier.select ZMYINCLUDE and press ENTER. select means pressing the button next to it.

    then another dialog of 'Exit Screen Painter' will appear, asking you to save, press YES again.

    in this module you write the code according to your logic, and assign the value correspondingly, e.g.

    select name from .........

    into ZTABLE-EMPNAME.......

    where

    empnumber = ZTABLE-PERNR.....

    date and name field are assigned directly.e.g.

    ZTABLE-AEDTM = sy-datum.

    ZTABLE-UNAME = SY_UNAME.

    now activate this include and press BACK.

    and its all done. moreover you can go to Layout of that screen and Disable the fields like EMPNAME,AEDTM,UNAME.

    don't forget to activate all the objects created.

    Now go to sm30 and check.

    Reward points if useful, get back in case of query...

    Cheers!!!

    Add comment
    10|10000 characters needed characters exceeded