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

Screen Listbox update value not working

oliver_am
Active Participant
0 Likes
1,254

Hello,

I have a Listbox with key in my screen; Values 00 to 10 with descriptions...


I have also an ALV with a hotspot field. When I click in a field of this ALV I want to change the value in this Listbox but is not working.

In the method that handle the event I'm changing the value of the global variable used by this listbox, but when the event is triggered the field is not updated in the screen.

I've tried with DYNP_VALUES_UPDATE within the method, but not working so I've tried with FM SAPGUI_SET_FUNCTIONCODE to simulate an enter '=00' in this moment the PAI of the screen is triggered but the value of my global variable has the previous value I had before the event of the ALV, it's like the changes inside the method does not affect to the global data of my function group...
But I'm changing also another global variable, only for test, and this variable is changed ok.

I have also a button in the screen to change the value of the listbox, only for test, and with this button is working fine...

I've tried calling VRM_SET_VALUES only once the first time the screen is callend and also always the PBO is triggered...


Do yow know what is happening?
Thanks.

Hello,

I have a Listbox with key in my screen; Values 00 to 10 with descriptions...


I have also an ALV with a hotspot field. When I click in a field of this ALV I want to change the value in this Listbox but is not working.

In the method that handle the event I'm changing the value of the global variable used by this listbox, but when the event is triggered the field is not updated in the screen.

I've tried with DYNP_VALUES_UPDATE within the method, but not working so I've tried with FM SAPGUI_SET_FUNCTIONCODE to simulate an enter '=00' in this moment the PAI of the screen is triggered but the value of my global variable has the previous value I had before the event of the ALV, it's like the changes inside the method does not affect to the global data of my function group...
But I'm changing also another global variable, only for test, and this variable is changed ok.

I have also a button in the screen to change the value of the listbox, only for test, and with this button is working fine...

I've tried calling VRM_SET_VALUES only once the first time the screen is callend and also always the PBO is triggered...


Do yow know what is happening?
Thanks.

2 REPLIES 2
Read only

oliver_am
Active Participant
0 Likes
1,086

In the end I'm using the aux variable I'm changing for test within the event method, and updating the variable of the list box from this variable in the PBO if it has a value.

But I dont understand the behaviour of this...

Read only

Sandra_Rossi
Active Contributor
1,086

No problem for me:

REPORT.

PARAMETERS country(3) TYPE c AS LISTBOX VISIBLE LENGTH 20.

CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    METHODS main.
    METHODS on_double_click
      FOR EVENT double_click
                  OF cl_salv_events_table
      IMPORTING row.
    DATA salv TYPE REF TO cl_salv_table.
    DATA sflight_s TYPE TABLE OF sflight.
    DATA go_docking TYPE REF TO cl_gui_docking_container.
ENDCLASS.

CLASS lcl_app IMPLEMENTATION.
  METHOD main.

    SELECT * FROM sflight INTO TABLE @sflight_s.

    CREATE OBJECT go_docking
      EXPORTING
        repid     = sy-repid
        dynnr     = sy-dynnr
        side      = cl_gui_docking_container=>dock_at_right
        extension = 400.

    cl_salv_table=>factory(
      EXPORTING
        r_container  = go_docking
      IMPORTING
        r_salv_table = salv
      CHANGING
        t_table      = sflight_s ).

    salv->get_functions( )->set_all( ).

    DATA lo_events TYPE REF TO cl_salv_events_table.
    lo_events = salv->get_event( ).
    SET HANDLER on_double_click FOR lo_events.

    salv->display( ).
  ENDMETHOD.
  METHOD on_double_click.
    cl_gui_cfw=>set_new_ok_code( '=00' ).
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.
  DATA app TYPE REF TO lcl_app.

AT SELECTION-SCREEN OUTPUT.
  IF app IS NOT BOUND.
    app = NEW lcl_app( ).
    app->main( ).
    DATA: lt_value TYPE vrm_values,
          ls_value TYPE vrm_value.
    ls_value-key = 'FRA'.
    ls_value-text = 'France'.
    APPEND ls_value TO lt_value.
    ls_value-key = 'GER'.
    ls_value-text = 'Allemagne'.
    APPEND ls_value TO lt_value.
    CALL FUNCTION 'VRM_SET_VALUES'
      EXPORTING
        id              = 'COUNTRY'
        values          = lt_value
      EXCEPTIONS
        id_illegal_name = 1
        OTHERS          = 2.
    country = 'FRA'.
  ELSE.
    country = 'GER'.
  ENDIF.