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: 

refreshing ALV made from REUSE_ALV_LIST_DISPLAY,

Former Member
0 Kudos
form make_alv.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
*    I_STRUCTURE_NAME               = 'VBAK'
      i_callback_program             = i_repid
      i_callback_pf_status_set       = g_status
      i_callback_user_command  = g_user_command
      it_fieldcat              = gt_fieldcat_s
      it_events               = gt_events[]
      it_sort                  = it_sort[]
      is_layout                = gs_layout_1301
    TABLES
      t_outtab                       = itab_init[]
     EXCEPTIONS
       program_error                  = 1
       OTHERS                         = 2
            .
endform.

i am calling my above user routine when a user has pressed F8 on a selection screen. clicking on the row of this alv is running a BDC and creating a PO number thru ME27. one of the col of my alv is this PO number.

now my bdc message table is having this number and i hav updated the itab_init[] table.

<b>so for so good.</b>

now ofcourse this alv will not show the po number. so in the end of bdc i am doing:

perform make_alv.

<u>but this is creating another ALV on the top of last ALV. (using back button confirms this behavior, it takes 2 back click to reach to my sel screen)</u>

<b>Experts! suggest a neat way to refresh the ALV.</b>

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi Flora,

are you using selfield-refresh = 'X'.

if not then call the routine this way..

FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
case sy-ucom.
when 'F8'...
...
endcase.

selfield-refresh = 'X'.
endform.

10 REPLIES 10

Former Member
0 Kudos

instead of calling again alv to display PO number ,

either you can use MESSAGE with Information or POPUP function module to display it.

got it ??

regards,

srikanth

former_member188685
Active Contributor
0 Kudos

Hi Flora,

are you using selfield-refresh = 'X'.

if not then call the routine this way..

FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
case sy-ucom.
when 'F8'...
...
endcase.

selfield-refresh = 'X'.
endform.

0 Kudos

Hi <b>Vijay</b> Babu Dudla,

U r soln did worked (and u r rewarded), but only after i read ur soln 3 times and after doing lots of RnD in the direction u hav shown me.

<b>thanks amit</b> for all your effort, the block ALV concept is unheard in my part of world. : )

so thanks that u hav pointed something new to explore.

In my case the <i>trick</i> was to add a button on the gui status with code say 'RFSH' and whereever u want to refresh call this line:

set user-command 'RFSH'

and then ofcourse as Vijay sirji suggested

  CASE r_ucomm.
    WHEN  '&RFSH'.
      rs_selfield-refresh = 'X'.
      .
      .
      .
.

0 Kudos

Hi Flora,

Great Job.

regards

Vijay

0 Kudos

any light on the BDC problem:

0 Kudos

Hi flora,

its not working for me.

i am setting the value rs_selfield-refresh = 'X'. But its generating another ALV. so when i click "Back" it goes to the previous ALV. (though it is refreshed, i want to have only one alv, there should not more than one instance)

Can you please, help me ?

Tapan

0 Kudos

Another simple way to do it is to change your ucomm as follows.

move '&REFRESH' to ucomm.

In your user command routine, after your case statement, simply add this line.

0 Kudos

THANK YOU Vijay,

great Tip!!!

you save me a lot of time and work!

kind regards

Andreas

Former Member
0 Kudos

Hi Flora,

1. I tried but could not find any facility

for such REFRESH (without new screen)

2. One thing we can use is :

REUSE_ALV_BLOCK_LIST_REFRESH

It works FANTASTIC.

3. For This we need to use BLOCK ALV Concept

(only one alv we will use)

3 FM are required (very simple to use)

4. This way we can achieve what u want.

5. In Call back Form. ie.

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE slis_selfield.

*--- bdc code

*--- etc

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_REFRESH'

.

ENDFORM. "itab_user_command

5. Sample coding for block alv (3 FM) reference purpose

*----


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = prg

  • I_CALLBACK_PF_STATUS_SET = ' '

i_callback_user_command = 'ITAB_USER_COMMAND'

  • IT_EXCLUDING =

.

*----


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = alvly

it_fieldcat = alvfc

i_tabname = 'ITAB'

it_events = alvev

  • IT_SORT =

  • I_TEXT = ' '

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

*----


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

i_interface_check = ' '

  • is_print = alvprt

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

EXCEPTIONS

program_error = 1

OTHERS = 2.

I hope it helps.

U can go for this block alv concept

if u don't find any other solution.

Regards,

Amit M.

Message was edited by: Amit Mittal

Former Member
0 Kudos

I know this question has already been answered. But there is another way of doing it.


field-symbols <g_grid> TYPE REF TO CL_GUI_ALV_GRID.

FORM user_command USING r_ucomm LIKE sy-ucomm   
                     rs_selfield TYPE slis_selfield. 
l_fld = '(SAPLSLVC_FULLSCREEN)GT_GRID-GRID'.
  assign  (l_fld) to <g_grid>.
  CALL METHOD <G_GRID>->REFRESH_TABLE_DISPLAY.

  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.