Application Development and Automation 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: 
Read only

alv output problem

Former Member
0 Likes
619

I have alv output with some values, now I need to put a push button on application tool bar if I change any values in the out put and then press that push button then the new values should be updated with out re execution of the alv program . how to do it.

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
571

Hi Kiran, <li> The below code is more than enough. It works for your requirement. <li>Define events

DATA: it_events TYPE slis_t_event,
           wa_event like line of it_events.
<li>Fill events like below.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'PF_STATUS_SET'.
append wa_events to it_events.
clear   wa_events.
wa_events-name = 'USER_COMMAND'.
wa_events-form =  'USER_COMMAND'.
append wa_events to it_events.
clear   wa_events.
<li>Set pf status like below.

FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
 SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
"When you set pf-status using above statement, you dont see ALV toolbar. To get back all the tools copy status of the any "program status which is using ALV in SE41 transaction code to your program with status you mentioned here.
"Program :SAPLKKBL
"status    :STANDARD_FULLSCREEN
ENDFORM.
<li>Use USER_COMMAND event like below

*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
 FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
  IF R_UCOMM = 'REFRESH'."Create one button on ALV toolbar with function code REFRESH
    RS_SELFIELD-REFRESH = 'X'. "Set this one. It refreshes internal table data with new values
  ENDIF.
ENDFORM.                    "USER_COMMAND
<li>Call function module like below

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
              i_callback_program = program
              it_fieldcat        = it_fieldcat
              it_events          = it_events
         TABLES
              t_outtab           = i_mard.
Let me know if you have any problem. Thanks Venkat.O

5 REPLIES 5
Read only

Former Member
Read only

Former Member
0 Likes
571

there is event called DATA_CHANGED

search SDN, there are a lot of post related to this.

but DATA_CHANGED is triggered only byF8(refresh) button.

you can also call the data changed event from USER_COMMAND event.

Read only

Former Member
0 Likes
571

Hi Kiran,

Please check below link:

[http://www.sapalv.net/2009/08/sap-alv-tutorial-8-handling-data-change/]

Regards,

Andy

[www.sapgeek.net]

Read only

venkat_o
Active Contributor
0 Likes
572

Hi Kiran, <li> The below code is more than enough. It works for your requirement. <li>Define events

DATA: it_events TYPE slis_t_event,
           wa_event like line of it_events.
<li>Fill events like below.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'PF_STATUS_SET'.
append wa_events to it_events.
clear   wa_events.
wa_events-name = 'USER_COMMAND'.
wa_events-form =  'USER_COMMAND'.
append wa_events to it_events.
clear   wa_events.
<li>Set pf status like below.

FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
 SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
"When you set pf-status using above statement, you dont see ALV toolbar. To get back all the tools copy status of the any "program status which is using ALV in SE41 transaction code to your program with status you mentioned here.
"Program :SAPLKKBL
"status    :STANDARD_FULLSCREEN
ENDFORM.
<li>Use USER_COMMAND event like below

*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
 FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
  IF R_UCOMM = 'REFRESH'."Create one button on ALV toolbar with function code REFRESH
    RS_SELFIELD-REFRESH = 'X'. "Set this one. It refreshes internal table data with new values
  ENDIF.
ENDFORM.                    "USER_COMMAND
<li>Call function module like below

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
              i_callback_program = program
              it_fieldcat        = it_fieldcat
              it_events          = it_events
         TABLES
              t_outtab           = i_mard.
Let me know if you have any problem. Thanks Venkat.O

Read only

Former Member
0 Likes
571

thank u very much it was very sweet and simple solution , i was worried about classes and all that u have made it simple

thank u very much venkat