09-29-2008 12:03 PM
hi
i am trying to create a log for a condition using the function module
bal_log_create
but i donot know how to use this fm.
wat are the input and output parameters.
points promised for helpful answers.
09-29-2008 12:05 PM
Hi
Check thiss:
The function module BAL_LOG_CREATE opens the Application Log whose header data is in the Importing parameter I_S_LOG_HEADER, which has the structure BAL_S_LOG.
The function module BAL_LOG_CREATE returns the log handle (LOG_HANDLE, CHAR22).
The LOG_HANDLE is a GUID (globally unique identifier) which uniquely identifies a log. You can access this log with this handle, for example, to subsequently change the header data ( BAL_LOG_HDR_CHANGE) or to add a message ( BAL_LOG_MSG_ADD) or an exception text ( BAL_LOG_EXCEPTION_ADD) to the log.
The LOG_HANDLE has its permanent value straight away, so it remains valid after saving.
==>Note:
Logs in memory and in the database are referred to in the new Application Log by the log handle (LOG_HANDLE), but the previous LOGNUMBER, which is assigned from number range interval 01 of number range object APPL_LOG when you save, still exists. A lot of applications have a reference to this LOGNUMBER in their structures, so it is still supported. The LOGNUMBER is also more understandable for users than the LOG_HANDLE. There is a 1:1 relationship between LOG_HANDLE and LOGNUMBER.
Regards,
VIshwa.
09-29-2008 12:20 PM
Hi,
create itab with msgid, mgno,msgtype,text1,text2,text3,text4 in this case it is t_msg_log
PERFORM f_createlog USING '002' 'E' sy-msgno sy-msgv1
sy-msgv2
FORM f_createlog USING p_mesid
p_msgtyp
p_msgnbr
p_msgv1
p_msgv2.
CLEAR: wa_msg_log.
wa_msg_log-msgid = p_mesid.
wa_msg_log-msgty = p_msgtyp.
wa_msg_log-msgno = p_msgnbr.
wa_msg_log-msg_text_1 = p_msgv1.
wa_msg_log-msg_text_2 = p_msgv2.
APPEND wa_msg_log TO t_msg_log.
ENDFORM.
u hav to populate these fileds find values in your system
DATA:
l_log_handle TYPE balloghndl,
l_s_log TYPE bal_s_log,
l_dummy TYPE string,
l_ext_no TYPE bal_s_log-extnumber,
l_s_mdef TYPE bal_s_mdef.
l_s_log-object = i_log_object.
l_s_log-extnumber = i_extnumber.
l_s_log-subobject = i_subobj.
l_s_log-alprog = i_prog.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = l_s_log
IMPORTING
e_log_handle = l_log_handle
EXCEPTIONS
log_header_inconsistent = 1
OTHERS = 2.
just giving outline .Hope it helps you
Rhea.
09-30-2008 7:53 AM