Application Development 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: 

Table maintanence

Former Member
0 Kudos

Hi,

I created a Custom table with table maintenance generator, in that table i have 10 fields including User name and the date, when the user Create/Change any record through the table maintenance these 2 fields (User name and the Date) should be filled automatically. could anybody tell me where should i write the code to update these 2 fields automatically

Regards

Sudheer

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I am writing the code in the EVENTS of the table maintanence genarator(Environment --> Modifications --> Events) i have writn the code in 01,02,05 nad 18. but it is updating the last record only, i mean if i have 10 records then it is updating only the 10th record even if i change all the records from the table maintanence.

i want in this way --> if i change the 5th record then the User name and the date should be updated for only 5th record, if i change the 9th record then these 2 fields should be updated to only the 9th record ....

anybody tell is there any other way to update the table maintanence other than this EVENTS, or this is the only one wat to update the table maintanence.

<b>Note:</b> If i write the code in the Screen this will work, but if i regenerate the screens, then the code will not avilable ...

Regards

Sudheer

8 REPLIES 8

0 Kudos

Hi,

You have to write it in the function module that is generated when you create table maintenance generator.

So goto that function group and then select the function module that got generated and change the function module.

The best way is to goto that screen of table maintancen generator and from there goto System->Status, from here goto the screen and then the function module which has this screen.

Once you know the field you canm just initialize these two fields with SY-UNAME and SY-DATUM.

Regards,

Sesh

Former Member
0 Kudos

please see this below link itwas given exactly your requirement as screen shot.

use the event for that in the table maintainance generator ...

use the exact even 05 .

<a href="http://">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-8765287250fc</a>

reward points if it is usefulll ......

Girish

Former Member
0 Kudos

U can write code in flow logic of the screen of maintenance view.

i have tried it..

Reward if useful

Regards

Prax

Former Member
0 Kudos

Between Loop.. ENDLOOP.

paste ur code


 LOOP AT EXTRACT.
 

    MODULE LISTE_INIT_WORKAREA. 

<u>*** This is ur code </u>

   CHAIN.
      FIELD ZPRAX-NAME .
      FIELD ZPRAX-AGE .
      MODULE set_user_date on chain-request.
    endchain.

<u>*** This is ur code </u>

    CHAIN.
      FIELD ZPRAX-NAME .
      FIELD ZPRAX-AGE .
      FIELD ZPRAX-USERNAME .
      FIELD ZPRAX-DATE1 .
      MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
    ENDCHAIN.
    FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
    CHAIN.
      FIELD ZPRAX-NAME .
      MODULE LISTE_UPDATE_LISTE.
    ENDCHAIN.
  ENDLOOP.

*and
*&---------------------------------------------------------------------*
*&      Module  set_user_date  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE set_user_date INPUT.

  zprax-username = sy-uname.
  zprax-date1 = sy-datum.

ENDMODULE.                 " set_user_date  INPUT


Reward if useful

Regards

Prax

Former Member
0 Kudos

Let me know in case you still have issue since this can be handled by events.

Regards

Nishant

Former Member
0 Kudos

Hi,

I am writing the code in the EVENTS of the table maintanence genarator(Environment --> Modifications --> Events) i have writn the code in 01,02,05 nad 18. but it is updating the last record only, i mean if i have 10 records then it is updating only the 10th record even if i change all the records from the table maintanence.

i want in this way --> if i change the 5th record then the User name and the date should be updated for only 5th record, if i change the 9th record then these 2 fields should be updated to only the 9th record ....

anybody tell is there any other way to update the table maintanence other than this EVENTS, or this is the only one wat to update the table maintanence.

<b>Note:</b> If i write the code in the Screen this will work, but if i regenerate the screens, then the code will not avilable ...

Regards

Sudheer

MohanChauhan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can write your code in Event 21. and fill these values

I hope this will work.

Reward points if useful.

Regards,

Mohan

Former Member
0 Kudos

Hi,

Event 21 is to Fill the Hidden fields ....

what want is, if i change 3 records then the only those 3 records should be updated with the User name and the Date

Regards

Sudheer