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

Table maintenance

Former Member
0 Likes
1,532

Dear All,

I am updating my custom table through table maintenance tcode:SM30.

Now i have to update USERNAME also in database table without having a column in SM30.

Can any body tell me how to do that.

Is there some coding we have to do?

In Table Maintenance Gemerator (TMG) , i can see screen but there is only standard modules available in PBO and PAI.

Tell me some other area where i can put code.

Regards,

Ankur

18 REPLIES 18
Read only

Former Member
0 Likes
1,508

hi

Goto to the table maintance FM .. there u can write code..

check in it.

Read only

MarcinPciak
Active Contributor
0 Likes
1,508

Does your table contain username field? If so and it is not empty, it means then that system will supplement this information (with sy-uname) for you when saving data to DB. No coding required then.

Regards

Marcin

Read only

0 Likes
1,508

hi

I have added that field also and tried to update but still username is not updating automatically.

Regards,

Ankur

Read only

0 Likes
1,508

Use [Event before save|http://help.sap.com/saphelp_47x200/helpdata/EN/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm] to store your user name.

To familiarize with this events refer [Events in table maintenace|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-8765287250fc]

Regards

Marcin

Read only

0 Likes
1,508

Create a module in PAI before end-chain.


*Enhancement
    module set_fields_ZXXZ on chain-request.
*End
   ENDCHAIN.

and map fields into your view structure like below


  move sy-datum to ZXXX-aedat.
  move sy-uname to ZXXX-aenam.

Read only

0 Likes
1,508

but where i can create that module.

i mean in which program i can create

Read only

0 Likes
1,508

first you need to generate table maintenance - here you give the screen number and function group.

once generated - got to flow logic of that screen in change mode and create a new module here.

i.e., in overview screen generated for your table maintenance in se56/54.

Read only

0 Likes
1,508

THROUGH THAT IT IS ASKING FOR AN ACCESS KEY.

Should i take an access key and then do the necessary changes?

Read only

0 Likes
1,508

As for your question while generating table maintenance view I guess you choosed non custom Function Gtoup that's why system prompts for DEV key. Either put ther custom Function Group (so you can do changes inside) or refer the pdf document I sent you. It describes see step by step procedure for creating subroutines which will dynamically be called by system when you create new entries in SM30. You just put your coding there.

Regards

Marcin

Read only

0 Likes
1,508

Function Group used in TMG is custom and all the include programs r standard.

Suppose for PAI all the modules r in INCLUDE PROG: LSVIMIXX...

likewise all the includes r standard.

If i am creating a new module in PAI,then it is asking for an access key.

what to do now plz tell me.

Read only

0 Likes
1,508

I have gone through the table and got an authorization group.

Authorization Group : &NC& is assigned to table.

Do u think the problem is becoz of that only.

If so plz tell me how to over come it.

Read only

Sm1tje
Active Contributor
0 Likes
1,508

What exactly is the problem? The fact that you can't see this column in SM30? If so, did you add this field username afterwards, so it was not part of the original table maintenance.?

Then you will have to regenerate your table maintenance and the column will automatically be part of SM30.

If there is another problem, please let us (me) know.

Read only

0 Likes
1,508

Hi Ankur ,

For the table maintenance there are a number of events like Before save , after save and all , to get your desired result you will have to use one of the events like BEFORE_SAVE e.t.c.,

To see the list of events in the maintenenace , get into your table in change mode , go to table maintenance , then in the menu go to Environemnt --> Modification --> Events.

Please check the help for events in table maintenance for more info.

Regards

Arun

Read only

0 Likes
1,508

Hi Micky,

That field is also showing in SM30 i tried that one.

But my problem is that i don`t want to show the user name field in SM30, i want to update it in back-end.

User should not came to know that his/her user-id is saving in table while changing or creating any entry.

Hi Arun,

I know that Events but when i am creating its FORM routines it is giving me an standard INCLUDE prgrams which i can`t able to access without its access key.

Read only

0 Likes
1,508

Hi Ankur ,

What i remember is it will ask whether you want to create the subroutine in a new include or an existing one , please use a new include .

Regards

Arun

Read only

0 Likes
1,508

Please regenerate your table maintenance in Y/Z namespace funtion group - once done you can change your screen's flow logic as I mentioned.

Read only

Former Member
0 Likes
1,508

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

Edited by: sugautam on Apr 21, 2009 12:20 PM

Read only

0 Likes
1,508

I got it and closing this thread.

Thanks to all.

Regards.

Ankur