Skip to Content

GET_SELECTED_ROWS didn't get the selected row in second time.

Dear friends,

      I had trapped in this problem in many days, I have search many discussion in SCN, but didn't find any solution yet. Hope someone can help me with this:

      I display an ALV report by OO container, which divide into three pieces. Such as when I select two row then I click one button, then I want to get the row I selected. but now it can only get the row first time, after that, it wouldn't succeed again unless I run the report again.

     In addition, after I select another ALV row, then back into the above screen, it can not get the row no matter first time or other:

My code in PBO(post some key code ):

DATA: Grid4            TYPE REF TO cl_gui_alv_grid.

WA_LAYOUT1-SEL_MODE = 'A'.

CALL METHOD grid4->set_table_for_first_display

     EXPORTING

        IS_LAYOUT       = WA_LAYOUT1

        IS_VARIANT      = WA_VARIANT1

        I_SAVE          = 'A'

     CHANGING

       IT_FIELDCATALOG = GT_FIELDLOG

       it_outtab       = <DYN_TAB2>.


after I select some row, I click the button, then it run this code in PAI :


IF GRID4 IS NOT INITIAL.

            CLEAR GT_ROW_TAB2.

            CLEAR GT_NO_TAB2.

            call method grid4->check_changed_data

               importing

                  e_valid = l_valid.

             CALL METHOD grid4->GET_SELECTED_ROWS

               IMPORTING

                ET_INDEX_ROWS = GT_ROW_TAB2[]

                ET_ROW_NO     = GT_NO_TAB2[].

ENDIF.

     

     Thanks for your sincerely answer!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 06, 2015 at 11:41 AM

    Hi Zhang,

    Call the REFRESH_TABLE_DISPLAY method in PBO with respect to your grids objects.

    Code Should be.

    PBO.

         your current coding to display the information through set_table_for_first_display.

        

         at the last of PBO.

              call the grid->REFRESH_TABLE_DISPLAY

              exporting

                   I_SOFT_REFRESH = 'X'.

    PAI
         PAI Coding.

    regards.

    Praveer.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Zhang,

      Please find the below screens,

      I made a very simple program.

      1 Inside the PBO Module.

      2 Inside the PAI module

      and every time selected row information is coming on et_index_rows parameter.

      Please check.

      regards.

      Praveer.

      1in.JPG (50.3 kB)
      12.JPG (22.4 kB)
  • Jan 06, 2015 at 11:58 AM

    Hi,

    For editable ALV, event needs to be registered and then once the data is updated, we should use refresh_table_Display method. Refer the below link in which I am explaining the same.

    http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=37472

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 08, 2015 at 06:14 AM

    Hi Zhang,

                 CALL METHOD grid4->GET_SELECTED_ROWS

                   IMPORTING

                    ET_INDEX_ROWS = GT_ROW_TAB2[]

                    ET_ROW_NO     = GT_NO_TAB2[].

    CALL METHOD grid4->refresh_table_display.

    Hope it helpful.

    Regards,

    Venkat.

    Add comment
    10|10000 characters needed characters exceeded