Skip to Content
avatar image
Former Member

ALV

Hi,

Can anyone tell me the significane of I_CALLBACK_PF_STATUS_SET and I_CALLBACK_USER_COMMAND in the FM REUSE_ALV_GRID_DISPLAY. Can we pass the PF status to this FM??

Regards,

Ganesh Prasanna

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Apr 25, 2006 at 07:18 PM

    In I_CALLBACK_PF_STATUS_SET you can pass a FORM routine, in that routine you can set PF-STATUS.

    In the other parameter you can specify a FORM routine where you can handle user actions in ALV report.

    Examples:

    FORM status USING extab TYPE slis_t_extab.

    SET PF-STATUS 'STATUS' EXCLUDING extab.

    ENDFORM. "STATUS

    FORM user_command USING l_ucomm ls_selfield TYPE slis_selfield.

    CASE ls_selfield-fieldname.

    WHEN 'OBJ_NAME'.

    SET PARAMETER ID 'MON' FIELD t_salida-obj_name.

    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

    WHEN 'NOMBRE_PROJ'.

    CALL TRANSACTION 'CMOD' AND SKIP FIRST SCREEN.

    ENDCASE.

    ENDFORM.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 25, 2006 at 07:41 PM

    Hi,

    Sample exmaple for I_CALLBACK_PF_STATUS_SET

    - <i>Create your status GUI as copy of std gui</i> STANDARD_FULLSCREEN of program SAPLKKBL;

    - Insert your new push button;

    - Create a routine to call your bar:

    FORM set_pf_status USING rt_extab TYPE slis_t_extab

    SET PF-STATUS 'MY_ALV_BAR' EXCLUDING rt_extab.

    ENDFORM.

    - <i>Create e routine to manage your commands:</i>

    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    CASE R_UCOMM.

    WHEN 'XXXX'........

    ENDCASE.

    ENDFORM.

    - Transfers these routines to ALV fm:

    GT_REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = GT_REPID

    <b>I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'</b>

    i_callback_user_command = 'USER_COMMAND'

    Thanks,

    Pramod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 25, 2006 at 07:19 PM

    Hi Ganesh,

    You can pass your own PF-status & User commands for the ALV.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    I_CALLBACK_PF_STATUS_SET = 'FRM_PF_STATUS'

    i_callback_user_command = 'USER_COMMAND'

    is_layout = Gs_layout

    it_fieldcat = Gt_fieldcat

    it_sort = Gt_sort

    IT_EVENTS = GT_EVENTS[]

    TABLES

    t_outtab = ITAB.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 25, 2006 at 07:27 PM

    Hi,

    You can check Funciton Module Documentaion in SE37.

    There is nice documentation over there.

    Thanks,

    Pramod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 25, 2006 at 07:36 PM

    Hi,

    Example program:

    REPORT ZUP_alv_Dobule_click .

    *Purchasing Document Header

    TABLES: ekko.

    TYPE-POOLS: slis. "ALV Declarations

    *Data Declaration

    *----


    TYPES: BEGIN OF t_ekko,

    ebeln TYPE ekpo-ebeln,

    ebelp TYPE ekpo-ebelp,

    statu TYPE ekpo-statu,

    aedat TYPE ekpo-aedat,

    matnr TYPE ekpo-matnr,

    menge TYPE ekpo-menge,

    meins TYPE ekpo-meins,

    netpr TYPE ekpo-netpr,

    peinh TYPE ekpo-peinh,

    END OF t_ekko.

    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

    wa_ekko TYPE t_ekko.

    *ALV data declarations

    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

    gd_repid LIKE sy-repid.

    ************************************************************************

    *Start-of-selection.

    START-OF-SELECTION.

    PERFORM data_retrieval.

    PERFORM build_fieldcatalog.

    PERFORM display_alv_report.

    &----


    *& Form BUILD_FIELDCATALOG

    &----


    • Build Fieldcatalog for ALV Report

    ----


    FORM build_fieldcatalog.

    fieldcatalog-fieldname = 'EBELN'.

    fieldcatalog-seltext_m = 'Purchase Order'.

    fieldcatalog-col_pos = 0.

    fieldcatalog-outputlen = 10.

    fieldcatalog-emphasize = 'X'.

    fieldcatalog-key = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'EBELP'.

    fieldcatalog-seltext_m = 'PO Item'.

    fieldcatalog-col_pos = 1.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'STATU'.

    fieldcatalog-seltext_m = 'Status'.

    fieldcatalog-col_pos = 2.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'AEDAT'.

    fieldcatalog-seltext_m = 'Item change date'.

    fieldcatalog-col_pos = 3.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MATNR'.

    fieldcatalog-seltext_m = 'Material Number'.

    fieldcatalog-col_pos = 4.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MENGE'.

    fieldcatalog-seltext_m = 'PO quantity'.

    fieldcatalog-col_pos = 5.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MEINS'.

    fieldcatalog-seltext_m = 'Order Unit'.

    fieldcatalog-col_pos = 6.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'NETPR'.

    fieldcatalog-seltext_m = 'Net Price'.

    fieldcatalog-col_pos = 7.

    fieldcatalog-outputlen = 15.

    fieldcatalog-datatype = 'CURR'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'PEINH'.

    fieldcatalog-seltext_m = 'Price Unit'.

    fieldcatalog-col_pos = 8.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    ENDFORM. " BUILD_FIELDCATALOG

    &----


    *& Form DISPLAY_ALV_REPORT

    &----


    • Display report using ALV grid

    ----


    FORM display_alv_report.

    gd_repid = sy-repid.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = gd_repid

    <b>i_callback_user_command = 'HANDLE_ALV_UCOMM'</b>

    it_fieldcat = fieldcatalog[]

    i_save = 'X'

    TABLES

    t_outtab = it_ekko

    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. " DISPLAY_ALV_REPORT

    &----


    *& Form DATA_RETRIEVAL

    &----


    • Retrieve data form EKPO table and populate itab it_ekko

    ----


    FORM data_retrieval.

    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh

    UP TO 9 ROWS INTO TABLE it_ekko

    FROM ekpo." WHERE MATNR = 'CH 01'.

    ENDFORM. " DATA_RETRIEVAL

    &----


    *& Form HANDLE_ALV_UCOMM

    &----


    • text

    ----


    • -->R_UCOMM text

    • -->RS_SELFIELDtext

    ----


    <b>FORM handle_alv_ucomm USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

    slis_selfield.

    DATA : mess TYPE string, index(4) TYPE n.

    DATA wa TYPE t_ekko.

    index = rs_selfield-tabindex.

    READ TABLE it_ekko INTO wa INDEX index.

    SET PARAMETER ID : 'BES' FIELD wa-ebeln.

    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

    CLEAR INDEX.

    ENDFORM. "HANDLE_ALV_UCOMM</b>

    Thanks,

    Pramod

    Add comment
    10|10000 characters needed characters exceeded