Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem using method ADD_PROTOCOL_ENTRY in "handle_data_changed"

Rodrigo-Giner
Active Contributor
0 Likes
3,942

Hi, im validating the data inside method "handle_data_changed" and when a error occurs I use the following code to add an error in the protocol.

CALL METHOD p_er_data_changed->add_protocol_entry
            EXPORTING
            i_msgid = 'SU'
            i_msgno = '000'
            i_msgty = 'E'
            i_msgv1 = 'Value Invalid '
            i_fieldname = lw_mod_cell-fieldname
            i_row_id = lw_mod_cell-row_id.

The problem is that even I dont use the method p_er_data_changed->display_protocol. It shows me the protocol anyway... and dont know why.

What I want is to collect all the errors in the protocol so when the user press a "check" or "save" button, if the protocol isnt empy then show ALL the errors.

But the event is triggered in every field so what I get is a error message for each field instead of showing all the errors together.

thx

9 REPLIES 9
Read only

Kiran_Valluru
Active Contributor
0 Likes
2,445

Hi.,

To suppress the popup log you have to deactivate the protocol display.

pass space to the method ACTIVATE_DISPLAY_PROTOCOL( ) of class CL_GUI_ALV_GRID to suppress popup log.

DATA: o_grid TYPE REF TO cl_gui_alv_grid.

o_grid->activate_display_protocol( space ). " To deactivate Protocol display

do this in PBO.

hope this helps u.,

Thanks & Regards,

Kiran

Read only

0 Likes
2,445

My primary problem was that I registered the event:

*      CALL METHOD o_grid->register_edit_event
*        EXPORTING
*          i_event_id = cl_gui_alv_grid=>mc_evt_modified.

Now I dont get the protocol after completing every cell.

Kiran, thx for the input it works.

But now how can I do, to show the protocol wherever I want ? for example when the button "SAVE" is pressed.

Read only

0 Likes
2,445

So... is there a way to show the protocol outside the event data_changed. For example at user_command when pressing SAVE.

Read only

0 Likes
2,445

Try this way:

CALL METHOD pr_data_changed->add_protocol_entry
        EXPORTING
          i_msgid     = '0K'
          i_msgno     = '000'
          i_msgty     = 'E'
          i_msgv1     = text-m03
          i_msgv2     = magv2
          i_msgv3     = text-m04
          i_fieldname = fieldname
          i_row_id    = row_id.
      error_in_data = 'X'. "<<<<<<<<<<<<<<
      EXIT.

*-- Display application log if an error has occured.
    IF error_in_data EQ 'X'.
      CALL METHOD er_data_changed->display_protocol.
    ENDIF.

Read only

0 Likes
2,445

Hi Jay, but that code is inside the method handle_data_changed. Right ?

Is like CALL METHOD er_data_changed->display_protocol only can be used in that method. So if u register the event

CALL METHOD o_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.

The protocol will be displayed wharever u enter a value in each field.

If u register this event

CALL METHOD o_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.

You will get it wharever you hit ENTER.

Like Kiranssaid, with this you can avoid showing the protocol,

o_grid->activate_display_protocol( space ).

Tthe thing is that I want to show it... but not in the method handle_data_changed, and It seems that is a private method... so I dont know if there is a way to show it outside the method handle_data_changed.

thx greetings

Read only

0 Likes
2,445

Can creating a method for display protocol help? and call it where needed

call method o_grid->display_me( ).

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,445

Hello,

I think you might have placed the method display_protocol( ) inside an iteration!

I'll suggest have a look at the SAP demo program BCALV_EDIT_03. Have a look at the event handle method handle_data_changed( ).

BR,

Suhas

Read only

0 Likes
1,519

I did this to suppress the protocol , but my fields are high lighted in red now . How to remove this ?

BhartiK_0-1752047854401.png

Regards,

Bharathi

Read only

Former Member
0 Likes
2,445

Hi ,

have you registed the event ENTER , it will happens whenever you press enter/adding new rows and then press enter.

regards

Prabhu