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 generator event

Former Member
0 Likes
552

Hi experts,

I have a req. in which I need to create events in the TMG.

I implemented the event in case the user entres some specific values, and the fields user name, time and date are automatically populated.

Now there is another requirement in which once the user changes any already existing enty, then the changed by user name, change date and change time should be updated automatically.

How can I achieve this functionality?

Thanks,

Mohit.

3 REPLIES 3
Read only

Former Member
0 Likes
516

Hi,

Try using event 01 or 21.

Cheers

Read only

RaymondGiuseppi
Active Contributor
0 Likes
516

The following event can fulfil your requirement :

- [Event 01: Before Saving the Data in the Database|http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm]

- [Event 21: Fill Hidden Fields|http://help.sap.com/saphelp_470/helpdata/en/91/ca9f4aa9d111d1a5690000e82deaaa/frameset.htm]

 FORM event01.
  DATA: f_index LIKE sy-tabix. 
  FIELD-SYMBOLS <fs> TYPE ANY.
  LOOP AT total.
    READ TABLE extract WITH KEY <vim_xtotal_key>.
    IF sy-subrc EQ 0.
      f_index = sy-tabix.
    ELSE.
      CLEAR f_index.
    ENDIF.
    CASE <action>.
      WHEN neuer_eintrag.
        ASSIGN COMPONENT 'CREATEDBY' OF STRUCTURE total TO <fs>.
      WHEN aendern.
        ASSIGN COMPONENT 'CHANGEDBY' OF STRUCTURE total TO <fs>.
      WHEN OTHERS.
        CONTINUE.
    ENDCASE.
    CHECK <fs> IS ASSIGNED.
    <fs> = sy-uname.
    MODIFY total.
    CHECK f_index GT 0.
    extract = total.
    MODIFY extract INDEX f_index.
  ENDLOOP.
  sy-subrc = 0.
ENDFORM.

Regards,

Raymond

Read only

Former Member
0 Likes
516

Hi Mohit,

Try this way..

for change date and Change time these field need to be in Display mode always.

so got to SE80 and enter the function Group you enterd in Table maintainace,

go to screen--> and write code in the PBO to make the fields change date and Change time in display mode only to output.

Next go to PAI .

and write your code in the

LOOP AT EXTRACT.

"add custom module here and check if the entry is already avaialable in tjhe table and it is modified the

"Update the change date and Change time

MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.

ENDLOOP.

Regards,

Prabhudas