‎2006 Sep 21 10:40 PM
hi friends,
I have two fields in my ztable calle authouized_by(name of the person who was responsible) and effective date(todays date if not filled)
sould be FILLED automatically filled when its saved.
how could i achieve this? could anyone of you please help me out along with the code.
Thanks
rinky
‎2006 Sep 21 11:24 PM
Hi,
TOTAL is the internal table which has the table values with the modified records also.
Thanks,
Naren
‎2006 Sep 21 10:43 PM
Hi,
If you are using SM30 for maitaining the table..add a row to the table V_TVIMF with the event '1' and give a subroutine name MOVE_DATE..
In the subroutine add the code to move the user name and date..
add this subroutine to the function group that is created for the table maintenance..
FORM MOVE_DATE.
DATA: S_STRUCTURE TYPE ZTABLE....
LOOP AT TOTAL.
S_STRUC = TOTAL.
S-STRUC-DATE = SY-DATUM.
S_STRUC-USER = SY-UNAME.
TOTAL = S_STRUC.
MODIFY TOTAL.
ENDLOOP.
ENDFORM.
Hope this helps..
Thanks,
naren
‎2006 Sep 21 11:22 PM
‎2006 Sep 22 5:20 AM
hi,
i think u can use table maintenance events for this purpose.
1. go to se11
2. utilities -> table maintenance generator. or SE55
3. now environment -> modifications -> events
here u can select event '05' for validations to be done before saving an entry into DBtable.
here as many already suggested u can code the following.
move <name> to ztable-authorised_by.
if effective_date is initial.
move sy-datum to effective_date.
end if.
u can code in PAI but when table maintenance is regenerated, this coding is lost.
reward if useful....
‎2006 Sep 21 11:24 PM
Hi,
TOTAL is the internal table which has the table values with the modified records also.
Thanks,
Naren
‎2006 Sep 22 4:42 PM
‎2006 Sep 21 11:28 PM
Hi Rinky,
You can code something like this.
...
move sy-uname to ztable-authouized_by.
if ztable-effective_date is initial.
move sy-datum to ztable-effective date.
endif.
modify ztable.Regards,
Ferry Lianto
‎2006 Sep 22 1:56 AM
Hi,
Assume table name is ZTABLE.
1. Create a Table maintenance through transaction SE11.
2. Once table maintenanace is created, a Function group would be created automatically of the same name ZTABLE.
3. Goto SE80. Select Function Group and Enter the name as ZTABLE.
4. In the Function Group, under PAI event of SAVE, include following code.
ZTABLE-AUTHORIZED = sy-uname.
if ZTABLE-DDATE is initial.
ZTABLE-DDATE = sy-datum.
ENDIF.
This should be included in the PAI EVENT before the MODIFY ZTABLE statement.
Best regards,
Prashant