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: 

i want use I_callback_pf_status_set parameter in REUSE_ALV_LIST_DISPLAY.

sureshkumar_pnv
Participant
0 Kudos

i want use I_callback_pf_status_set parameter in REUSE_ALV_LIST_DISPLAY. how can i use it? can any one can give me one simple example.

6 REPLIES 6

Former Member
0 Kudos

Try this code:

*&---------------------------------------------------------------------*
*&      Form  ALV_REPORT_DISPLAY_LIST
*&---------------------------------------------------------------------*
* Function call to display final internal table data in ALV Grid
*----------------------------------------------------------------------*
*  -->  i_OUTTAB    (Final Internal table)
*----------------------------------------------------------------------*
form alv_report_display_list  using i_outtab type standard table.

* Function to display ALV List using the final output Int table
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'ZSTATUS'
      i_callback_user_command  = gv_usr_cmd
      is_layout                = gs_layout
      it_fieldcat              = gt_fieldcat
      it_excluding             = gt_excl
      it_special_groups        = gt_spl_grps
      it_sort                  = gt_sort
      it_filter                = gt_filter
      i_default                = 'X'
      i_save                   = 'U'
      is_variant               = gs_variant
      it_events                = gt_events
      it_event_exit            = gt_event_exit
      is_print                 = gs_print
    tables
      t_outtab                 = i_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.                    " alv_report_display_list

*&---------------------------------------------------------------------*
*&      Form  zstatus
*&---------------------------------------------------------------------*
*      Set PF
*----------------------------------------------------------------------*

form zstatus using extab type slis_t_extab.                 "#EC CALLED
  set pf-status 'ZSTAT'.
  refresh extab[].
endform.                    " zstatus

When you set a PF status by the command Set pf-status.. double click on it to create the PF-status and make changes as you want.

Reward points boss,

Thank you..

Rahul

Former Member
0 Kudos

Hi Suresh,

Events can pass to ALV Fm in two ways. Either directly or by built an internal table for events. In both the cases we have to declare routine for events. In that event declare set pf-status 'XXX'. Prepare that menu painter.

Regards,

Kumar.

Former Member
0 Kudos

Hi,

Have a look on the following

TYPE-POOLS: SLIS.

TYPES: BEGIN OF I_MARA,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MEINS LIKE MARA-MEINS,

GROES LIKE MARA-GROES,

VOLUM LIKE MARA-VOLUM,

END OF I_MARA.

DATA: IT_MARA TYPE STANDARD TABLE OF I_MARA INITIAL SIZE 0.

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

REPID TYPE SY-REPID,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BLD_FLDCAT.

PERFORM BLD_LAYOUT.

PERFORM DISPLAY_ALV_REPORT.

FORM BLD_FLDCAT.

FLDCAT-FIELDNAME = 'MATNR'.

FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.

FLDCAT-COL_POS = 0.

FLDCAT-KEY = 'X'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'MTART'.

FLDCAT-SELTEXT_M = 'MATERIAL TYPE'.

FLDCAT-COL_POS = 1.

FLDCAT-KEY = 'X'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'MEINS'.

FLDCAT-SELTEXT_M = 'UNIT OF MEASURE'.

FLDCAT-COL_POS = 2.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'GROES'.

FLDCAT-SELTEXT_M = 'SIZE'.

FLDCAT-COL_POS = 3.

FLDCAT-KEY = 'X'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VOLUM'.

FLDCAT-SELTEXT_M = 'VOLUME'.

FLDCAT-COL_POS = 4.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

ENDFORM.

FORM BLD_LAYOUT.

GD_LAYOUT-NO_INPUT = 'X'.

GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

GD_LAYOUT-ZEBRA = 'X'.

GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.

ENDFORM.

FORM DISPLAY_ALV_REPORT.

REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_PF_STATUS_SET = 'STANDARD'

I_CALLBACK_USER_COMMAND = 'USER-COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

IS_LAYOUT = GD_LAYOUT

IT_FIELDCAT = FLDCAT[]

I_SAVE = 'X'

TABLES

T_OUTTAB = IT_MARA

  • 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 DATA_RETRIEVAL.

SELECT MATNR MTART MEINS GROES VOLUM

INTO TABLE IT_MARA FROM MARA

UP TO 40 ROWS.

ENDFORM.

FORM TOP_OF_PAGE.

DATA: T_HEADER TYPE SLIS_T_LISTHEADER,

WA_HEADER TYPE SLIS_LISTHEADER.

WA_HEADER-TYP = 'H'.

WA_HEADER-INFO = 'THIS IS MY FIRST ALV'.

APPEND WA_HEADER TO T_HEADER.

WA_HEADER-TYP = 'S'.

WA_HEADER-INFO = 'THIS IS SECOND'.

APPEND WA_HEADER TO T_HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_HEADER

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM.

FORM STANDARD USING EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'STANDA02' EXCLUDING EXTAB.

ENDFORM.

FORM USER-COMMAND USING R_COMM TYPE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_COMM.

WHEN 'F3'.

LEAVE PROGRAM.

ENDCASE.

ENDFORM.

Double click on “STANDA02”, it opens new screen(menu painter),there u can add menu bars, application tool bars etc.

Reward,if useful.

Thanks,

Chandu

Former Member
0 Kudos

Hi!

There is a special parameter for function module REUSE_ALV_GRID_DISPLAY, which lets you to define a callback function for setting pf-status. (If you are not familiar with callback functions, please let me know. I will be glad to explain in detail). An example usage could be as follows:

.
.
.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    .
    .
    .
    I_CALLBACK_PF_STATUS_SET = 'GRID1_SET_PF_STATUS'
    .
    .
    .

FORM GRID1_SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'SPF'.
ENDFORM.

I assumed your status is called SPF in this example. This is just a fragment for not making the reading complicated but if you wish, I can provide full source code.

Best regards

Former Member
0 Kudos

This message was moderated.