Friday, July 29, 2011

Avoid Refresh Table Display Moving Cursor to First Line

If you are making some changes in the ALV Output and refresh the ALV display using the method “REFRESH_TABLE_DISPLAY” the chances are it will go to the first line, unless you call the refresh table display with the parameters. Use the below code to make the ALV stick to the current row even though you refresh it.

DATA ls_stable TYPE lvc_s_stbl.
ls_stable-row = 'X'.
ls_stable-col = 'X'.
CALL METHOD gr_alvgrid->refresh_table_display
      EXPORTING
        is_stable = ls_stable
      EXCEPTIONS
        finished  = 1
        OTHERS    = 2.
IF sy-subrc <> 0.
ENDIF.

Thursday, July 28, 2011

Clear Selection Screen

After the report execution when user press 'Back' button the selection-screen is displayed with the values entered in first place. If you want the selection-screen to be all clear then add following lines of code at the end of END-OF-SELECTION event.

FIELD-SYMBOLS : <fs>  .
ASSIGN ('(RSDBRUNT)MEMKEY-INT_MODE') TO <fs> .
IF sy-subrc = 0 .
  <FS> = '01' .
ENDIF.

Why Too Much ABAP???

 Has ABAP been too much??  No not really... Its just a name... After so many years of me learning ABAP which I still continue to learn, this is just a place to consolidate my learnings.

This place is dedicated for SAP ABAP Tips and Tricks which I come across during my data to day work or while browsing different websites or forums.

I always wanted to collect the tips and tricks and document it so that I can refer it whenever and wherever I want. Hence thot to put it into a blog so that people who are interested can also go through it.

I am sure these tips and tricks may be found somewhere else but this place is something for me and my readers. Well this is not a one stop solution but its an effort to share knowledge across the SAP community.

Hope people enjoy these.