Содержание
- Error log transaction sap
- Prerequisites
- Procedure
- Result
- More Information
- Viewing the Error Log with the SAP System
- Displaying Error Log
- Prerequisites
- Context
- Procedure
- Results
- Next Steps
- Viewing the Error Log with the SAP System
- Error Log
Error log transaction sap
The error logging function provides information about all errors happening during the processing in the SOAP runtime. The system writes an entry in the error log for any Web service error, both for synchronous and asynchronous Web service communication. Note that the log may not contain details on every error if aggregation has been switched on during configuration. For more information, see Configuring Logging
You can use the error log to:
Check the recommended action for an entry, and try to solve the problem or ask for help from the administrators or SAP Active Global Support .
Use information such as the names of the interface and the operation, the message ID, and the user ID to perform further analyses in the Message Monitor and the Sequence Monitor .
Use the information about an error to activate the tracing function and analyze the error in detail.
Consider that the error log contains entries only for errors that occur during runtime. It does not contain information about activities such as changes to the Web service configuration, deletion or cancellation of Web service messages, or termination of Web service sequences. You can find information about these activities using the SOAP Configuration Management tools. More information: Application Log – (BC-SRV-BAL)
Prerequisites
You have activated and configured logging. More information: Configuring Logging
Your user is assigned one of the following roles:
SAP_BC_WEBSERIVCE_ADMIN_BIZ allows you only to view the error log.
SAP_BC_WEBSERIVCE_ADMIN_TEC allows you to view and manage the error log.
For more information, see Authorizations .
Procedure
Start transaction SRT_UTIL.
Choose Error Log.
The error log displays by default the entries for the current day for all users.
To find log entries that are not displayed, choose Select Logs and set the search parameters.
You can change the expiration date for a log entry by selecting it and choosing ( Change Expiry Date) .
The number of days for which the error log keeps the error entries can be configured for each SAP client of an ABAP system.
Result
The system displays error log entries according to the search criteria you specified. The displayed information can help a Web service user or system administrator to solve Web service issues.
Recommended Action
Choose ( Show recommended action) in the Long Text column for an error log entry. This way you can obtain information about the error diagnosis, the system response, and recommendations on what a Web service user or administrator can do to solve the problem.
Error Details
By default, the system displays general information such as date and time, client ID, operation ID, user name, consumer proxy or server proxy, error category, component, package, and many other details.
You can choose to display or hide columns as needed. More information: Showing and Hiding Columns
Additional Information
In addition to the general information, you can obtain additional useful information in one of the following ways:
Choose Summarize Logs to view a summary of error log entries.
You can see the error context for a log entry by selecting the entry in the list and choosing Error Context.
The error context contains variable data delivered by an SOAP Runtime component, and also information about the current consumer or provider configuration.
To view the basic details or the source of a log entry, you need to select the entry in the list and choose ( Details) or ( View Source Code) , respectively.
Choose ( Download as XML) to download a log entry as a file.
You can send this file to your colleagues or to SAP Active Global Support when you need to discuss errors.
Choose the link in the Consumer/Server Proxy column for an error log entry to receive more information about the corresponding ABAP proxy object. More information: Displaying ABAP Proxy Objects
For asynchronous messages, you can choose the link in the Message ID column to display details about the corresponding XML message. More information: Monitor for Processed XML Messages
Choose the link in the Sequence ID column for an error log entry to receive more information about the corresponding sequence. More information: Monitoring Sequences
Choose the link in the Queue Name column for an error log entry to access the bgRFC monitor, where you can obtain information about the corresponding bgRFC units. More information: bgRFC Monitor
More Information
Transaction SOAMANAGER also provides error and trace logs for the Web service runtime. The tools provided by this transaction are based on a different logging and tracing concept. They are configured, implemented, and viewed independently of the Web service support utilities described here. More information: Displaying Logs and Traces
The Web service support utilities can be integrated in transaction SOAMANAGER in future releases.
Источник
Viewing the Error Log with the SAP System
The error log is a central file(s) in which all the important actions and error messages concerning the database are recorded. The database administrator should examine the log every day.
- To view the error log, use transaction DBACOCKPIT.
- Choose Diagnostics.
- Choose SQL Error Logs.
All the available error logs are listed.
To display the contents of a particular log, click on it to list its contents below.
A new error log is created each time SQL Server starts. SQL Server retains backups of the previous six error logs. If the log file name is E: Program FilesMicrosoft SQL ServerLOGERRORLOG, the last six log files are archived under the following names:
E: Program FilesMicrosoft SQL ServerLOGERRORLOG.1
E: Program FilesMicrosoft SQL Server\LOGERRORLOG.2 …
E: Program FilesMicrosoft SQL Server\LOGERRORLOG.6
Each time the SQL Server starts, the archived oldest log files are overwritten and lost, unless you save them first. If you have a serious problem, you should immediately save these files otherwise they are lost.
Pay special attention to the columns Contains Severity 17 and Contains Severity 20. If a Y appears in these columns, it means a noteworthy severity level error message has occurred, and the cause should be investigated.
Newer versions of the application allow you to select checkboxes to include only severity 20 or 17 errors, or to exclude backup and logon messages.
Источник
Displaying Error Log
Prerequisites
You have activated and configured logging. More information: Configuring Logging
Your user is assigned one of the following roles:
SAP_BC_WEBSERIVCE_ADMIN_BIZ allows you only to view the error log.
SAP_BC_WEBSERIVCE_ADMIN_TEC allows you to view and manage the error log.
For more information, see Authorizations .
Context
The error logging function provides information about all errors happening during the processing in the SOAP runtime. The system writes an entry in the error log for any Web service error, both for synchronous and asynchronous Web service communication. Note that the log may not contain details on every error if aggregation has been switched on during configuration. For more information, see Configuring Logging
You can use the error log to:
Check the recommended action for an entry, and try to solve the problem or ask for help from the administrators or SAP Active Global Support .
Use information such as the names of the interface and the operation, the message ID, and the user ID to perform further analyses in the Message Monitor and the Sequence Monitor .
Use the information about an error to activate the tracing function and analyze the error in detail.
Consider that the error log contains entries only for errors that occur during runtime. It does not contain information about activities such as changes to the Web service configuration, deletion or cancellation of Web service messages, or termination of Web service sequences. You can find information about these activities using the SOAP Configuration Management tools. More information: Application Log — (BC-SRV-BAL)
Procedure
The error log displays by default the entries for the current day for all users.
The number of days for which the error log keeps the error entries can be configured for each SAP client of an ABAP system.
Results
The system displays error log entries according to the search criteria you specified. The displayed information can help a Web service user or system administrator to solve Web service issues.
Choose in the Long Text column for an error log entry. This way you can obtain information about the error diagnosis, the system response, and recommendations on what a Web service user or administrator can do to solve the problem.
By default, the system displays general information such as date and time, client ID, operation ID, user name, consumer proxy or server proxy, error category, component, package, and many other details.
You can choose to display or hide columns as needed. More information: Showing and Hiding Columns
In addition to the general information, you can obtain additional useful information in one of the following ways:
Choose Summarize Logs to view a summary of error log entries.
You can see the error context for a log entry by selecting the entry in the list and choosing Error Context .
The error context contains variable data delivered by an SOAP Runtime component, and also information about the current consumer or provider configuration.
To view the basic details or the source of a log entry, you need to select the entry in the list and choose or , respectively.
Choose to download a log entry as a file.
You can send this file to your colleagues or to SAP Active Global Support when you need to discuss errors.
Choose the link in the Consumer/Server Proxy column for an error log entry to receive more information about the corresponding ABAP proxy object. More information: Displaying ABAP Proxy Objects
For asynchronous messages, you can choose the link in the Message ID column to display details about the corresponding XML message. More information: Monitor for Processed XML Messages
Choose the link in the Sequence ID column for an error log entry to receive more information about the corresponding sequence.
Choose the link in the Queue Name column for an error log entry to access the bgRFC monitor, where you can obtain information about the corresponding bgRFC units. More information: bgRFC Monitor
Next Steps
Transaction SOAMANAGER also provides error and trace logs for the Web service runtime. The tools provided by this transaction are based on a different logging and tracing concept. They are configured, implemented, and viewed independently of the Web service support utilities described here. More information: Displaying Logs and Traces
The Web service support utilities can be integrated in transaction SOAMANAGER in future releases.
Источник
Viewing the Error Log with the SAP System
The error log is a central file(s) in which all the important actions and error messages concerning the database are recorded. The database administrator should examine the log every day.
- To view the error log, use transaction DBACOCKPIT.
- Choose Diagnostics.
- Choose SQL Error Logs.
All the available error logs are listed.
To display the contents of a particular log, click on it to list its contents below.
A new error log is created each time SQL Server starts. SQL Server retains backups of the previous six error logs. If the log file name is E: Program FilesMicrosoft SQL ServerLOGERRORLOG, the last six log files are archived under the following names:
E: Program FilesMicrosoft SQL ServerLOGERRORLOG.1
E: Program FilesMicrosoft SQL Server\LOGERRORLOG.2 …
E: Program FilesMicrosoft SQL Server\LOGERRORLOG.6
Each time the SQL Server starts, the archived oldest log files are overwritten and lost, unless you save them first. If you have a serious problem, you should immediately save these files otherwise they are lost.
Pay special attention to the columns Contains Severity 17 and Contains Severity 20. If a Y appears in these columns, it means a noteworthy severity level error message has occurred, and the cause should be investigated.
Newer versions of the application allow you to select checkboxes to include only severity 20 or 17 errors, or to exclude backup and logon messages.
Источник
Error Log
The Error Log for SAP Gateway Foundation is a helpful addition to the Application Log Viewer. It provides detailed context information about errors that have occurred at runtime.
Developers, administrators, support consultants, and end users can launch the Error Log in transaction /IWFND/ERROR_LOG for hub systems and /IWBEP/ERROR_LOG in SAP Business Suite systems to obtain important context information about the time and location of errors. The Error Log facilitates easy navigation to the affected source code where you can make the necessary corrections.
The Error Log enables you to:
Identify precise time and location of errors in source code.
Determine how often an error has occurred.
Perform root-cause analyses.
Reproduce and correct errors.
The Error Log comprises two screen areas:
The Overview screen area lists all error IDs and their attributes, together with the date and time at which the particular errors occurred. As default, errors are displayed chronologically with the newest error at the top of the list. You can display the error information and descriptive error texts to obtain more detailed information about a particular error and also see how often and where it has occurred. You can determine the Line and Entry Number of an error in the Error Log and also ascertain the number of occurrences in the Error Count column. The error counter is helpful to reduce the amount of data stored in the Error Log as it counts the number of times an identical error (according to standard parameters including User Name, Service Name, Message Class, and Message Number) has occurred within one full hour.
As default, the Overview screen area lists all errors that have occurred on the current date for all users, but you can change the standard setting to suit your requirements. To display errors according to different criteria, choose the Re-Select icon and on the Select Error Log Entries subscreen, select the Free search radio button. The free-search options enable you to search for errors that occurred on a different date and specify the exact time range, for example.
To help you further refine your search, you can display errors according to the following criteria:
T100 Message ID
T100 Message Number
Component: can be cross-referenced if you need to create a customer message
Request URI Part
Request ID: identifier sent from consumer to SAP Gateway
If you do not want to use the free-search criteria, you can select one of the following alternative search options:
Operation ID : identifier within the Error Log
Transaction ID : identifies one transaction and is transferred to all affected SAP systems during processing.
If you select an error on the Overview screen area and then choose the Re-Select icon, the attributes of this particular error are entered automatically in the Select Error Log Entries subscreen. You can select an entire line or parts of the error information.
To enable you to identify where an error has occurred, the component, package, service name, root context ID, transaction ID, and request ID are listed in separate columns in the Overview screen area. You can sort the errors in the table according to various criteria, for example, the time or location they occurred.
If required, you can use the standard SAP Export function in the SAP List Viewer (ALV) to download the errors displayed in the Overview screen area, however the Error Log provides further options for facilitating error analysis.
The Overview screen area provides you with the following functions, which you can execute by choosing the relevant pushbuttons:
Display complete overview of context in which error occurred including technical attributes such as service name, request URI, SAP Business Suite system alias, and RFC destination. This context information is displayed in the Error Context screen area.
To display the context information in the Error Context screen area, you can select an error and then choose the Error Context pushbutton or double-click the error information in the Overview screen area.
Navigate to the source code in which the error has occurred and analyze the cause of the error.
Download the error log in XML format to your local PC. You might want to download the error log to analyze the errors offline at a later time or to forward the log as an attachment to administrators or Active Global Support. If required, you can select multiple errors in the table and download all the relevant error log information in one XML log file.
Upload error information contained in an XML file to enable easier error analysis. To upload an error log file from your PC, choose Upload from PC , browse to the relevant XML file, and choose Open . The error log information contained in the XML file is displayed in the Overview screen area of the Error Log.
Display a summary of all errors displayed in the list for each component and package together with the date and time of the first and last occurrence.
To display detailed context information about an error, double-click the relevant error item in the Overview screen area, or select the error item and choose the Error Context pushbutton. The relevant context information about the error item is displayed in the Error Context screen area where you can expand or collapse this information depending on the level of detail you require. The information displayed is organized according to Name and Value .
The Error Context screen area includes the following functions, which you can execute by choosing the relevant pushbuttons:
Display error in context in XML format. It is advantageous to display the error in XML so that all text strings are displayed in their entirety and in context. The texts displayed in the Error Context screen area are limited to 100 characters.
Display call stack up to the source code line in which the error occurred. You can select the error event to navigate to and check the relevant line of source code.
Navigate to the corresponding entry in the Application Log. You can also launch the Application Log in transaction /IWFND/APPS_LOG . Expand the tree to navigate to the error.
Display request XML that was sent from external consumer. It contains the HTTP request headers and payload.
Display response XML sent from SAP Gateway . It displayed the HTTP response headers and payload.
Access the Error Log (as of SAP Gateway 2.0 Support Package 5) or the Application Log Viewer (for lower releases) in the SAP Business Suite system. Alternatively, launch the ABAP Runtime Error application (transaction ST22 ) in the SAP Business Suite system if a short dump occurred during processing.
Choose from the following two replay options allowing you to reproduce and correct errors:
Choose from the following service maintenance options:
Maintain Service to activate and maintain services in the SAP Gateway hub system.
Service Implementation to navigate to the SAP Business Suite system and maintain the service there. In the SAP Business Suite system, you can navigate directly to the model provider class or data provider class for the given service.
For more information about how to configure the Error Log, see Configuration Settings for the Error Log.
Источник
При выполнении программы могут возникать ситуации, которые необходимо донести до пользователя. Обычно это ошибки, предупреждения или просто сообщение об успешном выполнении процедуры. Эти сообщения не должны возникать по отдельности через команду MESSAGE. Их нужно собрать и отобразить все вместе в нужный момент. Такой набор сообщений называется журналом. Журнал содержит как заголовочную информацию (код транзакции, пользователь, дата и время создания и т.п.), так и позиционную (сами сообщения).
Для ведения журнала приложений SAP предоставляет мощный инструмент, называемый BAL (Basis Application Log). Журнал приложений применяется для отладки, поддержки и разработки как стандартный, так и Z-приложений. Лог особенно необходим при отладки фоновых задачах, веб-сервисов, рабочих процессов, т.е. где не всегда удобно, а иногда даже просто невозможно использовать стандартный отладчик.
Просмотреть журнал приложения можно в тр. SLG1.
Реализация журнала приложений содержится в пакете SZAL.
Принцип работы
Весь цикл работы журнала приложений можно свести к 3-м этапам:
- Создание/загрузка журнала. Для создания экземпляра лога используется функциональный модуль BAL_LOG_CREATE. На вход в ФМ передается структура типа BAL_S_LOG, содержащая заголовочную информацию. ФМ возвращает ID журнала приложений BALLOGHNDL.
- Добавление сообщений. Для добавления сообщений используется функциональный модуль BAL_LOG_MSG_ADD. На вход ФМ передается ID журнала BALLOGHNDL, а также структура типа BAL_S_MSG содержащая информацию о сообщении.
- Сохранение/отображение журнала. За отображения лога отвечает функциональный модуль BAL_DSP_LOG_DISPLAY.
Пример простого использования журнала приложений
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
*&———————————————————————* *& Report ZBAL_LOG_EXAMPLE1 *& BAL Log: Журнал приложений SAP *&———————————————————————* *& Пример использования журнала приложений SAP *& http://abap4.ru/?p=283 *&———————————————————————* REPORT zbal_log_example1. START-OF-SELECTION. PERFORM main. FORM main. DATA ls_log TYPE bal_s_log. DATA ls_msg TYPE bal_s_msg. DATA lv_hnd TYPE balloghndl. DATA lt_hnd TYPE bal_t_logh. DATA lv_dummy TYPE string. ls_log—extnumber = ‘Журнал приложений’. ls_log—aluser = sy—uname. ls_log—alprog = sy—repid. CALL FUNCTION ‘BAL_LOG_CREATE’ EXPORTING i_s_log = ls_log IMPORTING e_log_handle = lv_hnd. MESSAGE s191(bl) INTO lv_dummy. ls_msg—msgty = sy—msgty. ls_msg—msgid = sy—msgid. ls_msg—msgno = sy—msgno. ls_msg—msgv1 = sy—msgv1. ls_msg—msgv2 = sy—msgv2. ls_msg—msgv3 = sy—msgv3. ls_msg—msgv4 = sy—msgv4. CALL FUNCTION ‘BAL_LOG_MSG_ADD’ EXPORTING i_s_msg = ls_msg i_log_handle = lv_hnd. APPEND lv_hnd TO lt_hnd. CALL FUNCTION ‘BAL_DSP_LOG_DISPLAY’ EXPORTING i_t_log_handle = lt_hnd. ENDFORM. |
Результат работы программы
Структура заголовка
№ | Параметр | Значение |
---|---|---|
1 | EXTNUMBER | Внешний идентификатор. Используется в качестве критериев поиска нужного журнала. |
2 | OBJECT | Имя объекта. Объект журнала приложений, применяется при поиске в тр. SLG1. |
3 | SUBOBJECT | Подобъект. Объект журнала приложений, применяется при поиске в тр. SLG1. |
4 | ALDATE | Дата |
5 | ALTIME | Время |
6 | ALUSER | Имя пользователя |
7 | ALTCODE | Код транзакции |
8 | ALPROG | Имя программы |
9 | ALMODE | Режим работы (B — фоновый; D — диалоговый; I — пакетный ввод; A — авто) |
10 | ALCHDATE | Дата последнего изменения |
11 | ALCHTIME | Время последнего изменения |
12 | ALCHUSER | Пользователь, изменивший журнал |
13 | ALDATE_DEL | Дата истечения срока хранения |
14 | DEL_BEFORE | Журнал сохраняется до истечения срока хранения |
15 | ALSTATE | Статус обработки (1 — подлежит обработке; 2 — в обработке; 3 — исполнено) |
16 | CONTEXT | Контекст. Используется для привязки контекста к сообщению. |
17 | PARAMS | Параметры. Используется для детализации сообщений. |
В журнале приложений эти поля будут выглядеть следующим образом
Структура сообщения
№ | Параметр | Значение |
---|---|---|
1 | MSGTY | Тип сообщения |
2 | MSGID | Класс сообщений |
3 | MSGNO | Номер сообщения |
4 | MSGV1 | Переменная сообщения |
5 | MSGV2 | Переменная сообщения |
6 | MSGV3 | Переменная сообщения |
7 | MSGV4 | Переменная сообщения |
8 | MSGV1_SRC | Происхождение переменных сообщения |
9 | MSGV2_SRC | Происхождение переменных сообщения |
10 | MSGV3_SRC | Происхождение переменных сообщения |
11 | MSGV4_SRC | Происхождение переменных сообщения |
12 | DETLEVEL | Степень детализации (число от 1 до 9) |
13 | PROBCLASS | Класс проблем сообщения (1 — особо важное; 2 — важное; 3 — среднее; 4 — дополнительная информация) |
14 | ALSORT | Критерий сортировки/группировка |
15 | TIME_STMP | Метка времени сообщения |
16 | MSG_COUNT | Число накопленных сообщений |
17 | CONTEXT | Контекст. Используется для привязки контекста к сообщению. |
18 | PARAMS | Параметры. Используется для детализации сообщений. |
Параметры MSGV1_SRC, MSGV2_SRC, MSGV3_SRC, MSGV4_SRC используются для анализа сообщений. В них можно записывать параметры или место запуска программы. Например, у нас есть 2 реализации одной и той же операции. Сообщения в журналах будут одинаковыми. Чтобы отличить происхождения сообщений, можно записать служебную информацию в переменные происхождения.
Параметры DETLEVEL, PROBCLASS, ALSORT используются для фильтрации и сортировки сообщений.
Параметр MSG_COUNT является счетчиком накопленных сообщений, в случае если отправляются одинаковые сообщения.
В журнале приложений эти поля будут выглядеть следующим образом
Пример стандартной демо-программы SBAL_DEMO_01.
Детализация сообщений
Сообщения можно детализировать. Процесс детализации заключается в следующем: в параметр PARAMS заполняются необходимые переменные и программу обратной связи для обработки детализации. При двойном клике на поле детализации вызывается программа обратной связи, в которую передаются необходимые параметры.
Параметр PARAMS является структурой типа BAL_S_PARM.
№ | Параметр | Значение |
---|---|---|
1 | T_PAR | Таблица параметров с именами параметров и их значениями |
2 | CALLBACK | Структура для обратной связи |
3 | ALTEXT | Текст из SE61, в случае если длины текста T100 не достаточно |
Программа обратной связи представляет собой функциональный модуль или подпрограмму, принимающие на вход таблицу I_T_PARAMS типа BAL_T_PAR.
В случае, если необходимо вызывать ФМ, то CALLBACK должна быть заполнена следующим образом:
CALLBACK-USEREXITT = ‘F’.
CALLBACK-USEREXITF = ИМЯ_ФМ.
В случае, если необходимо вызывать подпрограмму, то CALLBACK должна быть заполнена следующим образом:
CALLBACK-USEREXITP = ИМЯ_ПРОГРАММЫ.
CALLBACK-USEREXITF = ИМЯ_ПОДПРОГРАММЫ.
Пример журнала приложений с деталицацией
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
*&———————————————————————* *& Report ZBAL_LOG_EXAMPLE2 *& BAL Log: Журнал приложений SAP *&———————————————————————* *& Пример детализации в журнале приложений SAP *& http://abap4.ru/?p=283 *&———————————————————————* REPORT zbal_log_example2. START-OF-SELECTION. PERFORM main. FORM main. DATA ls_log TYPE bal_s_log. DATA ls_msg TYPE bal_s_msg. DATA lv_hnd TYPE balloghndl. DATA lt_hnd TYPE bal_t_logh. DATA ls_param TYPE BAL_S_PAR. DATA lv_dummy TYPE string. ls_log—aluser = sy—uname. ls_log—extnumber = ‘Журнал приложений’. CALL FUNCTION ‘BAL_LOG_CREATE’ EXPORTING i_s_log = ls_log IMPORTING e_log_handle = lv_hnd. MESSAGE w191(bl) INTO lv_dummy. ls_msg—msgty = sy—msgty. ls_msg—msgid = sy—msgid. ls_msg—msgno = sy—msgno. ls_msg—msgv1 = sy—msgv1. ls_msg—msgv2 = sy—msgv2. ls_msg—msgv3 = sy—msgv3. ls_msg—msgv4 = sy—msgv4. ls_msg—params—callback—userexitp = sy—repid. ls_msg—params—callback—userexitf = ‘CALLBACK’. ls_param—parname = ‘PAR’. ls_param—parvalue = ‘Hello, world!’. APPEND ls_param TO ls_msg—params—t_par. CALL FUNCTION ‘BAL_LOG_MSG_ADD’ EXPORTING i_s_msg = ls_msg i_log_handle = lv_hnd. APPEND lv_hnd TO lt_hnd. CALL FUNCTION ‘BAL_DSP_LOG_DISPLAY’ EXPORTING i_t_log_handle = lt_hnd. ENDFORM. FORM callback TABLES i_t_params TYPE bal_t_par. DATA ls_param TYPE bal_s_par. READ TABLE i_t_params INTO ls_param WITH KEY parname = ‘PAR’. CHECK sy—subrc EQ 0. MESSAGE ls_param—parvalue TYPE rs_c_info. ENDFORM. |
И результат выполнения
Пример стандартной демо-программы SBAL_DEMO_02.
Привязка контекста
Иногда сообщение имеет смысл только в контексте. Например, сообщение «Документ не может быть удален» возникает при обработке определённого документа. При выводе лога привязка документа теряется. Информация о документе может быть помещена в само сообщение. В этом случае могут возникнуть проблемы при анализе сообщения (в случае если перечень сообщений возвращает пакетный ввод) или число параметром может быть больше чем число переменных сообщения (например, БЕ, завод, склад, год, номер документа, позиция и т.п.).
Журнал приложения предоставляет возможность добавить к сообщениям определенный контекст. В программе просмотра журнала поля контекста можно выводить в отдельном столбце.
Для добавления контекста необходимо заполнить параметр CONTEXT, который является структурой типа BAL_S_CONT.
№ | Параметр | Значение |
---|---|---|
1 | TABNAME | Имя структуры ABAP-словаря (см. SE11) |
2 | VALUE | Данные контекста |
Если контекстом является плоская структура, все элементы которой типа CLIKE, то контекст можно заполнить прямым присвоением структуры в поле VALUE
DATA ls_msg TYPE bal_s_msg. DATA ls_ctx TYPE zs_bal_ctx. ls_msg—context—tabname = ‘ZS_BAL_CTX’. ls_msg—context—value = ls_ctx. |
В остальных случаях (например, если контекст содержит числовые поля) можно воспользоваться таким способом
DATA ls_msg TYPE bal_s_msg. DATA ls_ctx TYPE zs_bal_ctx. FIELD—SYMBOLS: <lv_ctx> TYPE c. ASSIGN ls_ctx TO <lv_ctx> CASTING. ls_msg—context—tabname = ‘ZS_BAL_CTX’. ls_msg—context—value = <lv_ctx>. |
Для вывода полей контекста в ALV журнала приложений, необходимо добавить нужное поле в каталог полей. Отображение журнала происходит через функциональный модуль BAL_DSP_LOG_DISPLAY, в который передается параметр профиля отображения I_S_DISPLAY_PROFILE. В профиле есть поле MESS_FCAT — каталог полей. В него нужно добавить нужные столбцы для отображения.
Пример стандартной демо-программы SBAL_DEMO_02.
Объединение сообщений
Некоторые сообщения отправляются программой несколько раз без предоставления новой информации. Такие сообщения могут быть объединены с помощью BAL_LOG_MSG_CUMULATE. Когда повторяется одно и то же сообщение, новое сообщение не добавляется, счетчик MSG_COUNT для старого сообщения увеличивается.
Функциональный модуль BAL_LOG_MSG_CUMULATE имеет спец. параметры, определяющие критерии объединения:
I_COMPARE_ATTRIBUTES = ‘X’
Атрибуты сообщения (класс проблем PROBCLASS, уровень детализации DETLEVEL, критерий сортировки ALSORT) должны совпадать
I_COMPARE_CONTEXT = ‘X’
Контекст должен совпадать
I_COMPARE_PARAMETERS = ‘X’
Параметры сообщения должны совпадать
Дополнительные возможности добавления сообщений
BAL_LOG_MSG_ADD_FREE_TEXT — добавляет текст в журнал
CALL FUNCTION ‘BAL_LOG_MSG_ADD_FREE_TEXT’ EXPORTING i_msgty = ‘E’ i_text = ‘Текст сообщения’. |
BAL_LOG_EXCEPTION_ADD — добавляет исключение в журнал
DATA ls_exc TYPE bal_s_exc. DATA lr_root TYPE REF TO cx_root. ls_exc—msgty = ‘E’. ls_exc—exception = lr_root. CALL FUNCTION ‘BAL_LOG_EXCEPTION_ADD’ EXPORTING i_log_handle = lv_log_handle i_s_exc = ls_exc. |
Пример стандартной демо-программы SBAL_DEMO_07.
Сохранение журнала приложений
Если журнал нужно сохранять в БД, то при создании лога через BAL_LOG_CREATE в структуру заголовка необходимо передать объект и подобъект (не обязательно).
Создаются объекты и подобъекты в тр. SLG0.
Просматривать журнал можно будет в тр. SLG1.
Чтобы сообщения сохранились нужно вызвать BAL_DB_SAVE, после чего сделать COMMIT WORK.
Просмотр журнала сообщений
За отображения журнала приложений отвечает BAL_DSP_LOG_DISPLAY. На вход нужно передать заполненную структуру BAL_S_PROF. В большинстве случаев, требуется изменить какие-то значения структуры. Чтобы не заполнять профиль целиком, можно считать стандартный профиль и изменить в нем нужные поля. Пример добавляет контекстное поле в ALV.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
FORM log_display. DATA ls_display_profile TYPE bal_s_prof. DATA ls_fcat TYPE bal_s_fcat. CALL FUNCTION ‘BAL_DSP_PROFILE_SINGLE_LOG_GET’ IMPORTING e_s_display_profile = ls_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. ls_fcat—ref_table = ‘BAL_S_EX01’. ls_fcat—ref_field = ‘ID’. ls_fcat—col_pos = 100. APPEND ls_fcat TO ls_display_profile—mess_fcat. ls_display_profile—disvariant—report = sy—repid. ls_display_profile—disvariant—handle = ‘LOG’. CALL FUNCTION ‘BAL_DSP_LOG_DISPLAY’ EXPORTING i_s_display_profile = ls_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. ENDFORM. |
Отображение журнала в модальном окне
Функциональный модуль BAL_DSP_PROFILE_POPUP_GET возвращает настройки профиля для вывода в модальном окне.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
*&———————————————————————* *& Report ZBAL_LOG_EXAMPLE3 *& BAL Log: Журнал приложений SAP *&———————————————————————* *& Пример детализации в журнале приложений SAP *& http://abap4.ru/?p=283 *&———————————————————————* REPORT zbal_log_example3. START-OF-SELECTION. PERFORM main. FORM main. DATA ls_log TYPE bal_s_log. DATA ls_msg TYPE bal_s_msg. DATA lv_hnd TYPE balloghndl. DATA lt_hnd TYPE bal_t_logh. DATA ls_prof TYPE bal_s_prof. DATA lv_dummy TYPE string. CALL FUNCTION ‘BAL_LOG_CREATE’ EXPORTING i_s_log = ls_log IMPORTING e_log_handle = lv_hnd. MESSAGE w191(bl) INTO lv_dummy. ls_msg—msgty = sy—msgty. ls_msg—msgid = sy—msgid. ls_msg—msgno = sy—msgno. ls_msg—msgv1 = sy—msgv1. ls_msg—msgv2 = sy—msgv2. ls_msg—msgv3 = sy—msgv3. ls_msg—msgv4 = sy—msgv4. CALL FUNCTION ‘BAL_LOG_MSG_ADD’ EXPORTING i_s_msg = ls_msg i_log_handle = lv_hnd. CALL FUNCTION ‘BAL_DSP_PROFILE_POPUP_GET’ IMPORTING e_s_display_profile = ls_prof. ls_prof—use_grid = abap_true. APPEND lv_hnd TO lt_hnd. CALL FUNCTION ‘BAL_DSP_LOG_DISPLAY’ EXPORTING i_t_log_handle = lt_hnd i_s_display_profile = ls_prof. ENDFORM. |
Результат будет таким
Информация
Подробную документацию API журнала приложений можно взять тут.
Демо программы:
SBAL_DEMO_01 — простейший вызов журнала приложений
SBAL_DEMO_02 — различные виды сбора сообщений, детализация, контекст
SBAL_DEMO_03 — поиск сообщений в памяти
SBAL_DEMO_04 — разные форматы журнала приложений
SBAL_DEMO_05 — сохранение и загрузка журналов
SBAL_DEMO_06 — добавление комплексных данных к журналу
SBAL_DEMO_07 — добавление исключений
SBAL_DEMO_08 — поиск исключений в памяти
/IWFND/ERROR_LOG (Gateway Error Log) is a standard SAP transaction code available within R/3 SAP systems depending on your version and release level.
Below for your convenience is a few details about this tcode including any standard documentation available. In-order to use this transaction within your SAP system simply enter it into the command input box located in the top left hand corner and press enter.
Here are a few additional command options available to use when doing this.
Program Name: /IWFND/SUTIL_LOG
Screen Number: 0100
Transaction /IWFND/ERROR_LOG does not work
If the t-code does not work try adding /N at the front of it. For some reason this can help with transactions that start with a /. Also check you have the correct authorisations.
i.e. /N/IWFND/ERROR_LOG
/IWFND/ERROR_LOG Authorisation objects
To check if you have the required level of authorisation to run this and any transaction use SU53. Simply execute /IWFND/ERROR_LOG and then execute /NSU53 immediately afterwards. A report of all authorisations checked will then be displayed…See check tcode authorisation for full details and screenshots.
Object | Field | Value |
S_APPL_LOG | ACTVT | 03 |
S_APPL_LOG | ALG_OBJECT | |
S_APPL_LOG | ALG_SUBOBJ |
SAP GUI Support for tcode /IWFND/ERROR_LOG
When a tcode is created you can select which SAP GUI it has support for from HTML, Java and the main Windows GUI you are probably most familiar with.
SAPGUI for HTML
/IWFND/ERROR_LOG includes support for the HTML web based GUI. The SAP GUI for HTML generates HTML pages for each screen of the SAP transaction so that it can be executed within a standard web browser. Please note there are technical restrictions and possible incompatibility issues with certain browsers which means some transaction functionality may not function correctly.
SAPGUI for Java
/IWFND/ERROR_LOG includes support for the Java based GUI. The SAP GUI for Java support provides more controls than the SAP GUI for HTML, but requires a plug-in to be downloaded and installed on the users PC so is less popular than the SAP GUI for HTML.
SAPGUI for windows
/IWFND/ERROR_LOG includes support for the Windows based GUI. Windows(WinGUI) support is the most popular option and transactions can be run under SAP GUI for Windows.
SAP Program associated with transaction /IWFND/ERROR_LOG
For further details and documentation see program /IWFND/SUTIL_LOG
/IWFND/ERROR_LOG SPRO IMG Menu Path
Related Tcodes
Search/List all SAP tcodes
SAP transaction related information
SAP NetWeaver Gateway Tcodes regroups the most important SAP Gateway Tcodes classified by topics and by system.
The SAP GW Hub and SAP Gateway Back-End have different Transactions.
Mainly on the SAP gateway Hub, the SAP GW Tcodes will start with /IWFND/* (FND stands for Foundation).
In the Back End System, the SAP NetWeaver Gateway Tcodes will rather start with /IWBEP/*
In the deployment strategy of SAP Gateway is embedded, does mean, the SAP GW HUB (/IWFND) and the SAP GW BEP (/IWBEP) are on the same SAP System, the Tcodes will be available in the system.
More information SAP Gateway Overview
SAP Gateway Hub Tcodes /IWFND/*
SAP NetWeaver Gateway Tcodes Main Hub
The Main Tcodes in SAP GW Hub are
/IWFND/MAINT_SERVICE | Activate and Maintain Services |
---|---|
/IWFND/CACHE_CLEANUP | Cleanup of Model Cache |
/IWFND/CLEANUP | Execute Cleanup |
/IWFND/ERROR_LOG | Gateway Error Log |
/IWFND/EXPLORER | Service Explorer |
/IWFND/GW_CLIENT | Gateway Client |
/IWFND/VIEW_LOG | Gateway Application Log Viewer |
SAP NetWeaver Gateway Tcodes Hub for Logging and traces
The following list of Tcodes regroups the most useful Gateway Tcodes for Logging and Traces.
In case of error, check all these SAP GW Transactions
/IWFND/TRACES | SAP Gateway Traces |
---|---|
/IWFND/APPS_LOG | SAP Gateway Application Log Viewer |
/IWFND/ERROR_LOG | SAP Gateway Error Log |
/IWFND/ERROR_LOG_E2E | SAP Gateway Error Log – E2E |
/IWFND/VIEW_LOG | Gateway Application Log Viewer |
SAP Gateway Hub Tcodes Others
Miscellaneous Tcodes for Gateway Hub will allow activating and desactiving Gateway, Metadata, handle Notification and configuration of service.
/IWFND/BULK_USER_MAP | Transaction to Perform Bulk User Map |
---|---|
/IWFND/EXPLORER | Service Explorer |
/IWFND/GWO_GEN | Data Model Generator |
/IWFND/IWF_ACTIVATE | Activate / Deactivate Gateway |
/IWFND/MED_ACTIVATE | Activate/Deactivate Metadata Cache |
/IWFND/MOC_PARALLEL | Parallelize Multi-Origin Composition |
/IWFND/NOTIF_CLEANUP | Cleanup Notifications |
/IWFND/NOTIF_MONITOR | Notification Monitor |
/IWFND/REG_SERVICE | Activate Services |
/IWFND/RL_SYNC_PROCS | Role Sync Schedule Process |
/IWFND/SRV_VALIDATE | OData Channel : Service Validator |
/IWFND/VIRUS_SCAN | Configuration of Gateway Virus Scan |
SAP Netweaver Gateway Tcodes for BackEnd /IWBEP/
In the SAP GW Back-End,
SEGW Gateway Service Builder
SAP Gateway Tcodes for Cache
As for Hub, The following SAP Gateway Tcodes will help you display and analyze errors and Traces in SAP GW BEP.
/IWBEP/CACHE_CLEANUP | Cleanup of Model Cache |
---|---|
/IWBEP/ERROR_LOG GW | Backend Error Log |
/IWBEP/ERROR_LOG_E2E | GW Backend Error Log – E2E |
/IWBEP/TRACES | GW Backend Traces |
/IWBEP/VIEW_LOG | SAP NetWeaver Gateway Log Viewer |
SAP Gateway Tcodes for Administration
When dealing with SAP Gateway Administration, check the following Transactions tcodes to handle the basics part of the Gateway such user, RFC connection, authorizations …
Keep the following list of SAP GW Basis Tcodes in your favorites:
SAP GW Basic Tcodes | Description |
---|---|
SU01 | User Maintenance |
PFCG | Profile Generator |
SICF | Maintain Services |
SM59 | RFC Destinations (Display/Maintain) |
All SAP NetWeaver Gateway Useful Transaction Codes:
SAP Gateway Tcode | Description |
---|---|
/IWBEP/ANA_SRV_GEN | Analytics Service Generator |
/IWBEP/CACHE_CLEANUP | Cleanup of Model Cache |
/IWBEP/CONFIG_CHECK | Check Configuration of BEP |
/IWBEP/ERROR_LOG | GW Backend Error Log |
/IWBEP/ERROR_LOG_E2E | GW Backend Error Log – E2E |
/IWBEP/IMPORT_MODEL | Service Description File Importer |
/IWBEP/NOTIF_MONITOR | GW Backend Notification Monitor |
/IWBEP/OCI_SRV_GEN | OData Srvc.(GW) Generator for OSCI |
/IWBEP/REG_MODEL | Maintain Model |
/IWBEP/REG_SERVICE | Maintain Service |
/IWBEP/REG_VOCAN | Maintain Vocabulary Annotations |
/IWBEP/RFC_BOP_DEL | OData Channel : Delete RFC BOP |
/IWBEP/RFC_BOP_GEN | OData Channel : Generate RFC BOP |
/IWBEP/SB | Gateway Service Builder |
/IWBEP/SBS | Gateway Service Builder Setup |
/IWBEP/TRACES | GW Backend Traces |
/IWBEP/UM_NR_INT | MGW Number Range Interval |
/IWBEP/UR_CLEANUP | User Request Clean Up |
/IWBEP/VIEW_LOG | SAP NetWeaver Gateway Log Viewer |
/IWBEP/WS_BOP_DEL | OData Channel : Delete WS BOP |
/IWBEP/WS_BOP_GEN | OData Channel : Generate WS BOP |
/IWCNT/CHECK_TOOL | Check Tool |
/IWCNT/CODELIST | Code List Cache |
/IWCNT/RP_MANAGE | Manage Reports and their Properties |
/IWCNT/RP_SCH_MAIN | Maintain Sys Timepts/Data Chg. Evnts |
/IWCNT/WF_FILTER | Workflow task filter activation |
/IWCNT/WF_WEBGUI | Web Gui For Executing Workflow Item |
/IWFND/APPS_LOG | Gateway Application Log Viewer |
/IWFND/BEP_RFC_BOP_D | RFC BOP deletion for BEP model |
/IWFND/BEP_RFC_BOP_G | RFC BOP generation for BEP model |
/IWFND/BEP_WS_BOP_D | WS BOP deletion for BEP model |
/IWFND/BEP_WS_BOP_G | WS BOP generation for BEP model |
/IWFND/BGRFC_CHECK | Check bgRFC Configurations |
/IWFND/BOP_RFC | Generator for RFC BOPs |
/IWFND/BOP_RFC_C | Generator for Custom RFC BOPs |
/IWFND/BOP_RFC_C_D | Deletion of Custom RFC BOPs |
/IWFND/BOP_RFC_D | Deletion of RFC BOPs |
/IWFND/BOP_WS | Generator for WS BOPs |
/IWFND/BOP_WS_D | Deletion of WS BOPs |
/IWFND/BULK_USER_MAP | Transaction to Perform Bulk User Map |
/IWFND/CACHE_CLEANUP | Cleanup of Model Cache |
/IWFND/CHECK_ALIASES | Check SAP System Aliases |
/IWFND/CHECK_GSDOS | Check GSDO Groups |
/IWFND/CLEANUP | Execute Cleanup |
/IWFND/CLEANUP_JOBS | Manage cleanup jobs |
/IWFND/ERROR_LOG | Gateway Error Log |
/IWFND/ERROR_LOG_E2E | Gateway Error Log – E2E |
/IWFND/EXPLORER | Service Explorer |
/IWFND/FLAT_SERVICE | Flat service generator |
/IWFND/GW_CLIENT | Gateway Client |
/IWFND/GWO_GEN | Data Model Generator |
/IWFND/IWF_ACTIVATE | Activate / Deactivate Gateway |
/IWFND/MAINT_SERVICE | Activate and Maintain Services |
/IWFND/MED_ACTIVATE | Activate/Deactivate Metadata Cache |
/IWFND/MGW_BOP_RFC | OData Channel : Generate for RFC BOP |
/IWFND/MGW_BOP_RFC_C | Generator for Custom RFC BOPs |
/IWFND/MGW_BOP_RFC_D | OData Channel : Deletion of RFC BOPs |
/IWFND/MGW_BOP_WS | OData Channel : Generate for WS BOPs |
/IWFND/MGW_BOP_WS_D | OData Channel : Deletion of WS BOPs |
/IWFND/MOC_PARALLEL | Parallelize Multi-Origin Composition |
/IWFND/NOTIF_CLEANUP | Cleanup Notifications |
/IWFND/NOTIF_MONITOR | Notification Monitor |
/IWFND/REG_SERVICE | Activate Services |
/IWFND/RL_SYNC_PROCS | Role Sync Schedule Process |
/IWFND/SERVICE_TEST | Service Explorer |
/IWFND/SRV_VALIDATE | OData Channel : Service Validator |
/IWFND/TRACES | Gateway Traces |
/IWFND/VIEW_LOG | Gateway Application Log Viewer |
/IWFND/VIRUS_SCAN | Configuration of Gateway Virus Scan |
/IWFND/WF_WEBGUI | WebGUI For Executing Workflow Item |
/IWFND/WSS_SETUP | Configure WS Message-Based |
Source for the list of the previous table is here.
Source: SAP NetWeaver Gateway T-Code Summary