https://answers.sap.com/questions/1515224/how-we-can-see-application-log.html
sap sample program:SBAL_DEMO_04
CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
IMPORTING
E_S_DISPLAY_PROFILE = V_PROFILE
EXCEPTIONS
OTHERS = 1.
V_PROFILE-USE_GRID = 'X'. "Use grid control for output
V_PROFILE-POP_ADJST = 'X'. "Adjust popup height
V_PROFILE-CWIDTH_OPT = 'X'. "Optimize message list column width
V_PROFILE-TITLE = TEXT-M01.
V_PROFILE-END_COL = 110.
LOOP AT V_PROFILE-MESS_FCAT ASSIGNING <LV_MESS_FCAT>
WHERE REF_FIELD = 'MSGTY'
OR REF_FIELD = 'MSGID'
OR REF_FIELD = 'MSGNO'.
LV_CNT = LV_CNT + 1.
CLEAR:<LV_MESS_FCAT>-NO_OUT.
<LV_MESS_FCAT>-COL_POS = LV_CNT.
ENDLOOP.
* Application Log: Log: Create with Header Data
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
I_S_LOG = V_LOG
IMPORTING
E_LOG_HANDLE = V_LOG_HANDLE
EXCEPTIONS
LOG_HEADER_INCONSISTENT = 1
OTHERS = 2.
LOOP AT I_ERRPARAM INTO WA_ERRPARAM.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
I_LOG_HANDLE = V_LOG_HANDLE
I_S_MSG = WA_ERRPARAM
IMPORTING
E_S_MSG_HANDLE = V_MSG_HANDLE
EXCEPTIONS
LOG_NOT_FOUND = 1
MSG_INCONSISTENT = 2
LOG_IS_FULL = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
* Create Application Log
PERFORM SYSTEM_ERROR USING 'BAL_LOG_MSG_ADD'
SY-SUBRC.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
I_T_LOG_HANDLE = I_LOG_HANDLE
I_S_DISPLAY_PROFILE = V_PROFILE
I_AMODAL = V_IM_NEW_SESSION
IMPORTING
E_S_EXIT_COMMAND = ST_EX_EXIT_COMMAND
EXCEPTIONS
PROFILE_INCONSISTENT = 1
INTERNAL_ERROR = 2
NO_DATA_AVAILABLE = 3
NO_AUTHORITY = 4.
没有评论:
发表评论