Skip to Content

Change the browser's scrollbar position programmatically

I have an application with 2 pages that both are quite long.

If I scroll down on page 1 (using the regular scrollbars of the internet explorer), and navigate to page 2 afterwards, the system tries to be smart and scroll me down automatically on page 2 as well.

This is sometimes a nice feature, but sometimes not. Is there anything I can do to influence this scrollbar behavior?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 22, 2009 at 04:01 PM

    You can try setting the focus on a particular View UI element:

    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c0/800f02bb734dd9977a64a8a7e87fe3/frameset.htm

    We also in Lightspeed (7.01+) have the api method - SCROLL_INTO_VIEW of IF_WD_VIEW.

    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/cb72dcbab83376e10000000a421937/frameset.htm

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thomas,

      The second one (SCROLL_INTO_VIEW) did not work for me. The scrollbars moved up to the position i wanted for about half a second, but then they moved down again to the original place. It seems that there is a kind of implicit SCROLL_INTO_VIEW by the webDynpro Framework after my code was executed.

      The first one (REQUEST_FOCUS_ON_VIEW_ELEM) works in some cases, and in others not. Even if I do the same thing in my application several times, sometimes the focus is set correctly, and sometimes not. Strange.

      (there is no message or anything else in this case).

      Thx and best regards,

      Daniel