Skip to Content
avatar image
Former Member

Oops ALV screen refresh issue when using SAPGUI_SET_FUNCTIONCODE

Hi All,

I am facing issue while I am trying to refresh ALV data 2nd time (update with new data), when using FM - SAPGUI_SET_FUNCTIONCODE.

If I comment this FM, then refresh works ok.

My scenario is as per below, no POV event used.

===

  1. Above part of screen has some display only fields, suppose ITEM1.
  2. Below part has Oops ALV grid (using cl_gui_alv_grid) with an editable checkbox, like available inventory for this ITEM1.
  3. User selects check-box one by one in this ALV and without any further action from user, there should be a popup to tell that ITEM1 is fulfilled (suppose after 3 records selected). To do this popup,  I am calling FM - SAPGUI_SET_FUNCTIONCODE in event handling of alv.
  4. Once control reach PAI via this FM, some calculations are done in PAI and popup shown if required.
  5. When user gets popup that ITEM1 is done, they will press a pushbutton 'NEXT' which will show ITEM2 in top screen part and corresponding ITEM2 inventory records should be shown in ALV area now so that user can select again.

Point 5 is not working, no matter what I do, even on ITEM2 system is still showing ALV records of ITEM1 only.

I am using refresh_table_display and internal table is populated correctly with ITEM2 data, but still ITEM1 data is shown. If I comment FM - SAPGUI_SET_FUNCTIONCODE, then everything is working well.

I also tried to replace with CL_GUI_CFW=>SET_NEW_OK_CODE, but same refresh problem occurs.

Please help, let me know if more details are required.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jan 14, 2015 at 01:17 AM

    Please help experts, let me know if scenario is not clear.

    Simple way to put is - Same screen, same customer container, I want to refresh the data on press of push-button. It is not happening if I am using above said FM in event handling.

    FM is used to trigger PAI when user select/unselect checkbox in ALV.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Diwakar,

      I want you to use the FLUSH method before your computation. That is what is I mentioned in my earlier reply, to use immediately after you pick the data into your internal table after the user selects the number of records.

      1. ALV Event handling

      1.1. Here, check if the internal table has got the selected values and if they are in place, use FLUSH to clear the memory (Don't check for Initial of Internal table)

      2. Use same FM

      3. User click checkbox will Trigger PAI

      4. Do some computation.

      After you do the computation and reach the PBO, still the memory will hold the same values of ITEM1. So before you enter into this PBO layer you should clear those values.

      Please do this in the debugging mode and paste those screen shots if possible otherwise you can send them to my mail Id and I will check the same from my end.

      Thank You!

      Syed.

  • avatar image
    Former Member
    Jan 14, 2015 at 04:56 AM

    Hi Diwakar,

    How about you call refresh functionality before calling the pop-up screen?


           wa_stable-row = abap_true.

           wa_stable-col = abap_true.

           CALL METHOD g_grid->refresh_table_display

             EXPORTING

               is_stable = wa_stable

             EXCEPTIONS

               finished  = 1

               OTHERS    = 2.

    Call pop-up.

    Regards,

    Gayatri

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2015 at 05:07 AM

    you can try below code:

    Before creating the container free the object, as below:

    IF zcl_cont2 IS NOT INITIAL.

         CALL METHOD zcl_cont2->free

           EXCEPTIONS

             cntl_error        = 1

             cntl_system_error = 2

             OTHERS            = 3.

       ENDIF.

       CREATE OBJECT zcl_cont2

         EXPORTING

           container_name = 'LV_CONT2'.

       CREATE OBJECT zcl_grid2

         EXPORTING

           i_parent = zcl_cont2.

       CALL METHOD zcl_grid2->set_table_for_first_display

         EXPORTING

           i_structure_name = 'ZSTR'

         CHANGING

           it_outtab        = t_output

           it_fieldcatalog  = t_fcat1.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Diwakar,

      Where are you calling REFRESH function currently?

      If we are assuming 'NEXT' to be a triggering point for updating data, is there any possibility to update the internal table for display in the PAI Module? If done so, it will execute the refresh as needed.

  • Jan 14, 2015 at 12:07 PM

    Well if you want you report to be driven thru function-codes/user-command the  you will tirgger a PAI/PBO cycle, and refresh of the ALV grid MUST be executed in PBO (if initial/create/else/refresh/endif) ?

    Regards,

    Raymond

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi All,

      I need more help, on further trouble-shooting I have concluded that my problem is there even when I am not using above-said Function module, when I try to take auto action on check-box click, this alv refresh problem is happening.

      My scenario is as below :-

      1. Some I/O fields on top of screen related to ITEM data and below part of screen is ALV grid with editable check-box showing item inventory.

      2. Some orders which have two items, system will show item1 details, user will select records and once item 1 is fulfilled..there will be a popup to inform user and then user will click a pushbutton and item2 data and inventory should show-up.

      3. Additional requirement is when user select a check-box, a field on top part from item data should show total quantity selected. so if each record is 20 qty, whenever user select record 1,2, 3.....field should change 20,40,60 ,....And a final popup when required quantity is met.

      4. To do this requirement 3, I am using EVENT data_changed OF cl_gui_alv_grid. In event subroutine, I am calculating QTY field value and now to refresh this field value on top part of screen, I have tried 2 ways :-

      a. Call PAI using FM or Suppress Dailog which inturn call PBO again and hence QTY field is correct.

      b. Directly Call Same screen using "Call screel XYZ" in event subroutine to trigger PBO and QTY field is correct.

      5. Everything is working well until here, but when required qty is met and user click the pushbutton, item2 details are displayed on top part but ALV grid is not refreshed with ITEM2 data. I am also using REFRESH_TABLE_DISPLAY in pbo before showing alv grid data.

      If I am not doing 4a or 4b, then refresh is working perfectly well but QTY field is not getting refreshed on checkbox click which is requirement .

      Please suggest what should be done, thanks.

  • avatar image
    Former Member
    Jan 20, 2015 at 10:42 AM

    Hi Diwakar,

    Can you make sure that the alv and custom container objects creation happening only once.

    if obj_alv is initial.

    craete objects for alv and custom container.

    endif.

    Regards

    Sreekanth

    Add comment
    10|10000 characters needed characters exceeded