11-26-2007 4:48 AM
Hi all... Good morning
please tell me what is the use of check box <b>log data changes</b> in database technical settings.....
Regards
Prajwal.K
11-26-2007 4:54 AM
If logging is switched on, each change to an existing data record (with UPDATE, DELETE) by the user or application program is recorded in the database in a log table (DBTABPRT).
The existing logs can be displayed with Transaction Table History (SCU3).
for more refer
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eab8446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eab8446011d189700000e8322d00/frameset.htm</a>
regards
shiba dutta
11-26-2007 4:51 AM
When creating a log entry, you can tell the system how long should it be stored before its deleted automatically. Unlike in the above case with your own log table, you dont need a reorganization program. I normally request the log messages to be stored for 30 days, it can be less if you feel like your system will not be happy to carry the weight.
Enough with discussion, lets see the code now:
this include contains log system constants and has to be used
in your program (or top include if it's a function group)
include sbal_constants.
the form writes a single log entry to application log,
building log entry identifier from parameters pf_par1 and pf_par2,
and writing the content of other parameters into the message
form write_log
using pf_par1
pf_par2
pf_str1 type char50
pf_str2 type char50
pf_str3 type char50
pf_str4 type char50.
data:
ls_log type bal_s_log,
lt_handle type bal_t_logh,
lf_handle type balloghndl,
ls_msg type bal_s_msg.
we use production order / operation log objects
ls_log-object = 'PPORDER'.
ls_log-subobject = 'OPERATION'.
concatenate 'Some_Name_' pf_par1 '_' pf_par2
into ls_log-extnumber.
ls_log-aluser = sy-uname.
ls_log-alprog = sy-repid.
ls_log-altcode = 'YOUR_TCODE'.
ls_log-aldate_del = sy-datum + 30. "keep for one month
ls_log-del_before = 'X'.
create a log
call function 'BAL_LOG_CREATE'
exporting
i_s_log = ls_log
importing
e_log_handle = lf_handle
exceptions
others = 1.
define data of message for Application Log
Use generic message template with & & & &
ls_msg-msgty = 'S'.
ls_msg-msgid = '01'.
ls_msg-msgno = '319'.
ls_msg-msgv1 = pf_str1.
ls_msg-msgv2 = pf_str2.
ls_msg-msgv3 = pf_str3.
ls_msg-msgv4 = pf_str4.
ls_msg-probclass = probclass_none.
add this message to log
this function can be called several times to have one log entry
store several different messages
call function 'BAL_LOG_MSG_ADD'
exporting
i_log_handle = lf_handle
i_s_msg = ls_msg
exceptions
others = 1.
save the log
append lf_handle to lt_handle.
call function 'BAL_DB_SAVE'
exporting
i_save_all = 'X'
i_t_log_handle = lt_handle
exceptions
others = 1.
endform.
11-26-2007 4:51 AM
11-26-2007 4:54 AM
If logging is switched on, each change to an existing data record (with UPDATE, DELETE) by the user or application program is recorded in the database in a log table (DBTABPRT).
The existing logs can be displayed with Transaction Table History (SCU3).
for more refer
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eab8446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eab8446011d189700000e8322d00/frameset.htm</a>
regards
shiba dutta
11-26-2007 4:59 AM
Hi
<b>Log data changes</b>
The logging flag defines whether changes to the data records of a table should be logged. If logging is activated, every change (with UPDATE, DELETE) to an existing data record by a user or an application program is recorded in a log table in the database.
Note: Activating logging slows down accesses that change the table. First of all, a record must be written in the log table for each change. Secondly, many users access this log table in parallel. This could cause lock situations even though the users are working with different application tables.
<b>Dependencies</b>
Logging only takes place if parameter rec/client in the system profile is set correctly. Setting the flag on its own does not cause the table changes to be logged.
The existing logs can be displayed with Transaction Table history (SCU3).
<b>Reward if usefull</b>
11-26-2007 5:37 AM
Hi..
you mean to say that DELETED or UPDATED data are stored in that database table <b>DBTABPRT</b> ....
Regards
Prajwal.k