terça-feira, 25 de janeiro de 2022

Exemplos cl_salv_table

Copiado do site

https://codezentrale.de/tag/set_selection_mode/ 


[ABAP] Zwei SALV-Grids in einem Splittercontainer anzeigen

01
02
03
04
05
06
07
08
09
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
* Daten für SALV-Grid oben
SELECT *
  INTO TABLE @DATA(it_scarr)
  FROM scarr.
 
* Daten für SALV-Grid unten
SELECT *
  INTO TABLE @DATA(it_sflight)
  FROM sflight.
 
* Referenzen auf GUI-Objekte
* Splitter
DATA: o_splitter_main TYPE REF TO cl_gui_splitter_container.
* Splitter-Container oben
DATA: o_container_o   TYPE REF TO cl_gui_container.
* Splitter-Container unten
DATA: o_container_u   TYPE REF TO cl_gui_container.
 
* Splitter auf default_screen erzeugen
o_splitter_main = NEW #( parent                  = cl_gui_container=>default_screen
                         no_autodef_progid_dynnr = abap_true       " wichtig
                         rows                    = 2
                         columns                 = 1 ).
 
* Höhe oberer Splitter in %
o_splitter_main->set_row_height( id = 1 height = 40 ).
 
* REF auf oberen und unteren Splitcontainer holen
o_container_o = o_splitter_main->get_container( row = 1 column = 1 ).
o_container_u = o_splitter_main->get_container( row = 2 column = 1 ).
 
* SALV-Table oben mit Fluggesellschaften
DATA: o_salv_o TYPE REF TO cl_salv_table.
 
cl_salv_table=>factory( EXPORTING
                          r_container  = o_container_o
                        IMPORTING
                          r_salv_table = o_salv_o
                        CHANGING
                          t_table      = it_scarr ).
 
* Grundeinstellungen
o_salv_o->get_functions( )->set_all( abap_true ).
o_salv_o->get_columns( )->set_optimize( abap_true ).
o_salv_o->get_display_settings( )->set_list_header( 'Fluggesellschaften' ).
o_salv_o->get_display_settings( )->set_striped_pattern( abap_true ).
o_salv_o->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).
 
* Spaltenüberschriften: technischer Name und Beschreibungstexte
LOOP AT o_salv_o->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<so>).
  DATA(o_col_o) = <so>-r_column.
  o_col_o->set_short_text( || ).
  o_col_o->set_medium_text( || ).
  o_col_o->set_long_text( |{ o_col_o->get_columnname( ) }| ).
ENDLOOP.
 
* SALV-Grid anzeigen
o_salv_o->display( ).
 
* SALV-Table unten mit Flügen
DATA: o_salv_u TYPE REF TO cl_salv_table.
 
cl_salv_table=>factory( EXPORTING
                          r_container  = o_container_u
                        IMPORTING
                          r_salv_table = o_salv_u
                        CHANGING
                          t_table      = it_sflight ).
 
* Grundeinstellungen
o_salv_u->get_functions( )->set_all( abap_true ).
o_salv_u->get_columns( )->set_optimize( abap_true ).
o_salv_u->get_display_settings( )->set_list_header( 'Flüge' ).
o_salv_u->get_display_settings( )->set_striped_pattern( abap_true ).
o_salv_u->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).
 
* Spaltenüberschriften: technischer Name und Beschreibungstexte
LOOP AT o_salv_u->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<su>).
  DATA(o_col_u) = <su>-r_column.
  o_col_u->set_short_text( || ).
  o_col_u->set_medium_text( || ).
  o_col_u->set_long_text( |{ o_col_u->get_columnname( ) }| ).
ENDLOOP.
 
* SALV-Grid anzeigen
o_salv_u->display( ).
 
* leere Toolbar ausblenden
cl_abap_list_layout=>suppress_toolbar( ).
 
* Erzwingen von cl_gui_container=>default_screen
WRITE: space.

[ABAP] GUI-Simple-Tree und SALV-Grid in Split-Container ohne Dynpro anzeigen, Eventhandling

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.
TYPES: ty_it_nodes TYPE STANDARD TABLE OF mtreesnode WITH DEFAULT KEY.
 
DATA: o_salv TYPE REF TO cl_salv_table.
DATA: it_tree_spfli TYPE STANDARD TABLE OF spfli.
DATA: it_salv_spfli TYPE STANDARD TABLE OF spfli.
DATA: it_nodes TYPE ty_it_nodes.
 
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
* GUI Simple Tree
    CLASS-METHODS: on_keypress FOR EVENT node_keypress OF cl_gui_simple_tree
      IMPORTING
          node_key
          key
          sender.
    CLASS-METHODS: on_selection_changed FOR EVENT selection_changed OF cl_gui_simple_tree
      IMPORTING
          node_key
          sender.
    CLASS-METHODS: on_expand_no_children FOR EVENT expand_no_children OF cl_gui_simple_tree
      IMPORTING
          node_key
          sender.
* ALV-Events für das SALV-Grid
    CLASS-METHODS: on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
      IMPORTING
          e_object
          sender.
    CLASS-METHODS: on_user_command FOR EVENT user_command OF cl_gui_alv_grid
      IMPORTING
          e_ucomm
          sender.
ENDCLASS.
 
CLASS lcl_events IMPLEMENTATION.
* Tastendruck
  METHOD on_keypress.
    MESSAGE |Node: { node_key } Taste: { key }| TYPE 'S'.
  ENDMETHOD.
* Klick auf ein aktives Baumelement
  METHOD on_selection_changed.
* Element in der Nodes-Tabelle lesen
    ASSIGN it_nodes[ node_key = node_key ] TO FIELD-SYMBOL(<fs_node>).
 
* iTab für SALV-Table neu aufbauen
    CLEAR: it_salv_spfli.
 
    LOOP AT it_tree_spfli ASSIGNING FIELD-SYMBOL(<fs_line>) WHERE carrid = <fs_node>-text.
      APPEND <fs_line> TO it_salv_spfli.
    ENDLOOP.
 
* SALV-Table neu anzeigen
    o_salv->refresh( ).
  ENDMETHOD.
* bei Expandierung eines Baumelements ohne Unterelemente
  METHOD on_expand_no_children.
    MESSAGE |Node: { node_key }| TYPE 'S'.
  ENDMETHOD.
 
* Toolbar-Buttons hinzufügen:
* butn_type   Bezeichung
* 0           Button (normal)
* 1           Menü + Defaultbutton
* 2           Menü
* 3           Separator
* 4           Radiobutton
* 5           Auswahlknopf (Checkbox)
* 6           Menüeintrag
  METHOD on_toolbar.
* Separator hinzufügen
    APPEND VALUE #( butn_type = 3 ) TO e_object->mt_toolbar.
* Edit-Button hinzufügen
    APPEND VALUE #( butn_type = 5 text = 'Daten anzeigen' icon = icon_icon_list function = 'SHOW_DATA' quickinfo = 'Daten anzeigen' disabled = ' ' ) TO e_object->mt_toolbar.
  ENDMETHOD.
* Benutzerkommando (Button-Klick)
  METHOD on_user_command.
    CASE e_ucomm.
      WHEN 'SHOW_DATA'.
        DATA: lv_row TYPE i. " Zeile auf Grid
        DATA: lv_value TYPE char255. " Wert
        DATA: lv_col TYPE i. " Spalte auf Grid
        DATA: lv_row_id TYPE lvc_s_row. " Zeilen-Id
        DATA: lv_col_id TYPE lvc_s_col. " Spalten-Id
        DATA: lv_row_no TYPE lvc_s_roid. " Numerische Zeilen ID
 
        sender->get_current_cell( IMPORTING
                                    e_row = lv_row
                                    e_value = lv_value
                                    e_col = lv_col
                                    es_row_id = lv_row_id
                                    es_col_id = lv_col_id
                                    es_row_no = lv_row_no ).
 
        MESSAGE |Zeile: { lv_row }, Spalte: { lv_col }, Wert: { lv_value }, Spaltenname: { lv_col_id-fieldname }| TYPE 'S'.
    ENDCASE.
  ENDMETHOD.
 
ENDCLASS.
 
START-OF-SELECTION.
 
  SELECT * INTO TABLE it_tree_spfli FROM spfli.
 
* Splitter auf screen0 erzeugen
  DATA(o_split) = NEW cl_gui_splitter_container( parent = cl_gui_container=>screen0
                                                 no_autodef_progid_dynnr = abap_true
                                                 rows = 1
                                                 columns = 2 ).
 
* Breite in % (linke Spalte für den Tree)
  o_split->set_column_width( id = 1 width = 15 ).
 
* linken und rechten Splitcontainer holen
  DATA(o_spl_left) = o_split->get_container( row = 1 column = 1 ).
  DATA(o_spl_right) = o_split->get_container( row = 1 column = 2 ).
 
  TRY.
* Tree-Objekt erzeugen
      DATA(o_tree) = NEW cl_gui_simple_tree( parent = o_spl_left
                                             node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single ).
 
 
* Eventtypten müssen gesondert registriert werden
      DATA(it_events) = VALUE ty_it_events( ( eventid = cl_gui_simple_tree=>eventid_node_keypress
                                              appl_event = abap_true )
                                            ( eventid = cl_gui_simple_tree=>eventid_selection_changed
                                              appl_event = abap_true )
                                            ( eventid = cl_gui_simple_tree=>eventid_expand_no_children
                                              appl_event = abap_true ) ).
 
      o_tree->set_registered_events( events = it_events ).
 
      o_tree->add_key_stroke( cl_gui_simple_tree=>key_enter ).
 
* Events registrieren
      SET HANDLER lcl_events=>on_keypress FOR o_tree.
      SET HANDLER lcl_events=>on_selection_changed FOR o_tree.
      SET HANDLER lcl_events=>on_expand_no_children FOR o_tree.
 
* Root-Node einfügen
      it_nodes = VALUE #( ( node_key  = 'ROOT'           " Node-Bezeichner
                            relatship = cl_gui_simple_tree=>relat_last_child
                            disabled  = abap_true
                            isfolder  = abap_true        " Typ Ordner für Root-Element
                            n_image   = icon_folder      " Icon Ordner
                            exp_image = icon_open_folder " Icon geöffneter Ordner
                            style     = cl_gui_simple_tree=>style_default
                            text      = 'Airlines' ) ).
 
* Childs an Root-Node anhängen
      LOOP AT it_tree_spfli ASSIGNING FIELD-SYMBOL(<fs_line>).
* bei Änderung der carrid neue carrid als Child anhängen
        AT NEW carrid.
          APPEND VALUE #( node_key  = |NODE{ sy-tabix }| " eindeutiger Node-Bezeichner
                          relatship = cl_gui_simple_tree=>relat_last_child
                          relatkey  = 'ROOT'             " an ROOT-Element anhängen
                          style     = cl_gui_simple_tree=>style_intensified
                          text      = |{ <fs_line>-carrid }| ) TO it_nodes.
        ENDAT.
      ENDLOOP.
 
* Nodes im Baum einfügen
      o_tree->add_nodes( table_structure_name = 'MTREESNODE' " Typ muss gleich mit Zeilentyp von ty_it_nodes sein
                         node_table           = it_nodes ).
 
* Root-Nodes des Trees expandieren
      o_tree->expand_root_nodes( ).
 
* leeres SALV-Grid erzeugen
      cl_salv_table=>factory( EXPORTING
                                r_container    = o_spl_right
                              IMPORTING
                                r_salv_table   = o_salv
                              CHANGING
                                t_table        = it_salv_spfli ).
 
      o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
      o_salv->get_columns( )->set_optimize( abap_true ).
      o_salv->get_functions( )->set_all( ).
      o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).
      o_salv->display( ).
 
* Trick: Aus dem Split-Container rechts das Grid-Objekt holen und nach cl_gui_alv_grid casten
      READ TABLE o_spl_right->children INDEX 1 ASSIGNING FIELD-SYMBOL(<child>).
      IF <child> IS ASSIGNED.
        DATA(o_alv_grid) = CAST cl_gui_alv_grid( <child> ).
 
* Eventhandler registrieren
        SET HANDLER lcl_events=>on_toolbar FOR o_alv_grid.
        SET HANDLER lcl_events=>on_user_command FOR o_alv_grid.
      ENDIF.
 
    CATCH cx_root INTO DATA(e_text).
      WRITE: / e_text->get_text( ).
  ENDTRY.
 
* leere Toolbar ausblenden
  cl_abap_list_layout=>suppress_toolbar( ).
 
* cl_gui_container=>screen0 erzwingen
  WRITE space.

[ABAP] SALV IDA: Funktionsbutton einfügen

01
02
03
04
05
06
07
08
09
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
DATA: o_alv TYPE REF TO if_salv_gui_table_ida.
 
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
* Konstante für Button-Event
    CONSTANTS: co_btn_showdetail type UI_FUNC VALUE 'SHOW_DETAIL'.
 
    CLASS-METHODS: on_toolbar_function_selected FOR EVENT function_selected OF if_salv_gui_toolbar_ida
      IMPORTING
          ev_fcode
          sender.
ENDCLASS.
 
CLASS lcl_events IMPLEMENTATION.
 
  METHOD on_toolbar_function_selected.
    DATA: lv_row TYPE sflight.
 
    CASE ev_fcode.
* wenn Button-Funktion
      WHEN co_btn_showdetail.
 
        IF abap_true = o_alv->selection( )->is_row_selected( ).
* ganzen Datensatz holen
          o_alv->selection( )->get_selected_row( EXPORTING
                                                   iv_request_type = if_salv_gui_selection_ida=>cs_request_type-all_fields
                                                 IMPORTING
                                                   es_row = lv_row ).
* Datensatz anzeigen
          cl_salv_ida_show_data_row=>display( iv_text = 'Flug-Details'
                                              is_data = lv_row ).
        ENDIF.
    ENDCASE.
  ENDMETHOD.
 
ENDCLASS.
 
START-OF-SELECTION.
 
  o_alv = cl_salv_gui_table_ida=>create( iv_table_name = 'SFLIGHT' ).
 
* Single-Selection
  o_alv->selection( )->set_selection_mode( if_salv_gui_selection_ida=>cs_selection_mode-single ).
 
* Toolbar button einfügen
  o_alv->toolbar( )->add_button( EXPORTING
                                   iv_fcode                     = lcl_events=>co_btn_showdetail
                                   iv_icon                      = icon_flight
                                   iv_text                      = 'Details'
                                   iv_quickinfo                 = 'Flug-Details'
                                   iv_before_standard_functions = abap_true ).
* Separator
  o_alv->toolbar( )->add_separator( EXPORTING
                                      iv_before_standard_functions = abap_true ).
 
* Event-handler
  SET HANDLER lcl_events=>on_toolbar_function_selected FOR o_alv->toolbar( ).
 
* Tabelle anzeigen
  o_alv->fullscreen( )->display( ).

[ABAP] SALV IDA: Icons und Buttons einfügen, Klick-Events abfangen

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
CLASS lcl_event_handler DEFINITION.
  PUBLIC SECTION.
    INTERFACES: if_salv_ida_calc_field_handler.
 
    METHODS: on_cell_action FOR EVENT cell_action OF if_salv_gui_field_display_opt
      IMPORTING
          ev_field_name
          eo_row_data
          sender.
 
  PRIVATE SECTION.
    TYPES:
      BEGIN OF ty_calc_field,
        icon   TYPE char4,
        button TYPE lvc_value,
      END OF ty_calc_field.
 
    TYPES: BEGIN OF ty_line.
            INCLUDE TYPE sflight.
            INCLUDE TYPE ty_calc_field.
    TYPES: END OF ty_line.
ENDCLASS.
 
CLASS lcl_event_handler IMPLEMENTATION.
 
  METHOD on_cell_action.
    DATA: lv_row TYPE ty_line.
 
    eo_row_data->get_row_data( EXPORTING
                                 iv_request_type = if_salv_gui_selection_ida=>cs_request_type-all_fields
                               IMPORTING
                                 es_row = lv_row ).
 
    cl_salv_ida_show_data_row=>display( iv_text = |Datenfeld: { ev_field_name }|
                                        is_data = lv_row ).
  ENDMETHOD.
 
  METHOD if_salv_ida_calc_field_handler~get_calc_field_structure.
* Struktur-Deklaration für zus. Felder ICON und BUTTON zurückgeben
    ro_calc_field_structure = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_name( 'TY_CALC_FIELD' ) ).
  ENDMETHOD.
 
  METHOD if_salv_ida_calc_field_handler~get_requested_fields.
  ENDMETHOD.
 
  METHOD if_salv_ida_calc_field_handler~calculate_line.
 
* Daten akt. Zeile holen
    DATA(lv_sflight) = CONV sflight( is_data_base_line ).
 
* Freie Sitze ausrechnen
    DATA(lv_cnt_free_seats) = lv_sflight-seatsmax - lv_sflight-seatsocc.
 
* Calculated Fields bestimmen
    es_calculated_fields = COND ty_calc_field( WHEN lv_cnt_free_seats = 0  THEN VALUE #( icon = icon_red_light    button = icon_delete )
                                               WHEN lv_cnt_free_seats > 10 THEN VALUE #( icon = icon_green_light  button = icon_okay )
                                                                           ELSE VALUE #( icon = icon_yellow_light button = space )
                                             ).
 
  ENDMETHOD.
 
  METHOD if_salv_ida_calc_field_handler~start_page.
  ENDMETHOD.
 
  METHOD if_salv_ida_calc_field_handler~end_page.
  ENDMETHOD.
 
ENDCLASS.
 
START-OF-SELECTION.
 
  DATA(o_handler) = NEW lcl_event_handler( ).
 
  DATA(o_alv) = cl_salv_gui_table_ida=>create( iv_table_name         = 'SFLIGHT'
                                               io_calc_field_handler = o_handler ). " Referenz für Fieldhandler
 
* Single-Selection
  o_alv->selection( )->set_selection_mode( if_salv_gui_selection_ida=>cs_selection_mode-single ).
 
* Tooltips für Icons
  DATA(it_icon_tooltip) = VALUE if_salv_gui_types_ida=>yts_icon_tooltip( ( icon    = icon_yellow_light
                                                                           tooltip = 'Weniger als 10 Sitze.' )
                                                                         ( icon    = icon_green_light
                                                                           tooltip = 'Ausreichend Sitze.' )
                                                                         ( icon    = icon_red_light
                                                                           tooltip = 'Keine Sitze mehr frei.' ) ).
 
* Tooltips setzen: Feldname 'ICON' muss identisch mit ty_calc_field-icon sein!
  o_alv->field_catalog( )->display_options( )->set_tooltip_for_icons( iv_field_name = 'ICON'
                                                                      its_tooltips  = it_icon_tooltip ).
 
* Überschrift für Spalte 'ICON': Feldname 'ICON' muss identisch mit ty_calc_field-icon sein!
  o_alv->field_catalog( )->set_field_header_texts( iv_field_name  = 'ICON'
                                                   iv_header_text = 'Status' ).
 
* Zellen der Spalte 'ICON' sind klickbar: Feldname 'ICON' muss identisch mit ty_calc_field-icon sein!
  o_alv->field_catalog( )->display_options( )->display_as_link_to_action( iv_field_name = 'ICON' ).
 
 
* Tooltips für Buttons: Feldname 'BUTTON' muss identisch mit ty_calc_field-icon sein!
  o_alv->field_catalog( )->display_options( )->set_tooltip_for_icons( iv_field_name           = 'BUTTON'
                                                                      iv_use_standard_tooltip = abap_true ).
 
* Wenn leere Buttonwerte in der Funktion if_salv_ida_calc_field_handler~calculate_line erzeugt werden (INITIAL),
* dann keine Buttons anzeigen
* Feldname 'BUTTON' muss identisch mit ty_calc_field-button sein!
  o_alv->field_catalog( )->display_options( )->display_as_button( iv_field_name               = 'BUTTON'
                                                                  iv_hide_if_value_is_initial = abap_true ).
 
* Überschrift für Spalte 'BUTTON': Feldname 'BUTTON' muss identisch mit ty_calc_field-button sein!
  o_alv->field_catalog( )->set_field_header_texts( iv_field_name  = 'BUTTON'
                                                   iv_header_text = 'Aktion' ).
 
* Click-Handler für Icons und Buttons aktivieren
  SET HANDLER o_handler->on_cell_action FOR o_alv->field_catalog( )->display_options( ).
 
* Tabelle anzeigen
  o_alv->fullscreen( )->display( ).

[ABAP] SALV-Table – Selektionsmodus setzen

1
2
3
4
5
6
DATA: o_alv TYPE REF TO cl_salv_table.
 
...
 
* Zeilen-/Spaltenauswahl (Selektionsmodus) setzen
o_alv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

quarta-feira, 5 de janeiro de 2022

Eclipse - Informações sobre status debug (toggle breakpoint) AMDP

Informações do post conforme link abaixo

 https://blogs.sap.com/2020/04/21/adt-abap-debugger-what-to-do-if-your-program-does-not-stop-at-breakpoints/#UnusualBreakpoint


Details Section

1) Unusual looking breakpoint

a)Your breakpoint is decorated with a gray diamond. That means the source where you placed the breakpoint is currently inactive. Activate the source to make the breakpoint work.

b)Your breakpoint is crossed out. That means you activated the Eclipse feature ‘Skip All Breakpoints’ that can be used to make ALL breakpoints non-functional. Deactivate the ‘Skip All Breakpoints’ feature via main menu ‘Run’ -> ‘Skip All Breakpoints’. Alternatively use the buttons in the Eclipse main toolbar or in the breakpoints view toolbar.

c)Your breakpoint is white. That means the breakpoint was disabled. To enable it keep shift pressed and double click the breakpoint. Alternatively open the context menu on the breakpoint and choose ‘Enable Breakpoint’.

If you are told this cannot be done because ‘… debugging is disabled …’ click the link on the popup and activate the checkbox ‘Enable debugger’.

d)Your breakpoint is green. That means you currently deal with a special kind of breakpoint which can be a soft breakpoint, a temporary breakpoint or an AMDP breakpoint. To identify what it actually is you can mouse hover over the breakpoint and check the hover text or you can open the breakpoints view and check the text there.

– Soft breakpoints are only effective in a running debug session but they cannot launch a new debug session on their own. This is a special feature for debugging situations with massive amounts of requests, e.g. catch one request with a normal breakpoint, disable that normal breakpoint and continue working with soft breakpoints. To remove the attribute ‘Soft’ from your breakpoint keep ALT pressed and double click it or change it via the breakpoints view.

– Temporary breakpoints occur in temporary editors, e.g. if you stepped into a foreign system via RFC or if you debug classic dynpros/screens with ADT. They are only effective in a running debug session but they cannot launch a new debug session. If you need a standard breakpoint that is able to startup a new debug session try a different/earlier source position.

– AMDP breakpoints are not ABAP breakpoints at all. Learn more about AMDP Debugging in this blog. A similar blog ‘What to do if your DB procedure does not stop at AMDP breakpoints’ is planned. It will be linked here once available.

e)Your breakpoint is decorated with a red cross. That means that there is a conflict with someone else who wants to debug the same requests as you do. Learn more about debugging conflicts in this blog.

f)Your breakpoint is decorated with a gray cross. That means the ABAP system is not reachable at all. Check whether your computer has a working network connection and whether the ABAP system is reachable at all (e.g. via SAP GUI).

g)Your breakpoint is decorated with a small U (User). That means you currently try to debug the requests of a different user. See this detail section.

h)Your breakpoint is decorated with a small T (Terminal-ID). Unless you have a good reason you should not use this option at all. To go back to normal mode, right click a breakpoint, choose “Debug Properties…” and change the radio button to “Logon User”.

i)Your breakpoint is decorated with a small P (Project). That means you can only debug requests that are started from exactly the ADT project you are currently working in. That includes execution of ABAP unit tests, activities in embedded SAP GUI or class runs (Right click -> “Run As” -> “ABAP Application Console”). In this mode, you cannot debug requests from other ADT projects, from a web browser (e.g. Fiori Apps) or RFC requests.

If you are not sure what this project mode is good for or how you even entered it you can read this blog. To go back to normal mode, right click a breakpoint, choose “Debug Properties…” and change the radio button to “Logon User”.

j)Your breakpoint is decorated with a small C (Conditional). That means you added a condition to the breakpoint (e.g. “sy-subrc = 4”). The condition is evaluated during runtime once the breakpoint is reached. If the result is false, the debugger will not stop the program and there will be no debug session. For further details see the ADT documentation.

To make the breakpoint always stop, just remove the condition via the breakpoints view or via right click on the breakpoint and “Breakpoint Properties…”.

terça-feira, 21 de dezembro de 2021

Corrigindo status monitor NFE - cancelamento autorizado pelo SEFAZ mas status 2 no monitor

 Pela chave da NFE ler tabela /XNFE/EVENTS

CHNFE =  <chave da NF>

pegar o valor do GUID 

Utilizar função /XNFE/PROCSTEP_EV_ERPUPDAT - colocar o GUID

Executar debugando conforme tela abaixo.



terça-feira, 9 de novembro de 2021

Alterando nome de arquivo anexo - caixa de entrada FIORI

UKM_CASE - com workflow de aprovação de crédito.
Quando o caso entra na caixa de entrada do usuário/responsável na aprovação ou qualquer outra decisão na caixa de entrada do FIORI é possível incluir um comentário/justificativa, esse texto quando volta para o backend entra como um anexo na caixa de email na SOST, o problema é que o nome do arquivo por standard fica como "Approver Comments", debugando percebi que esse texto é uma constante sem  opção de tradução.

Sem muita opção no retorno para o backend eu altero o nome do arquivo antes de entrar na caixa de email para envio. 
Essa informação fica gravado na tabela SOOD

Utilizei a função conforme abaixo:
Essa rotina eu inseri numa classe criada dentro do fluxo do workflow

    DATAl_doc_id    TYPE sofolenti1-doc_id,
          ls_doc_data TYPE sofolenti1.

    DATAlt_header  TYPE TABLE OF solisti1,
          lt_content TYPE TABLE OF solisti1.
    
    "O LOOP é necessário pois pode haver mais anexos 
    LOOP AT it_attach INTO DATA(ls_attach).

      l_doc_id ls_attach-instid.
        
      "Faço a importação dos dados do anexo
      CALL FUNCTION 'SO_DOCUMENT_READ_API1'
        EXPORTING
          document_id                l_doc_id
        IMPORTING
          document_data              ls_doc_data
        TABLES
          object_header              lt_header
          object_content             lt_content
        EXCEPTIONS
          document_id_not_exist      1
          operation_no_authorization 2
          x_error                    3
          OTHERS                     4.
     
      "Nesse caso peguei somente o objeto COMMENT ref. a justificativa gravado
      IF sy-subrc AND
         ls_doc_data-obj_name 'COMMENT' AND
         ls_doc_data-obj_descr /iwwrk/if_wf_constants_gw=>gc_approver_comments.

        DATAl_attach_id TYPE soattinfi1-attach_id.
        DATAls_attach_data TYPE soattchgi1.

        CONCATENATE ls_doc_data-doc_id ls_doc_data-object_id
                    INTO l_attach_id RESPECTING BLANKS.

        CLEAR ls_attach_data.
        MOVE-CORRESPONDING ls_doc_data TO ls_attach_data.
        ls_attach_data-obj_descr mc_approver_filename. "Constante com outro nome                                                            " do arquivo
        ls_attach_data-att_size ls_doc_data-doc_size.

        CALL FUNCTION 'SO_ATTACHMENT_UPDATE_API1'
          EXPORTING
            attachment_id              l_attach_id
            attachment_data            ls_attach_data
          TABLES
            attachment_header          lt_header
            attachment_content         lt_content
          EXCEPTIONS
            attachment_not_exist       1
            operation_no_authorization 2
            parameter_error            3
            x_error                    4
            enqueue_error              5
            OTHERS                     6.

        IF sy-subrc <> 0.

        ENDIF.


      ENDIF.

    ENDLOOP.