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 Reuse_alv_grid_display

Former Member
0 Kudos
177

Hi ,

I am running a small report.

Now i enter some values on the selection screen.

And the results i am able to display in an ALV using the FM Reuse_alv_grid_display.

I am trying to have a Push Button & i have added the following code in my program.

REPORT Z_TABLE_UPLOAD.

SET PF-STATUS 'XYZ'.

LL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = WA_FIELD

I_GRID_TITLE = 'ZTDA DETAILS'

I_CALLBACK_PF_STATUS_SET = 'XYZ'

TABLES

T_OUTTAB = IT_ZTDA[]

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

I have added a push button in XYZ.

But i am not getting any push button in the application toolbar.

pls suggest.

regards,

Kevin.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
116

Thanks Marcin.

That worked.

where do i write the code if that push button is pressed.

Is that 'user_command' also name of a subroutine?

regards,

Kevin.

5 REPLIES 5

MarcinPciak
Active Contributor
0 Kudos
116

Hi,

See this code snippet:


FORM alv_display.
  DATA: l_repid TYPE sy-repid.
  l_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = l_repid
     i_callback_pf_status_set          = 'SET_PF_STATUS'   "pass subroutine name not status name here
     i_callback_user_command           = 'USER_COMMAND'
     i_callback_top_of_page            = 'TOP_OF_PAGE'
     is_layout                         = wa_alv_layout
     it_fieldcat                       = it_alv_fieldcat[]
     it_sort                           = it_alv_sortinfo[]
     i_default                         = 'X'
     i_save                            = 'A'
     it_events                         = it_alv_events[]
    TABLES
      t_outtab                          = ft_alv_outtab[]
   EXCEPTIONS
     program_error                     = 1
     OTHERS                            = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.

FORM set_pf_status USING ft_extab TYPE slis_t_extab.  "subroutine must have this signature
  SET PF-STATUS 'ALV_STATUS'.  "here you set your status
ENDFORM.                    

Regards

Marcin

Former Member
0 Kudos
116

Hi,

To avoid confusion use different names for your 'form' for pf status and for 'pfstatus'. You need to give the form name of the pf-status functionality to the function module REUSE_ALV_GRID_DISPLAY.

REPORT Z_TABLE_UPLOAD.

SET PF-STATUS 'XYZ'.

LL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = WA_FIELD
I_GRID_TITLE = 'ZTDA DETAILS'
I_CALLBACK_PF_STATUS_SET = 'XYZ'  " XYZ is the form name of pf-status
TABLES
T_OUTTAB = IT_ZTDA[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.

FORM XYZ.
     set pf-status 'PF_XYZ'. " This is the PF Status
Endform

Check the this for more info:

Former Member
0 Kudos
117

Thanks Marcin.

That worked.

where do i write the code if that push button is pressed.

Is that 'user_command' also name of a subroutine?

regards,

Kevin.

0 Kudos
116

Exactly, you got the idea!

But here the signature is like this:


FORM user_command USING f_ucomm TYPE sy-ucomm
                                          ls_selfield TYPE slis_selfield.

  IF f_ucomm = ..
...
 ENDIF.
ENDFORM.              

Regards

Marcin

Former Member
0 Kudos
116

Thanks Marcin.

That was a great help.