Skip to content

Commit fd4eef3

Browse files
authored
Update logging.md
1 parent 840ef80 commit fd4eef3

File tree

1 file changed

+70
-19
lines changed

1 file changed

+70
-19
lines changed

docs/addons/logging.md

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,92 @@
11
# Logging
22

3-
## Use Cases
3+
<i class="fa-brands fa-github"></i> [GitHub](https://github.com/abap2UI5-addons/logging)
44

5-
### 1. UI for abap-logger
5+
ABAP development is nearly impossible without eventually encountering BAL logging. Whether you like using the standard API or prefer working with open-source projects like abap-logger, in the end, we need a way to display these messages in an abap2UI5 app or a popup. This add-on collects all functionality related to BAL logging. Instead of building various new BAL popups, we can gather the functionality here and develop it collaboratively. Currently, only basic functionality is available, but PRs are welcome!
66

7-
UI for the Open Source Project [**abap-logger**](https://github.com/ABAP-Logger/ABAP-Logger)
7+
### 1. UI for Business Application Log (classic)
88

99
```abap
10-
CLASS z2ui5add_cl_abap_logger_sample DEFINITION PUBLIC FINAL
11-
CREATE PUBLIC .
10+
METHOD z2ui5_if_app~main.
1211
13-
PUBLIC SECTION.
14-
INTERFACES z2ui5_if_app.
12+
DATA(lo_log) = cl_bali_log=>create( ).
1513
16-
ENDCLASS.
14+
DATA(lo_msg) = cl_bali_message_setter=>create(
15+
severity = if_bali_constants=>c_severity_status
16+
id = 'DEMO_LOG'
17+
number = '002'
18+
variable_1 = CONV #( cl_abap_context_info=>get_user_business_partner_id( ) ) ).
19+
lo_log->add_item( lo_msg ).
1720
18-
CLASS z2ui5add_cl_abap_logger_sample IMPLEMENTATION.
21+
" BAPIRET2
22+
DATA(lo_bapi) = cl_bali_message_setter=>create_from_bapiret2( VALUE #( type = 'E'
23+
id = 'DEMO_LOG'
24+
number = '002'
25+
message_v1 = 'Dummy' ) ).
26+
lo_log->add_item( lo_bapi ).
27+
28+
client->nav_app_call( z2ui5add_cl_bal_cl=>factory_popup( lo_log ) ).
1929
30+
ENDMETHOD.
31+
```
32+
33+
### 2. UI for Business Application Log (cloud)
34+
35+
```abap
2036
METHOD z2ui5_if_app~main.
2137
22-
DATA: log TYPE REF TO zif_logger.
23-
log = zcl_logger_factory=>create_log( object = 'ZINTERFACES'
24-
subobject = 'ACCOUNTING'
25-
desc = 'Stuff imported from legacy systems' ).
38+
DATA(lo_log) = cl_bali_log=>create( ).
2639
27-
log->e( 'You see, what had happened was...' ).
40+
DATA(lo_msg) = cl_bali_message_setter=>create(
41+
severity = if_bali_constants=>c_severity_status
42+
id = 'DEMO_LOG'
43+
number = '002'
44+
variable_1 = CONV #( cl_abap_context_info=>get_user_business_partner_id( ) ) ).
45+
lo_log->add_item( lo_msg ).
2846
29-
client->nav_app_call( z2ui5add_cl_abap_logger_ui=>display_popup( log ) ).
47+
" BAPIRET2
48+
DATA(lo_bapi) = cl_bali_message_setter=>create_from_bapiret2( VALUE #( type = 'E'
49+
id = 'DEMO_LOG'
50+
number = '002'
51+
message_v1 = 'Dummy' ) ).
52+
lo_log->add_item( lo_bapi ).
53+
54+
client->nav_app_call( z2ui5add_cl_bal_cl=>factory_popup( lo_log ) ).
3055
3156
ENDMETHOD.
57+
```
3258

33-
ENDCLASS.
59+
### 3. BAL Cockpit
60+
In ABAP for Cloud
61+
62+
```abap
63+
METHOD z2ui5_if_app~main.
64+
65+
DATA(lo_log) = cl_bali_log=>create( ).
66+
67+
DATA(lo_msg) = cl_bali_message_setter=>create(
68+
severity = if_bali_constants=>c_severity_status
69+
id = 'DEMO_LOG'
70+
number = '002'
71+
variable_1 = CONV #( cl_abap_context_info=>get_user_business_partner_id( ) ) ).
72+
lo_log->add_item( lo_msg ).
73+
74+
" BAPIRET2
75+
DATA(lo_bapi) = cl_bali_message_setter=>create_from_bapiret2( VALUE #( type = 'E'
76+
id = 'DEMO_LOG'
77+
number = '002'
78+
message_v1 = 'Dummy' ) ).
79+
lo_log->add_item( lo_bapi ).
80+
81+
client->nav_app_call( z2ui5add_cl_bal_cl=>factory_popup( lo_log ) ).
82+
83+
ENDMETHOD.
3484
```
3585

36-
### 2. POPUP for BAL Messages
86+
87+
### 4. UI for abap-logger
88+
89+
UI for the Open Source Project [**abap-logger**](https://github.com/ABAP-Logger/ABAP-Logger)
3790

3891
```abap
3992
CLASS z2ui5add_cl_abap_logger_sample DEFINITION PUBLIC FINAL
@@ -62,5 +115,3 @@ CLASS z2ui5add_cl_abap_logger_sample IMPLEMENTATION.
62115
ENDCLASS.
63116
```
64117

65-
<br>
66-
<img width="800" alt="SAPGUI 2024-09-05 08 00 51" src="https://github.com/user-attachments/assets/02c6a23a-e4cc-4439-afa0-7842897c8468">

0 commit comments

Comments
 (0)