Skip to content

Commit c306742

Browse files
authored
update
1 parent 8b76a53 commit c306742

File tree

1 file changed

+44
-51
lines changed

1 file changed

+44
-51
lines changed

docs/development/logging.md

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ outline: [2, 6]
33
---
44
# Logging, BAL
55

6-
Logging is essential for developing end-user business processes. In ABAP systems, the standard tool for this is the Business Application Log, which is supported in both on-premise systems and ABAP Cloud (via new APIs). With abap2UI5 you can use the BAL functions as you would do it in classic development. to display logs just create a table with the entries or use predefinded popups of the framework.
6+
Logging is essential for developing end-user business processes. In ABAP systems, the standard tool for this purpose is the Business Application Log (BAL), supported in both on-premise systems and ABAP Cloud (via new APIs). With abap2UI5, you can use BAL functions just as you would in classic development and create a table with the entries or use predefined popups provided by the framework.
77

8-
###### BAL structure
9-
In on-premise ABAP systems, you can use the classic BAL APIs. As no specific logging object exists, simply import the BAL table into `z2ui5add_cl_bal_cl`:
10-
```abp
8+
##### BAL Variables
9+
In ABAP classic, you can use the classic BAL function modules and display the BAL table with the popup `z2ui5_cl_pop_messages`:
10+
```abap
1111
METHOD z2ui5_if_app~main.
1212
1313
DATA(lt_bal) = VALUE bal_t_msgr(
@@ -18,73 +18,66 @@ METHOD z2ui5_if_app~main.
1818
1919
```
2020

21-
###### ABAP Cloud Log
22-
Similar to messages you can display bal log directly in the message_popup. Just drop the into it:
21+
##### ABAP Cloud
22+
In ABAP cloud, you can just import the logging object into the message popup:
2323
```abap
2424
METHOD z2ui5_if_app~main.
2525
26-
DATA(lo_log) = cl_bali_log=>create( ).
27-
DATA(lo_msg) = cl_bali_message_setter=>create(
28-
severity = if_bali_constants=>c_severity_status
29-
id = 'DEMO_LOG'
30-
number = '002'
31-
variable_1 = `username` ).
32-
lo_log->add_item( lo_msg ).
26+
DATA(lo_log) = cl_bali_log=>create( ).
27+
DATA(lo_msg) = cl_bali_message_setter=>create(
28+
severity = if_bali_constants=>c_severity_status
29+
id = 'DEMO_LOG'
30+
number = '002'
31+
variable_1 = `username` ).
32+
lo_log->add_item( lo_msg ).
3333
34-
DATA(lo_bapi) = cl_bali_message_setter=>create_from_bapiret2(
35-
VALUE #( type = 'E'
36-
id = 'DEMO_LOG'
37-
number = '002'
38-
message_v1 = 'Dummy' ) ).
34+
DATA(lo_bapi) = cl_bali_message_setter=>create_from_bapiret2(
35+
VALUE #(
36+
type = 'E'
37+
id = 'DEMO_LOG'
38+
number = '002'
39+
message_v1 = 'Dummy' ) ).
40+
lo_log->add_item( lo_bapi ).
3941
40-
lo_log->add_item( lo_bapi ).
41-
client->nav_app_call( z2ui5add_cl_bal_cl=>factory_popup( lo_log ) ).
42+
client->nav_app_call( z2ui5_cl_pop_messages=>factory( lo_log ) ).
4243
4344
ENDMETHOD.
4445
```
4546

46-
47-
###### abap-logger
48-
49-
you can also use the abap logger in the it is built in an running
50-
In on-premise systems, you also have the option to install the open-source project [**abap-logger**](https://github.com/ABAP-Logger/ABAP-Logger), which simplifies logging with BAL. Here’s an example of how to use it with abap2UI5:
47+
##### abap-logger
48+
In on-premise systems, you also have the option to use the fantastic open-source project [**abap-logger**](https://github.com/ABAP-Logger/ABAP-Logger). This tool simplifies working with BAL logs and integrates seamlessly with abap2UI5. Here’s an example:
5149
```abap
52-
CLASS z2ui5add_cl_abap_logger_sample DEFINITION PUBLIC FINAL
53-
CREATE PUBLIC .
54-
55-
PUBLIC SECTION.
56-
INTERFACES z2ui5_if_app.
57-
58-
ENDCLASS.
59-
60-
CLASS z2ui5add_cl_abap_logger_sample IMPLEMENTATION.
61-
62-
METHOD z2ui5_if_app~main.
63-
64-
DATA: log TYPE REF TO zif_logger.
65-
log = zcl_logger_factory=>create_log( object = 'ZINTERFACES'
66-
subobject = 'ACCOUNTING'
67-
desc = 'Stuff imported from legacy systems' ).
50+
METHOD z2ui5_if_app~main.
6851
69-
log->e( 'You see, what had happened was...' ).
70-
client->nav_app_call( z2ui5add_cl_abap_logger_ui=>display_popup( log ) ).
52+
DATA(lo_log) = zcl_logger_factory=>create_log(
53+
object = 'ZINTERFACES'
54+
subobject = 'ACCOUNTING'
55+
desc = 'my abap-logger logger' ).
56+
log->e( 'There is an error...' ).
7157
72-
ENDMETHOD.
58+
client->nav_app_call( z2ui5_cl_pop_messages=>factory( lo_log ) ).
7359
74-
ENDCLASS.
60+
ENDMETHOD.
7561
```
7662

63+
##### BAL Popup
64+
Compared to T100 messages, BAL logs include more detailed information, such as timestamps. You can also use the BAL log popup to display this information. All the examples above can be used as is, but for the popup app, you should use the `z2ui5_cl_pop_bal` popup instead:
7765

78-
#### BAL Popup
79-
Comparet to T100 the BAL log contains a lot more specific information. You can also use the ballog popup to get more detailed information.
80-
81-
82-
In ABAP Cloud environments, the BAL includes a new API. Use this API to import logging objects directly into the class `z2ui5add_cl_bal_cl` to display messages:
66+
```abap
67+
METHOD z2ui5_if_app~main.
8368
69+
DATA(lo_log) = zcl_logger_factory=>create_log(
70+
object = 'ZINTERFACES'
71+
subobject = 'ACCOUNTING'
72+
desc = 'my abap-logger logger' ).
73+
log->e( 'There is an error...' ).
8474
75+
client->nav_app_call( z2ui5_cl_pop_bal=>factory( lo_log ) ).
8576
77+
ENDMETHOD.
78+
```
8679

8780
::: tip
88-
This popup is in its early stages, with basic functionality currently available. If you’ve implemented BAL functionality with abap2UI5, consider sharing your work! Contributions and pull requests are welcome.
81+
This popup is still in its early stages, offering basic functionality. If you’ve implemented BAL features with abap2UI5, consider sharing your work! Contributions and pull requests are always welcome.
8982
:::
9083

0 commit comments

Comments
 (0)