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

How to deactivate ALV protocol?

Former Member
2,157

Hi experts,

I have an ALV grid where also field datum is displayed.

When i put invalid datum (32.09.2008) into this field and press enter an pop-up comes

saying invalid entry or something. I gues it is an ALV protocol but I haven't implemented something

like this. Is it standard of ALV, this datum control?

Is there some way how to disable this function?

Thanks.

Hi experts,

I have an ALV grid where also field datum is displayed.

When i put invalid datum (32.09.2008) into this field and press enter an pop-up comes

saying invalid entry or something. I gues it is an ALV protocol but I haven't implemented something

like this. Is it standard of ALV, this datum control?

Is there some way how to disable this function?

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
1,451

> Is it standard of ALV, this datum control

When you are dealing with Date and Times if you dont enter the proper format then it will raise the Error, that will be caught by ALV protocol and displays as message.

if you want to avoid that you have to change the data type to Char type, especially for date and Time fields. The rest of the cases we can control the ALV protocol by using the ALV protocol methods in DATA_CHANGED event.

class responsible for that is CL_ALV_CHANGED_DATA_PROTOCOL

Read only

Former Member
0 Likes
1,451

If you have declared the alv table field like datum, the invalid message is a standard one.

You can avoid this message declaring the datum field 10 type c and no standard control starts.

Be careful that you don't have the automatic routine that converts 20080708 in 08.07.2008.

Regards

Read only

0 Likes
1,451

Thanks, but I already have some DD structure defined according to which I create ALV.

And it is not the best way to change it.

I thought maybe some method of ALV exist saying 'no_protocol_display'...

Read only

0 Likes
1,451

>And it is not the best way to change it.

Good it is not best way to do.

>I thought maybe some method of ALV exist >saying 'no_protocol_display'...

ok assume there is a way to bypass, what you going to do with error data, which is incorrect format. Are you going to update any error data to any table.

It is possible. Still if you want i will tell you.

Read only

0 Likes
1,451

Check this sample..

see the comments.

REPORT  ztest_alv_edit.

DATA: it_flight TYPE STANDARD TABLE OF sflight.

DATA: it_fcat TYPE lvc_t_fcat,
      wa_fcat TYPE lvc_s_fcat.

DATA: grid TYPE REF TO cl_gui_alv_grid,
      cont TYPE REF TO cl_gui_custom_container.
CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA: g_handler TYPE REF TO lcl_event_receiver.

*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.
    METHODS:
      handle_data_changed
         FOR EVENT data_changed OF cl_gui_alv_grid
             IMPORTING er_data_changed.

ENDCLASS.                    "lcl_event_receiver DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_data_changed.
   "this will stop poping the message
   clear er_data_changed->MT_PROTOCOL.

  ENDMETHOD.                    "handle_data_changed

ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION

START-OF-SELECTION.

  SELECT * FROM sflight
  INTO TABLE it_flight
  UP TO 20 ROWS.
end-of-SELECTION.
  CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS'.
  IF cont IS INITIAL.


    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name       = 'SFLIGHT'
      CHANGING
        ct_fieldcat            = it_fcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2.
    CREATE OBJECT cont
      EXPORTING
        container_name              = 'CONT'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6
        .
    IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_fcat-edit = 'X'.
    wa_fcat-checktable = '!'.
    MODIFY it_fcat FROM wa_fcat TRANSPORTING edit checktable
    WHERE fieldname = 'FLDATE'
    .
    CREATE OBJECT grid
      EXPORTING
        i_parent          = cont
      EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        OTHERS            = 5
        .
    IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD grid->set_table_for_first_display(
       CHANGING
         it_outtab                     = it_flight
         it_fieldcatalog               = it_fcat
       EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
            ).
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    "Important for editable grid
     call method grid->register_edit_event
               exporting
                  i_event_id = cl_gui_alv_grid=>mc_evt_enter.
     CREATE OBJECT g_handler.
    "setting the handler
    SET HANDLER  g_handler->handle_data_changed FOR grid.

  ENDIF.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  "important method to trigger the DATA_CHANGED event
  CALL METHOD grid->check_changed_data.
  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT