Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Default Values in table maintainence generator

Former Member
0 Likes
4,798

Hey Gurus,

I have created a table in SE11 . For this table in the table maintainence generator, it is required that while creating a new entries a field i.e 'End date' should show 12/31/999 by default.

Please let me know how this is possible.

Waiting for you replies.......

Regards,

Rahul Singh

Hey Gurus,

I have created a table in SE11 . For this table in the table maintainence generator, it is required that while creating a new entries a field i.e 'End date' should show 12/31/999 by default.

Please let me know how this is possible.

Waiting for you replies.......

Regards,

Rahul Singh

9 REPLIES 9
Read only

Former Member
0 Likes
2,681

hi goto se51

Enter view name -> click on generatd oblects...->click on change button

After that...

Goto environment->modifications->events

u can maintain the perform for perticular event. In that write ur code.

If this not works then for each maintainance view SAP is creating module pool which is Z

u can change that. Write ur code in PBO modile of scrren created by mainainance view..

If u regenerate(delete and create) the maintainance view this code wil get deleted.

Edited by: Anil Mane on Mar 23, 2009 12:47 PM

Read only

0 Likes
2,681

Can u see the right event to use as i have tried this option and write a sample test code with a breakpoint statemet.

but while maintaining the entries it was not stopping at that point.

Read only

0 Likes
2,681

Hi Rahul,

for your requirement you need to create event in table maintanance generator.

write your own code in event 05 and 21.

ex,

table name : ztest . it contain fields f1, f2 and date. if you would like to add default value to f3 when creating new entry to this table, you need to follow following setps.

create event from tablemantanace generator screen Environemnt->Event.

create two subroutine for assigning defaule vaue to date field.

*first create 05 event and give suroutine name as new_entry.

form new_entry.

endform.

*create another event 21- fill hidden fields

form fill_hiddenfield.

ztest-date = sy-datum

endlform.

Regards,

Peranandam

Edited by: peranandam chinnathambi on Mar 23, 2009 10:48 AM

Read only

Former Member
0 Likes
2,681

Hi Rahul,

Use table maintenance event # 5 (Creating a new entry) and code in it.This should solve your program

However,if this does not work then just create a PBO module at the approriate place.

Luck,

Bhumika

Read only

Former Member
0 Likes
2,681
Read only

Former Member
0 Likes
2,681

Hi Rahul,

In the flow logic of the table maintanance generator u can add a module to default required fields.

in ur flow logic u will have this following lines.

Loop at extract.

MODULE LISTE_INIT_WORKAREA.

CHAIN.

FIELD Z_test-fld1.

FIELD Z_test-fld2 .

FIELD z_test-fld3. .

MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.

ENDCHAIN.

FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.

CHAIN.

FIELD Z_test-fld1.

FIELD Z_test-fld2 .

ENDCHAIN.

ENDLOOP.

in this add ur module.

like below.

Loop at extract.

MODULE LISTE_INIT_WORKAREA.

CHAIN.

FIELD Z_test-fld1.

FIELD Z_test-fld2 .

FIELD z_test-fld3. .

MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.

ENDCHAIN.

FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.

CHAIN.

FIELD Z_test-fld1.

FIELD Z_test-fld2 .

MODULE UPDATE_ENDDATE.

ENDCHAIN.

ENDLOOP.

in the module .

MODULE UPDATE_ENDDATE INPUT.

if sy-ucomm = 'SAVE' or sy-ucomm = ' '. space for ENTER.

z_test-fld1 = sy-datum.

endif.

ENDMODULE.

Guru

Edited by: Guru Ram on Mar 24, 2009 3:38 AM

Read only

Former Member
0 Likes
2,681

Go to Table Maintenance Generator and give the required details.

Now click on Environment -> Modification -> Events

in the given screen in coloumn T press F4

select event 05-creating a new entry

Click on the button in the Editor column and enter the following code

after selecting INCLUDE LZ_TABLENAMEF01.

form creat_entry.

z_tablename-table_time_ield = sy-uname.

endform..

Read only

Former Member
0 Likes
2,681

Dear,

By using table maintenance event # 5 can fixed ur requirement

go to se11 give the table name and press change

utilities-table maintenance generatorenvironment-modificationevent---new entries-in the given screen in coloumn T press F4

select event 05-creating a new entry

then between form and endform write ur customised code

fareed

Read only

Former Member
0 Likes
2,681

Hi ,

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.