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: 

ALV HotSpot event - very mysterious problem with first row on the list.

marcin_makowski
Explorer
0 Kudos
2,713

Dear Experts,

In my OO ALV program I made one of the fields HotSpot active. Fieldcatalog is modified correctly and then passed as a parameter to method 'set_table_for_first_display'. Beautiful list is displayed, and hot spot is marked as well. Problem occurs always when first row on the list is clicked - after first click event export parameters are empty (initial values for row id, column name etc.), after second click correct value is passed. When then I click another rows (2,3,4 etc) everything is fine, event is triggered and correct value is passed. When after that I again click on first row, event export fields contain last passed value instead correct one (f.e. index of last clicked row 4). Does anybody have/had similar problem? Can you help me please? I was using ALV Easy Reference, and already check my code for bugs.

Best regards,

Marcin Makowski

1 ACCEPTED SOLUTION

Former Member
0 Kudos
631

Hi,

Define your output table as global table

i.e define "<b>it_yddld</b>" in top include.

Regards,

Suresh

12 REPLIES 12

JoseMunoz
Active Participant
0 Kudos
631

Post some code to see what's happening..

I have never seen that...

marcin_makowski
Explorer
0 Kudos
631

Hi,

I perform following steps :

......
.
.
.
CLASS lcl_event_handler DEFINITION .
  PUBLIC SECTION .
    METHODS:
*Controlling data changes when ALV Grid is editable
    handle_data_changed
    FOR EVENT data_changed OF cl_gui_alv_grid
    IMPORTING er_data_changed,
*hotspot click control
    handle_hotspot_click
    FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no.
  PRIVATE SECTION.
ENDCLASS.                    "lcl_event_handler DEFINITION
.
.
.
CLASS lcl_event_handler IMPLEMENTATION .
*Handle Data Changed
  METHOD handle_data_changed .
    PERFORM handle_data_changed USING er_data_changed .
  ENDMETHOD.                  "handle_data_changed
*Handle Hotspot Click
  METHOD handle_hotspot_click .
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no.
  ENDMETHOD .                 "handle_hotspot_click
ENDCLASS .                    "lcl_event_handler IMPLEMENTATION


DATA: gr_event_handler TYPE REF TO lcl_event_handler.
.
.
.
 IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
           EXPORTING container_name = g_container.
    CREATE OBJECT grid1
           EXPORTING i_parent = g_custom_container.
    CREATE OBJECT er_data_changed.

    CREATE OBJECT gr_event_handler .

    PERFORM hide_some_alv_buttons.

#here I am setting up fieldcatalog parameter to make #field hotspot active.
    PERFORM modify_fieldcatalog.

    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
*        i_structure_name     = 'YDDLDS'
        i_bypassing_buffer   = 'X'
        it_toolbar_excluding = gt_toolbar_excluding
      CHANGING
        it_outtab            = it_yddld
        it_fieldcatalog      = gt_fieldcat.

    CALL METHOD grid1->register_edit_event
      EXPORTING
        i_event_id = grid1->mc_evt_enter.

*    PERFORM setup_hotspots.

    SET HANDLER gr_event_handler->handle_data_changed FOR grid1.
    SET HANDLER gr_event_handler->handle_hotspot_click FOR grid1.
.
.
.
#here are unproper values - in event parameters
FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
                                i_column_id TYPE lvc_s_col
                                is_row_no TYPE lvc_s_roid.

  READ TABLE it_yddld INTO wa_yddld INDEX is_row_no-row_id .

  iv_row_id = i_row_id.
  iv_column_id = i_column_id.
  iv_row_no = is_row_no.

  IF sy-subrc = 0 AND i_column_id-fieldname = 'CCOME'
  OR i_column_id-fieldname = 'COMME'.
    CALL SCREEN 200 STARTING AT 10 2 ENDING AT 110 18.
  ENDIF.

ENDFORM.                    " handle_hotspot_click
..............

From code point of view everything seems to be fine :(.

Best regards,

Marcin

0 Kudos
631

Try reading the internal table with:

READ TABLE it_yddld INTO wa_yddld INDEX i_row_id-index.

Not

READ TABLE it_yddld INTO wa_yddld INDEX is_row_no-row_id.

0 Kudos
631

I was already trying this, the problem is that after first click on the first row all these parameters are empty (initial)- i_row_id also. After click on other rows values are correct. And as I mentioned, when I click on first row then, last values (f.e. for last clicked row 4) are passed.

regards

Marcin

0 Kudos
631

I discovered one more very interesting relation: problem occurs only after refresh_table_display method was used. It does not occur for first initial contents of screen grid (directly after set_table_for_first_display). After change of selection parameters, and refresh_table_display method there is problem with hotspot navigation described above.

regards

Marcin

Former Member
0 Kudos
632

Hi,

Define your output table as global table

i.e define "<b>it_yddld</b>" in top include.

Regards,

Suresh

0 Kudos
631

Hi,

it is defined as global table in TOP include:

data: it_yddld TYPE TABLE OF ycddld.

regards

Marcin

0 Kudos
631

I'm not sure but try defining the method/form this way:

METHODS handle_hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id. " E_COLUMN_ID.

*Handle Hotspot Click

METHOD handle_hotspot_click .

PERFORM handle_hotspot_click USING e_row_id e_column_id.

ENDMETHOD . "handle_hotspot_click

FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row

i_columnid TYPE lvc_s_col.

ENDFORM

0 Kudos
631

Thanks for hint, I have tried but it does not change antyhing.

It looks like just after set_table_for_first display method everything is OK as long as NUMBER OF ROWS IS NOT CHANGED on the screen - after I use new selection parameters (modal selection screen), and then use refresh_table_display method, problem starts.

regards

Marcin

0 Kudos
631

Then problem would be in the refresh method...

I can't help you without the whole code in my system, sorry...

0 Kudos
631

Hi,

I think PBO is not calling after your dialog box,

if this is the case use folowing method after

you call screen or at end of method.

CALL METHOD cl_gui_cfw=>set_new_ok_code

EXPORTING

new_code = 'ENTR'.

just give a try.

Regards,

Suresh

marcin_makowski
Explorer
0 Kudos
631

Hi guys,

Thanks a lot to you for your time and effort spent on investigation of my problem.

I just discovered that my program was fine and the reason of my problem were test data in one specific record (always this first one that I was talking about) - this data were corrupted - I simply copied and paste some text from internet site into first text field as a test data few days ago and there was some very strange invisible formatting - because of this formatting this particular field always caused strange behavior of my event. I just removed this data and entered some 'plain text' manually and everything works fine now.

Really thanks for your cooperation.

Marcin