2008 Nov 17 4:30 PM
Hi
i want to use slg1 to display log.Currently using this but not getting anything on output screen.I am using session method.Please tell if this code is fine and we need to write after bdc insert this code.
DATA: BEGIN OF p_prot_mess OCCURS 0.
INCLUDE STRUCTURE balMI.
DATA: END OF p_prot_mess.
DATA: prot_obj LIKE balhdr-object VALUE 'ZBUDGET_UPLOAD',
sub_obj LIKE balhdr-object VALUE 'ZBUDGET_UPLOAD'.
DATA: BEGIN OF prot_nr OCCURS 0.
INCLUDE STRUCTURE balnri.
DATA: END OF prot_nr.
DATA: BEGIN OF prot_head.
INCLUDE STRUCTURE balhdri.
DATA: END OF prot_head.
DATA: client_role TYPE c.
CALL FUNCTION 'TR_SYS_PARAMS'
IMPORTING
system_client_role = client_role.
CALL FUNCTION 'APPL_LOG_INIT'
EXPORTING
object = prot_obj
subobject = sub_obj
EXCEPTIONS
OTHERS = 0.
prot_head-object = prot_obj.
prot_head-subobject = sub_obj.
prot_head-aldate = syst-datum.
prot_head-altime = syst-uzeit.
prot_head-aluser = syst-uname.
prot_head-altcode = syst-tcode.
prot_head-alprog = syst-repid.
prot_head-aldate_del = syst-datum + 100.
prot_head-del_before = 'X'.
CALL FUNCTION 'APPL_LOG_WRITE_HEADER'
EXPORTING
header = PROT_HEAD
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'APPL_LOG_WRITE_MESSAGES'
TABLES
messages = P_PROT_MESS
EXCEPTIONS
object_not_found = 0.
CALL FUNCTION 'APPL_LOG_WRITE_DB'
TABLES
object_with_lognumber = PROT_NR
EXCEPTIONS
OTHERS = 0.
Hi
i want to use slg1 to display log.Currently using this but not getting anything on output screen.I am using session method.Please tell if this code is fine and we need to write after bdc insert this code.
DATA: BEGIN OF p_prot_mess OCCURS 0.
INCLUDE STRUCTURE balMI.
DATA: END OF p_prot_mess.
DATA: prot_obj LIKE balhdr-object VALUE 'ZBUDGET_UPLOAD',
sub_obj LIKE balhdr-object VALUE 'ZBUDGET_UPLOAD'.
DATA: BEGIN OF prot_nr OCCURS 0.
INCLUDE STRUCTURE balnri.
DATA: END OF prot_nr.
DATA: BEGIN OF prot_head.
INCLUDE STRUCTURE balhdri.
DATA: END OF prot_head.
DATA: client_role TYPE c.
CALL FUNCTION 'TR_SYS_PARAMS'
IMPORTING
system_client_role = client_role.
CALL FUNCTION 'APPL_LOG_INIT'
EXPORTING
object = prot_obj
subobject = sub_obj
EXCEPTIONS
OTHERS = 0.
prot_head-object = prot_obj.
prot_head-subobject = sub_obj.
prot_head-aldate = syst-datum.
prot_head-altime = syst-uzeit.
prot_head-aluser = syst-uname.
prot_head-altcode = syst-tcode.
prot_head-alprog = syst-repid.
prot_head-aldate_del = syst-datum + 100.
prot_head-del_before = 'X'.
CALL FUNCTION 'APPL_LOG_WRITE_HEADER'
EXPORTING
header = PROT_HEAD
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'APPL_LOG_WRITE_MESSAGES'
TABLES
messages = P_PROT_MESS
EXCEPTIONS
object_not_found = 0.
CALL FUNCTION 'APPL_LOG_WRITE_DB'
TABLES
object_with_lognumber = PROT_NR
EXCEPTIONS
OTHERS = 0.
2008 Nov 20 10:21 AM
hi,
please use this code if possible....since BAL is much more flexible den APP...
First go to SLG0 and create an Object and sub-object in customer name space. Then write the following code in your programu2026..
DATA: w_loghead TYPE bal_s_log,
w_logmsg TYPE bal_s_msg..
w_loghead-object = 'OBJECT NAME'.
w_loghead-subobject = 'SUBOBJECT NAME'.
w_loghead-aldate_del = sy-datum + 90. "expires in 90 days
*Creating LOG
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING i_s_log = w_loghead
IMPORTING e_log_handle =
EXCEPTIONS
OTHERS = 1.
w_logmsg-msgty = sy-msgty.
w_logmsg-msgid = u2018Message class nameu2019.
w_logmsg-msgno = 'Message number'.
w_logmsg-msgv1 = msg_v1.
w_logmsg-msgv2 = msg_v2.
w_logmsg-msgv3 = msg_v3.
w_logmsg-msgv4 = msg_v4.
Adding Log
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING "i_log_handle =
i_s_msg = w_logmsg
EXCEPTIONS
OTHERS = 1.
Saving Log
CALL FUNCTION 'BAL_DB_SAVE'
EXPORTING "i_t_log_handle =
I_SAVE_ALL = 'X'
EXCEPTIONS
OTHERS = 1.
COMMIT WORK.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |