SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Application Log



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Sep 08, 2007 7:03 pm    Post subject: Application Log Reply with quote

CM_F_INITIALIZE - Initialisierung der Fehlersteuerung und -analyse
CM_F_SET_OBJECT - Vermerkt das Objekt bzw. Unterobj.f_r die im folgenden auftretenden Fehler
CM_F_MESSAGE - Sammelt die Nachrichten in einer internen Fehlerprotokolltabelle
Code:
CALL FUNCTION 'CM_F_MESSAGE'
EXPORTING
ARBGB = <your message class>
MSGNR = <message number>
MSGTY = <message type>
MSGV1 = <text 1>
MSGV2 = <text 2>
MSGV3 = <text 3>


CM_F_INFO - Übergibt Informationen zu den bereits gesammelten Nachrichten
CM_F_ANALYSIS - Übernimmt die aufbereitete Darstellung für eine Fehleranalyse
CM_F_DISPLAY_LOG - Anzeige des Protokolls


BAPI_APPLICATIONLOG_GETDETAIL - Read Details of Entries in Application Log

Follow modules log events in the application log in your application.

BAL_LOG_CREATE - Open a log
BAL_LOG_MSG_ADD - Put a message in the log
BAL_DSP_LOG_DISPLAY - Display log

Code:
report z_appl_log_example.

DATA: g_s_log            type bal_s_log,
          g_log_handle TYPE balloghndl,
          g_dummy.

data: begin of probclass,
        very_high type bal_s_msg-probclass value '1',
        high      type bal_s_msg-probclass value '2',
        medium    type bal_s_msg-probclass value '3',
        low       type bal_s_msg-probclass value '4',
        none      type bal_s_msg-probclass value is initial,
      end of probclass.

start-of-selection.
*******************

* I. Create application log:
  g_s_log-extnumber = 'Application Log Example'.
  g_s_log-aluser    = sy-uname.
  g_s_log-alprog    = sy-cprog.
  call function 'BAL_LOG_CREATE'
    EXPORTING
      I_S_LOG                       = g_s_log
   IMPORTING
     E_LOG_HANDLE               = g_log_handle
    EXCEPTIONS
      LOG_HEADER_INCONSISTENT       = 1
      OTHERS                        = 2.
  case sy-subrc.
    when 1. message e398(00) with 'Cannot create log: bad log header'.
    when 2. message e398(00) with 'Cannot create log'.
  endcase.

* II. Add messages to the log:
* issue message and add to log
  message s398(00) with 'message 1:' 'very important info'.
  perform msg_add using probclass-very_high sy-msgty sy-msgid sy-msgno
                        sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* issue message to dummy (not to user) and add to log
  message e398(00) with 'message 1:' 'important info'
          into g_dummy.
  perform msg_add using probclass-high sy-msgty sy-msgid sy-msgno
                        sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* directly add to log
  perform msg_add using probclass-medium 'W' '00' '398'
                        'info' space space space.
  perform msg_add using probclass-low 'I' '00' '398'
                        'just FYI' space space space.
  perform msg_add using probclass-none 'I' '00' '398'
                        '????' space space space.

* III. Display application log:
  DATA: l_s_display_profile TYPE bal_s_prof.
  DATA lt_log_handles TYPE bal_t_logh.

* get a prepared profile AS POPUP
  CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
           IMPORTING
             e_s_display_profile = l_s_display_profile
           EXCEPTIONS
             OTHERS              = 1.
  IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* set report to allow saving of variants
  l_s_display_profile-disvariant-report = sy-repid.
* when you use also other ALV lists in your report,
* please specify a handle to distinguish between the display
* variants of these different lists, e.g:
  l_s_display_profile-disvariant-handle = 'LOG'.

  APPEND g_log_handle TO lt_log_handles.

  CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
         EXPORTING
           I_S_DISPLAY_PROFILE = l_s_display_profile
           I_T_LOG_HANDLE        = lt_log_handles
         exceptions
           profile_inconsistent = 1
           internal_error       = 2
           no_data_available    = 3
           no_authority         = 4.
  case sy-subrc.
    when 1. message e398(00) with 'Cannot display log: bad profile'.
    when 2. message e398(00) with 'Cannot display log: internal error'.
    when 3. message e398(00) with 'Cannot display log: no data'.
    when 4. message e398(00) with 'Cannot display log: no authority'.
  endcase.

********************************************************************
form msg_add using value(p_probclass) type bal_s_msg-probclass
                   value(p_msgty)     like sy-msgty
                   value(p_msgid)     like sy-msgid
                   value(p_msgno)     like sy-msgno
                   value(p_msgv1)     like sy-msgv1
                   value(p_msgv2)     like sy-msgv2
                   value(p_msgv3)     like sy-msgv3
                   value(p_msgv4)     like sy-msgv4.
  data l_s_msg type bal_s_msg.

  l_s_msg-msgty     = p_msgty.
  l_s_msg-msgid     = p_msgid.
  l_s_msg-msgno     = p_msgno.
  l_s_msg-msgv1     = p_msgv1.
  l_s_msg-msgv2     = p_msgv2.
  l_s_msg-msgv3     = p_msgv3.
  l_s_msg-msgv4     = p_msgv4.
  l_s_msg-probclass = p_probclass.

  call function 'BAL_LOG_MSG_ADD'
    EXPORTING
     I_LOG_HANDLE           = g_log_handle
      I_S_MSG                   = l_s_msg
*   IMPORTING
*     E_S_MSG_HANDLE            =
*     E_MSG_WAS_LOGGED          =
*     E_MSG_WAS_DISPLAYED       =
    EXCEPTIONS
      LOG_NOT_FOUND             = 1
      MSG_INCONSISTENT          = 2
      LOG_IS_FULL               = 3
      OTHERS                    = 4.
  case sy-subrc.
    when 1. message e398(00) with 'Cannot add msg: log not found'.
    when 2. message e398(00) with 'Cannot add msg: bad msg'.
    when 3. message e398(00) with 'Cannot add msg: log full'.
    when 4. message e398(00) with 'Cannot add msg'.
  endcase.
endform.


APPL_LOG_DELETE - With this function module you delete logs in the database according to specified selection conditions

APPL_LOG_DISPLAY_INTERN - With this function module you can analyze logs in local memory, e.g. when you have only collected log records at runtime and do not want to write to the database.

APPL_LOG_INIT - This function module checks whether the specified object or sub-object exists and deletes all existing associated data in local memory.

APPL_LOG_READ_INTERN - With this function module you read all log data whose log class has at least the specified value, from local memory, for the specified object or sub-object.

APPL_LOG_SET_OBJECT - With this function module, you create a new object or sub-object for writing in local memory. With a flag you can control whether the APPL_LOG_WRITE_... messages are written in local memory or are output on the screen.

APPL_LOG_WRITE_DB - With this function module you write all data for the specified object or sub-object in local memory to the database. If the log for the object or sub-object in question is new, the log number is returned to the calling program.

APPL_LOG_WRITE_HEADER - With this function module, you write the log header data in local memory.

APPL_LOG_WRITE_LOG_PARAMETERS - With this function module, you write the name of the log parameters and the associated values for the specified object or sub-object in local memory. If this function module is called repeatedly for the same object or sub-object, the existing parameters are updated accordingly. If you do not specify an object or sub-object with the call, the most recently used is assumed.

APPL_LOG_WRITE_MESSAGE_PARAMS - With this function module you write a single message, with parameters, in local memory. Otherwise the function module works like APPL_LOG_WRITE_SINGLE_MESSAGE.

APPL_LOG_WRITE_MESSAGES - With this function module you write one or more messages, without parameters, in local memory.

APPL_LOG_WRITE_SINGLE_MESSAGE - With this function module you write a single message, without parameters, in local memory. If no header entry has yet been written for the object or sub-object, it is created. If you do not specify an object or sub-object with the call, the most recently used is assumed.

BAL_DB_DELETE - Delete logs from the database

BAL_DB_LOAD - Load logs from the database

BAL_DB_SAVE - Save logs in the database

BAL_DB_SEARCH - Find logs in the database

BAL_CNTL_CREATE - Create Control for log display

BAL_CNTL_FREE - Release Control

BAL_CNTL_REFRESH - Put new data in log display

BAL_DB_DEQUEUE - Application Log: Database: Unlock log

BAL_DB_ENQUEUE - Application Log: Database: Lock log

BAL_DB_SAVE_PREPARE - Application Log: Database: Preparation (replace temp. numbers)

BAL_DSP_LOG_PARAMETERS - Either output extended long text or call a callback routine (based on the data in BAL_S_LOG-PARAMS)

BAL_DSP_LOG_TECHNICAL_DATA - Output all log header data

BAL_DSP_MSG_LONGTEXT - Display message long text

BAL_DSP_MSG_PARAMETERS - Either output extended long text or call a callback routine (based on the data in BAL_S_MSG-PARAMS)

BAL_DSP_MSG_TECHNICAL_DATA - Output technical data of a message such as work area, error number, etc.

BAL_DSP_OUTPUT_FREE - End output

BAL_DSP_OUTPUT_INIT - Initialize output

BAL_DSP_OUTPUT_SET_DATA - Set dataset to be displayed

BAL_DSP_PROFILE_DETLEVEL_GET - Message hierarchy in DETLEVEL

BAL_DSP_PROFILE_NO_TREE_GET - Display without tree (fullscreen)

BAL_DSP_PROFILE_POPUP_GET - Display without tree (popup)

BAL_DSP_PROFILE_SINGLE_LOG_GET - Standard profile (SLG1) for one log

BAL_DSP_PROFILE_STANDARD_GET - Standard profile (SLG1) for a lot of logs

BAL_GLB_AUTHORIZATION_GET - Assign authorization

BAL_GLB_AUTHORIZATION_RESET - Reset authorization

BAL_GLB_CONFIG_GET - Read configuration

BAL_GLB_CONFIG_SET - Set configuration

BAL_GLB_MEMORY_EXPORT - Exports exports the Application Log local memory into ABAP-MEMORY
Use it when you work roll area-independently.

BAL_GLB_MEMORY_IMPORT - Imports data which was exported into ABAP-MEMORY with the function module BAL_GLB_MEMORY_EXPORT.
Use it if you work roll area-independently.

BAL_GLB_MEMORY_REFRESH - (Partially) reset global memory

BAL_GLB_MSG_CURRENT_HANDLE_GET - Get current message handle

BAL_GLB_MSG_DEFAULTS_GET - Get message defaults

BAL_GLB_SEARCH_LOG - Find logs in memory

BAL_GLB_SEARCH_MSG - Find messages in memory

BAL_LOG_DELETE - Delete log (from database also at Save)

BAL_LOG_EXIST - Check existence of a log in memory

BAL_LOG_HDR_CHANGE - Change log header

BAL_LOG_HDR_CHECK - Check log header data for consistency

BAL_LOG_HDR_READ - Read log header and other data

BAL_LOG_MSG_CHANGE - Change message

BAL_LOG_MSG_CHECK - Check message data for consistency

BAL_LOG_MSG_CUMULATE - Add message cumulated

BAL_LOG_MSG_DELETE - Delete message

BAL_LOG_MSG_EXIST - Check existence of a message in memory

BAL_LOG_MSG_READ - Read message and other data

BAL_LOG_MSG_REPLACE - Replace last message

BAL_LOG_REFRESH - Delete log from memory

BAL_LOG_REFRESH - Delete log from memory

BAL_MSG_DISPLAY_ABAP - Output message as ABAP-MESSAGE

BAL_OBJECT_SELECT - Read Application Log objects table record

BAL_OBJECT_SUBOBJECT - Check whether object and subobject exist and the combination is allowed

BAL_SUBOBJECT_SELECT - Read subobject table record
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.