Application Development 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 Page up/down

Former Member
0 Kudos

Hi All,

Is it possible to activate the 4 buttons for Page Up/ Down (P+, P, P--, P-) in ALV?

I added it to PF status also activated the function keys on the PF Status but it does not work. My user wants the page up/down as well as scrolling functionality in ALV.

Please help.

Thanks and Have a nice day

8 REPLIES 8

Former Member
0 Kudos

Hello,

Write this.

START-OF-SELECTION.

SET PF-STATUS 'Status'.

Double click on Status, it will ask you to write GUI status.

In the Function keys --Standard Toolbar,

enter the Function Codes(page up, page down etc...) as follows.

Assign standard function Codes to the Page up and Page down buttons in the "Function Keys"

(4 icons will be there)

PAGE UP = P-

NEXT PAGE = P+

FIRST PAGE = P--

LAST PAGE = P++

Save and activate it.

Reactivate the program as well.

0 Kudos

Hi,

I tried but does not work. Let me know if this worked for you.

I have PF Status in ALV Gird as well with some additional toolbar option, I created another PF Status like what you said , but did not work.

Former Member
0 Kudos

hi,

These are the default functionalities of the grid and the buttons should be there on the Grid's toolbar.

Regards,

RItesh J

0 Kudos

Hi Ritesh,

Yes, this is a std functionality but the buttons are deactivated. I have scrolling on my ALV but need these button as well.

I can activate the button in ALV Set Pf Status with the fucntion codes, but that does not work. I'll have to code myself for the page up and page down fucntionality.

If you have something working, let me know.

Thanks.

0 Kudos

Hi,

maybe this will be useful:


DATA:  g_row TYPE lvc_s_row.

MODULE user_command INPUT.
  CASE ok_code.
    WHEN 'P--'.
      g_row-index = 1.
      CALL METHOD go_alvgrid->set_current_cell_via_id
        EXPORTING
          is_row_id = g_row.
    WHEN 'P-'.
      IF g_row-index > 1.
        SUBTRACT 1 FROM g_row-index.
      ENDIF.
      CALL METHOD go_alvgrid->set_current_cell_via_id
        EXPORTING
          is_row_id = g_row.
    WHEN 'P+'.
      ADD 1 TO g_row-index.
      DESCRIBE TABLE itab[] LINES sy-tfill.
      IF g_row-index > sy-tfill.
        g_row-index = sy-tfill.
      ENDIF.
      CALL METHOD go_alvgrid->set_current_cell_via_id
        EXPORTING
          is_row_id = g_row.
    WHEN 'P++'. 
      DESCRIBE TABLE itab[] LINES g_row-index.
      CALL METHOD go_alvgrid->set_current_cell_via_id
        EXPORTING
          is_row_id = g_row.
  ENDCASE.
ENDMODULE.                    "user_command INPUT

Regards,

José Raúl López

0 Kudos

thanks to Jose Raul Lopez Medina

I could solve my problem and put the page up and page down

0 Kudos

The code above has important constraints or may not work as people could think :

P- and P+ only scroll one line, instead of one page. Moreover, if the user also scrolls via the scrollbar or with the mouse wheel, then using the buttons P-/P+ will ignore the current top row, because the variable G_ROW is never refreshed from the current top row (we should use go_alv_grid->get_scroll_info_via_id).

Moreover, instead of using the method set_current_cell_via_id, we should better use set_scroll_info_via_id to be coherent with using get_scroll_info_via_id for getting the top row.

To make a true "page scrolling", we must get the number of visible rows, the most correct way is the one explained in this thread (using the OCX property "GetVisibleRowCount") but SAP might remove this possibility without notice.

Former Member
0 Kudos

Hi,

Yo dont have to give separate function codes for page up/down.

If you click the ALV and press page up/down the scrolling takes place.

Regards,

Dhasarathy.