Skip to Content

Set default value in field of table

Hi,

How to set system default value in field of table.

like zusnam - it will autimatically store current user id (sy-uname).

zdatum - it will store current date (sy-datum).

Regards,

Arpit

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 21, 2010 at 10:39 AM

    Hi,

    You can add this logic for updation in the table maintenance events.

    Table maintenance->Modifications->Events.

    Add the logic for updation of system fields in Event 01-Before Save or 05-Create new entry based on your requirement.

    Thanks

    Shiva

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 21, 2010 at 10:50 AM

    Hi , It all depend upon how r u planning to populate values in this tabvle.

    If u will always do it through abap code then you can hard coed the logic to get the values form system variables and populate them in those fields.

    If you are planning to enter the values using TMG then you can have a routine method writtenon Table maintainance SAVE event and write above logic there.

    Hope this is helpful.

    Regards,

    Uma Dave

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 27, 2011 at 11:15 AM

    Hi Arpit,

    This is possible only either through the PBO module of that screen or by using the Events in Table Maintenance.

    you can use the event Create new entry-05.

    Regards,

    Rahul Girdhar

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 28, 2011 at 10:04 AM

    Hi ,

    Only way is to use database events - either 05 ( creating new entries ) or 12 ( fill hidden fields ) can be used.

    Regards,

    Deepthi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 25, 2011 at 11:07 AM

    Suppose you have following fields to be filled automatically :

    USER-NAME

    SY-DATE

    SY-TIME

    Then go to UTILITIES > TMG >Environment >Modification >Event

    Select Even 05 (Create new Entry)

    And write code inside that, as below :

    TABLE_NAME- USER_NAME = SY-UNAME

    TABLE_NAME-SY_DATE = SY-DATUM

    TABLE_NAME-SY_TIME = SY_UZEIT.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 17, 2011 at 09:26 AM

    Hi Arpit,

    To set default value to table fields like date , time or username , here are the steps given below :-

    1. Create table (Eg. Ztable) having required fields (Eg. Mandt , kunnr , erdat ) . Give required Technical Settings and activate It .

    2. Now Go to UTILITIES->TABLE MAINTENANCE GENERATOR . t

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 17, 2011 at 10:10 AM

    Hi Arpit,

    To set default values to table fields like date , time or username , here are the steps given below :-

    1. Create table (Eg. Ztable) having required fields (Eg. Mandt , kunnr , erdat ) . Give required Technical Settings and activate It .

    2. Now Go to UTILITIES->TABLE MAINTENANCE GENERATOR . This will take you to maintenance dialog screen.

    Here pass this value to fields :-

    Authorization Group = &NC&.

    Function Group = Can give table name (i.e Ztable)

    Maintenance type = ONE STEP

    Main. Screen No . = any value .

    After that Click on create button .

    3. Go to ENVIRONMENT->MODIFICATION->EVENTS . Click on NEW ENTRIES. In table below type below values :

    3.1 T = 21.

    Form Routine = any subroutine name (Eg. SHOW ).

    press ENTER .It will Show icon on Editor columne. Now Click on Editor button. Click on OK .

    It will show ABAP Editor , here you can write your subroutine code as given bellow :

    Form SHOW.

    ztable-erdat = sy-datum.

    Endform.

    save and activate it .

    3.2 T = 05.

    Form Routine = any subroutine name (Eg. NEW).

    press ENTER .It will Show icon on Editor columne. Now Click on Editor button. Click on OK .

    It will show ABAP Editor , here you can write your subroutine code as given bellow :

    Form NEW.

    ztable-erdat = sy-datum.

    Endform.

    save and activate it .

    4. This will create table with default fields. Now to see how this will work , Go to SM30 -> Click on MAINTAIN -> Click NEW ENTRIES. Type the value in the fields which is required and keep remaining fields as empty. Click on ENTER.

    The values which we want (Eg. date , time or username) will be added automatically .

    Regards ,

    Ishant.

    Add comment
    10|10000 characters needed characters exceeded