06-06-2006 5:07 PM
Can anyone tell me How to populate system date & time when user enter data for custom table in sm30..
Req is
i have custom table and using sm30 user can enter data.
after saving date i want to update date & time in table
Pls let me know where to write the code?
Thanks in Advance
06-07-2006 6:05 PM
Did the code help? If so can you please close the issue?
Thanks,
Srinivas
06-06-2006 5:11 PM
You can activate the events in the TABLE MAINTENANCE (SE11), Miantenance --> Events. For this you can use event 002, before saving to the database.
In this event you can update the extra fields that you are talking about.
Regards
Ravi
06-06-2006 5:13 PM
06-06-2006 5:20 PM
Hii Suresh ,
check this
->Execute <b>SE54</b>
-> Enter your ZTABLE name.
-> Choose Change button.
-> In the next screen press F7.
-> In the popup that comes up choose the 1st option which suits best to ur case and then press enter.
-> Save the changes and the regenartion is complete.
Regards
Naresh
06-06-2006 5:25 PM
You have to write the code in EVENT 01 in SE54 transaction. Go to SE54, enter your Ztable name and in the menu 'Environment-->Events'. Press 'ENTER' to go past the popup message. In the next screen, click on 'New Entries'. In the first column, enter 01 and in the next column give some name for your routine(say UPDATE_USER_DATE_TIME). Then click on the souce code icon that appears in blue at the end of the row. In the code, you need logic like below.
FORM update_user_date_time.
DATA: f_index LIKE sy-tabix.
DATA: BEGIN OF l_total.
INCLUDE STRUCTURE zztable.
INCLUDE STRUCTURE vimtbflags.
DATA END OF l_total.
DATA: s_record TYPE zztable.
LOOP AT total INTO l_total.
IF l_total-vim_action = aendern OR
l_total-vim_action = neuer_eintrag.
MOVE-CORRESPONDING l_total TO s_record.
s_record-zz_user = sy-uname.
s_record-zz_date = sy-datum.
s_record-zz_time = sy-uzeit.
READ TABLE extract WITH KEY l_total.
IF sy-subrc EQ 0.
f_index = sy-tabix.
ELSE.
CLEAR f_index.
ENDIF.
MOVE-CORRESPONDING s_record TO l_total.
MODIFY total FROM l_total.
CHECK f_index GT 0.
MODIFY extract INDEX f_index FROM l_total.
ENDIF.
ENDLOOP.
ENDFORM. " UPDATE_USER_DATE_TIME
Here ZZTABLE is the Z table and ZZ_USER, ZZ_DATE, and ZZ_TIME are the fields that are updated.
06-06-2006 6:09 PM
11-29-2006 7:23 AM
Hello,
Sorry for bugging you, I saw in your posts that you have experience with Table maintenance events. I have problems understanding how to write the code for validation with event 01. The problem is that my system is Unicode, and if I try the example you posted here, I have the following short dump:
Runtime Error UC_OBJECTS_NOT_CONVERTIBLE
Date and Time 27.11.2006 15:13:08
ShrtText
Data objects in a Unicode program are not convertible.
Error analysis
The statement
"MOVE src TO dst"
requires the operands "dst" and "src" to be comvertible.
Since this statement occurs in a Unicode program, the special
convertibility rules for Unicode programs apply. In this case, the
following rules have been broken:
Thank you a lot, I am stuck with this problem for a few days!
12-21-2010 12:05 PM
Hi Srinivas Adavi ,
I was facing the same problem for updating the date and time in table maintenance generator .I followed the steps of your coding and could get the desired results ..
Thanks ..
06-07-2006 6:05 PM
Did the code help? If so can you please close the issue?
Thanks,
Srinivas
06-12-2006 1:56 PM
hi sorry for late.i was away from office for couple of days.
Still unable to solve the issue.once completed i will close the issue.
Thanks
06-12-2006 2:28 PM
Hi Srinivas,
i followed the steps what u mentioned.
i have created a subrotuine get_date_time in event01.
it showed a new include when i clik editor and wrote the code. i mentioned the form name and then code.
here why not i'm not getting subrouine name by default.
but while entering data thr sm30 its dumping as
call perform to a non-existent routine.its not able to recongise the form name.
Even its simple steps, i think somewhere i'm doing wrong.
Thanks
06-12-2006 8:51 PM
Is the include inserted into your table maintenance function group main program? Just go and activate your table maintenance function group and see if that is what the issue is.
Subroutine names are defined by you, they are not defaulted.
06-15-2006 4:27 PM