Skip to Content
avatar image
Former Member

ALV List Standard toolbar

How to display standard toolbar buttons in ALV which are not displayed in REUSE_ALV_GRID_DISPLAY

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    May 11, 2006 at 09:05 AM

    hii

    try this one out

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    IS_LAYOUT = LAYOUT

    IT_FIELDCAT = IT_FIELDCAT

    IT_SORT = IT_SORT

    I_CALLBACK_PF_STATUS_SET = 'STATUS'

    IT_EXCLUDING = I_FCODE_EXTAB

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    IT_EVENTS = IT_EVENTS[]

    TABLES

    T_OUTTAB = IT_VBAK.

    • 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. "GRID_DISP

    &----


    *& Form STATUS

    &----


    • text

    ----


    • -->P_EXTAB text

    ----


    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.

    ENDFORM. "STATUS

    also go thru this link

    http://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htmhttp://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htm">http://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htm>

    hope this helps

    Thanks &Regards

    Naresh

    Add comment
    10|10000 characters needed characters exceeded

  • May 11, 2006 at 09:07 AM

    Hi,

    you need to do few things...

    1. first go transaction SE41, there take any standard prgoram say SAPLKKBL, status STANDARD , now copy the status to your program using the Copy status button.

    2. now do this..

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM       = SY-REPID
        IS_LAYOUT                = L_LAYOUT
     <b>   I_CALLBACK_PF_STATUS_SET = 'STATUS'</b>
        I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
        IT_FIELDCAT              = IT_FIELDCAT
        it_events                = it_events
      TABLES
        T_OUTTAB                 = ITAB
      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.

    the Status is the one which is copied from standard program.

    3. do this,

    FORM <b>STATUS</b> USING P_EXTAB TYPE SLIS_T_EXTAB.
    *- Pf status
      SET PF-STATUS 'STATUS' excluding p_extab.
    ENDFORM.                 " STATUS

    thats all

    Regards

    vijay

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 11, 2006 at 09:11 AM

    Hi,

    First copy the pf-status 'STATUS' to your program

    and add ur own tool bar buttons.

    * Calling the FM for ALV Grid display
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM          = DG_REPID
                I_GRID_TITLE                = LV_TITLE
                <b>I_CALLBACK_PF_STATUS_SET    = 'SET_PF_STATUS'</b>
                I_CALLBACK_USER_COMMAND     = 'DISPLAY'
    *            i_callback_html_top_of_page = c_html_top_of_page
                IS_LAYOUT                   = DS_LAYOUT
                IT_FIELDCAT                 = DT_FLDCAT[]
    *            i_html_height_top           = 28
                IT_SORT                     = DT_SORT[]
                I_DEFAULT                   = C_X
                IS_VARIANT                  = DS_VAR1
                I_SAVE                      = C_SAVE  " A
                IT_EVENTS                   = DT_EVENTS[]
           TABLES
                T_OUTTAB                    = DT_FINAL
           EXCEPTIONS
                PROGRAM_ERROR               = 1
                OTHERS                      = 2.
      IF SY-SUBRC <> 0.
        MESSAGE I999 WITH
       'Error in displaying the ALV list'(146).
      ENDIF.
    
    *------------------------------------------------------------------*
    *       FORM SET_PF_STATUS                                         *
    *------------------------------------------------------------------*
    FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
    
      SET PF-STATUS 'STATUS'.
    
    ENDFORM.                    "set_pf_status
    
    

    Thanks&Regards,

    Siri.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 11, 2006 at 09:27 AM

    HI

    GOOD

    GO THROUGH THIS REPORT

    TYPE-POOLS: SLIS.

    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    FIELDCAT_LN LIKE LINE OF FIELDCAT,

    SORTCAT TYPE SLIS_T_SORTINFO_ALV,

    SORTCAT_LN LIKE LINE OF SORTCAT,

    EVENTCAT TYPE SLIS_T_EVENT,

    EVENTCAT_LN LIKE LINE OF EVENTCAT,

    LAYOUT TYPE SLIS_LAYOUT_ALV,

    C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

    W_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

    DATA: COL_POS TYPE I,

    P_LIGNAM TYPE SLIS_FIELDNAME VALUE 'STATUS'.

    ******Declare Data Areas for List Viewer (End)**************

    • Other Variables

    DATA: W_DATUM(10) TYPE C. "Convert system Date for Output

    ******Declare Internal Table to Store Selected Data (Begin)*

    DATA: BEGIN OF IREPO OCCURS 0,

    EQUNR LIKE EQUI-EQUNR,

    EQKTX LIKE EQKT-EQKTX, "description

    ERDAT LIKE EQUI-ERDAT,

    ERNAM LIKE EQUI-ERNAM,

    AEDAT LIKE EQUI-AEDAT,

    AENAM LIKE EQUI-AENAM,

    EQART LIKE EQUI-EQART,

    INBDT LIKE EQUI-INBDT,

    ZZ_DESPATCH LIKE EQUI-ZZ_DESPATCH,

    ( ten million other Z fields)

    VKBUR LIKE ILOA-VKBUR, "Sales Office

    SWERK LIKE ILOA-SWERK, "Base Plant

    KOSTL LIKE ILOA-KOSTL, "Cost Centre

    ANLNR LIKE ITOB-ANLNR, "Asset Number

    NAME1 LIKE LFA1-NAME1, "Haulier name

    STATUS TYPE C, "Is it flagged for deletion?

    END OF IREPO.

    • Table for descriptions

    DATA: BEGIN OF IEQKT OCCURS 0,

    EQUNR LIKE EQKT-EQUNR,

    EQKTX LIKE EQKT-EQKTX,

    END OF IEQKT.

    • LOD Names - Internal Buffering

    DATA: BEGIN OF VENDLIST OCCURS 0,

    LIFNR LIKE LFA1-LIFNR, "Vendor Number

    NAME1 LIKE LFA1-NAME1, "Vendor Name

    END OF VENDLIST.

    ******Declare Internal Table to Store Selected Data (End)**

    TABLES: EQUI,ILOA.

    *******Selection Screen

    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.

    SELECT-OPTIONS: P_EQUNR FOR EQUI-EQUNR, "Fleet Number

    P_PLATE FOR EQUI-ZZ_PLATE_NO, "Registration

    P_EQART FOR EQUI-EQART. "Truck Type

    PARAMETER: EXCLUDE AS CHECKBOX. "Exclude Deleted Trucks

    SELECTION-SCREEN END OF BLOCK BLK1.

    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.

    SELECT-OPTIONS: P_DESPG FOR EQUI-ZZ_DESPATCH, "Dgroup

    P_VKBUR FOR ILOA-VKBUR, "Sales Office

    P_SWERK FOR ILOA-SWERK. "Plant

    SELECTION-SCREEN END OF BLOCK BLK2.

    SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-003.

    SELECT-OPTIONS: P_HAULER FOR EQUI-ZZ_HAULER. "Haulier Vendor

    SELECTION-SCREEN END OF BLOCK BLK3.

    *******Select Data into Internal Table (Begin) ***************

    START-OF-SELECTION.

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Reading Truck Master Table' .

    SELECT EQUIEQUNR EQUIEQART EQUIERNAM EQUIERDAT EQUI~AENAM

    EQUIAEDAT EQUIINBDT

    EQUI~ZZ_DESPATCH

    ( ten million custom Z fields )

    EQUI~ZZ_TIMEZONE

    ILOAVKBUR ILOASWERK ILOA~KOSTL

    INTO CORRESPONDING FIELDS OF TABLE IREPO

    FROM ( EQUI INNER JOIN EQUZ ON

    EQUIEQUNR = EQUZEQUNR )

    INNER JOIN ILOA ON

    EQUZILOAN = ILOAILOAN

    WHERE EQUI~EQUNR IN P_EQUNR "Fleet Number

    AND EQUI~EQART IN P_EQART "Truck Type

    AND EQUI~ZZ_PLATE_NO IN P_PLATE "Registration

    AND EQUI~ZZ_DESPATCH IN P_DESPG "Despatch Group

    AND EQUI~ZZ_HAULER IN P_HAULER"Vendor

    AND ILOA~SWERK IN P_SWERK "Plant

    AND ILOA~VKBUR IN P_VKBUR."Sales Office

    • If successful go and get the descriptions

    IF SY-SUBRC EQ 0.

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Reading Descriptions' .

    SELECT EQUNR EQKTX FROM EQKT

    INTO CORRESPONDING FIELDS OF TABLE IEQKT

    FOR ALL ENTRIES IN IREPO

    WHERE EQUNR = IREPO-EQUNR

    AND SPRAS = 'EN'.

    SORT IEQKT BY EQUNR.

    ENDIF.

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Check For Deletion Flags' .

    DATA: L_EQUNR LIKE EQUI-EQUNR,

    L_OBJNR LIKE JEST-OBJNR.

    LOOP AT IREPO.

    CONCATENATE 'IE' IREPO-EQUNR INTO L_OBJNR.

    • Start off by saying that the Truck is OK

    IREPO-STATUS = '3'.

    • Now see if the Truck has been flagged as Inactive e.g. under repair

    PERFORM STATUS_CHECK USING L_OBJNR 'I0320'.

    IF SY-SUBRC EQ 0.

    IREPO-STATUS = '2'. "It's inactive

    ENDIF.

    • Now see if the Truck has been flagged for deletion.

    PERFORM STATUS_CHECK USING L_OBJNR 'I0076'.

    IF SY-SUBRC EQ 0.

    IREPO-STATUS = '1'. "It's deleted

    ENDIF.

    MODIFY IREPO.

    CLEAR IREPO.

    ENDLOOP.

    • If exclude is chosen lose deleted items

    IF EXCLUDE = 'X'.

    DELETE IREPO WHERE STATUS = '1'.

    ENDIF.

    • Final processing

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = 'Prepare Data for Display' .

    SORT IREPO BY EQUNR.

    LOOP AT IREPO.

    • Get Description of Truck

    READ TABLE IEQKT WITH KEY EQUNR = IREPO-EQUNR BINARY SEARCH.

    IF SY-SUBRC EQ 0.

    IREPO-EQKTX = IEQKT-EQKTX.

    ELSE.

    IREPO-EQKTX = 'No Description in Truck Master'.

    ENDIF.

    • Get Name of Owner

    READ TABLE VENDLIST WITH KEY LIFNR = IREPO-ZZ_HAULER BINARY SEARCH.

    IF SY-SUBRC NE 0.

    SELECT SINGLE NAME1 FROM LFA1 INTO IREPO-NAME1

    WHERE LIFNR = IREPO-ZZ_HAULER.

    VENDLIST-LIFNR = IREPO-ZZ_HAULER.

    VENDLIST-NAME1 = IREPO-NAME1.

    APPEND VENDLIST.

    SORT VENDLIST BY LIFNR.

    ELSE.

    IREPO-NAME1 = VENDLIST-NAME1.

    ENDIF.

    MODIFY IREPO.

    CLEAR IREPO.

    ENDLOOP.

    END-OF-SELECTION.

    • Select Data into Internal Table (End) ****************

    • Build Field Catalogs (Begin)**************************

    • Fields with Standard Names

    PERFORM RESETVALUES.

    PERFORM ADDFIELD USING '1' 'EQUI' 'STATUS'. "Traffic Lights

    FIELDCAT_LN-HOTSPOT = 'X'.

    FIELDCAT_LN-KEY = 'X'.

    PERFORM ADDFIELD USING '2' 'EQUI' 'EQUNR'. "Fleet Number

    PERFORM ADDFIELD USING '3' 'EQKT' 'EQKTX'. "Description

    PERFORM ADDFIELD USING '4' 'EQUI' 'ZZ_PLATE_NO'.

    PERFORM ADDFIELD USING '5' 'EQUI' 'EQART'.

    PERFORM ADDFIELD USING '6' 'ILOA' 'SWERK'.

    PERFORM ADDFIELD USING '8' 'ILOA' 'KOSTL'.

    PERFORM ADDFIELD USING '9' 'EQUI' 'ZZ_MINLOADSIZE'.

    PERFORM HIDFIELD USING '10' 'EQUI' 'ERNAM'.

    PERFORM HIDFIELD USING '11' 'EQUI' 'AEDAT'.

    PERFORM HIDFIELD USING '12' 'EQUI' 'AENAM'.

    PERFORM HIDFIELD USING '13' 'EQUI' 'INBDT'.

    ( ten million custom Z fields )

    PERFORM HIDFIELD USING '56' 'EQUI' 'ZZ_TIMEZONE'.

    PERFORM HIDFIELD USING '57' 'ILOA' 'VKBUR'.

    PERFORM HIDFIELD USING '58' 'EQUI' 'ZZ_HAULER'.

    PERFORM HIDFIELD USING '59' 'EQUI' 'ERDAT'.

    • Fields with Custom Names

    PERFORM NEWNAME USING 'Haulier Name'.

    FIELDCAT_LN-OUTPUTLEN = '20'.

    PERFORM ADDFIELD USING '7' 'LFA1' 'NAME1'. "Haulier Vendor Name

    PERFORM NEWNAME USING 'Tare Time'.

    PERFORM HIDFIELD USING '54' 'EQUI' 'ZZ_TARE_TIME'.

    PERFORM NEWNAME USING 'Trailer 1'.

    PERFORM HIDFIELD USING '19' 'EQUI' 'ZZ_TRAILER1'.

    PERFORM NEWNAME USING 'Trailer 2'.

    PERFORM HIDFIELD USING '20' 'EQUI' 'ZZ_TRAILER2'.

    PERFORM NEWNAME USING 'Trailer 3'.

    PERFORM HIDFIELD USING '21' 'EQUI' 'ZZ_TRAILER3'.

    • Sort Criteria

    PERFORM BUILD_SORTCAT.

    ******Build Event Catalog (Begin)****************************

    PERFORM BUILD_EVENTCAT.

    • Magic box for selection criteria & traffic lights for truck status

    PERFORM BUILD_LAYOUT.

    ********Add a header at the top of the report *******

    PERFORM SET_REPORT_HEADER USING W_LIST_TOP_OF_PAGE[].

    ********Start List Viewer

    PERFORM START_LIST_VIEWER.

    ******Start List Viewer (End)********************************

    ********FORM ROUTINES (Begin)********************************

    • Start Values for ALV Field Catalouge

    FORM RESETVALUES.

    FIELDCAT_LN-KEY = SPACE.

    FIELDCAT_LN-DO_SUM = SPACE.

    FIELDCAT_LN-NO_OUT = SPACE.

    FIELDCAT_LN-QFIELDNAME = SPACE.

    FIELDCAT_LN-HOTSPOT = SPACE.

    FIELDCAT_LN-OUTPUTLEN = '0'.

    CLEAR: fieldcat_ln-seltext_l, fieldcat_ln-seltext_m,

    fieldcat_ln-seltext_s, fieldcat_ln-reptext_ddic.

    ENDFORM.

    • Change key values for additional fields

    FORM ADDFIELD USING POSITION TABLE_VALUE FIELD_VALUE.

    FIELDCAT_LN-REF_TABNAME = TABLE_VALUE .

    FIELDCAT_LN-FIELDNAME = FIELD_VALUE.

    FIELDCAT_LN-COL_POS = POSITION.

    APPEND FIELDCAT_LN TO FIELDCAT.

    PERFORM RESETVALUES.

    ENDFORM.

    FORM HIDFIELD USING POSITION TABLE_VALUE FIELD_VALUE.

    FIELDCAT_LN-NO_OUT = 'X'.

    FIELDCAT_LN-REF_TABNAME = TABLE_VALUE .

    FIELDCAT_LN-FIELDNAME = FIELD_VALUE.

    FIELDCAT_LN-COL_POS = POSITION.

    APPEND FIELDCAT_LN TO FIELDCAT.

    PERFORM RESETVALUES.

    ENDFORM.

    FORM NEWNAME USING NAME.

    FIELDCAT_LN-SELTEXT_L = NAME..

    FIELDCAT_LN-SELTEXT_M = NAME.

    FIELDCAT_LN-SELTEXT_S = NAME.

    FIELDCAT_LN-REPTEXT_DDIC = NAME.

    FIELDCAT_LN-OUTPUTLEN = '10'.

    ENDFORM.

    • Sort Criteria

    FORM BUILD_SORTCAT.

    SORTCAT_LN-SPOS = '1'.

    SORTCAT_LN-FIELDNAME = 'EQUNR'. "Truck Number

    SORTCAT_LN-UP = 'X'.

    SORTCAT_LN-DOWN = SPACE.

    SORTCAT_LN-SUBTOT = SPACE.

    APPEND SORTCAT_LN TO SORTCAT.

    ENDFORM.

    FORM BUILD_EVENTCAT.

    EVENTCAT_LN-NAME = C_TOP_OF_PAGE.

    EVENTCAT_LN-FORM = C_TOP_OF_PAGE.

    APPEND EVENTCAT_LN TO EVENTCAT.

    ENDFORM. " BUILD_EVENTCAT

    • Add an extra button to get an extra button the user can press to

    • see what selection criteria they entered

    • This info will then appear when the report is printed

    FORM BUILD_LAYOUT.

    LAYOUT-GET_SELINFOS = 'X'.

    • Now we want a traffic light to say if the Truck is deleted

    • the variable p_lignam contains the name in IREPO which stores the

    • value for the traffic light

    LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.

    LAYOUT-LIGHTS_CONDENSE = 'X'.

    ENDFORM.

    • Invoke a custom status (toolbar) in case we want to add any extra

    • icons at a later date

    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'STAND' EXCLUDING EXTAB.

    ENDFORM.

    FORM START_LIST_VIEWER.

    DATA: PGM LIKE SY-REPID.

    PGM = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = PGM

    I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    IS_LAYOUT = LAYOUT

    IT_FIELDCAT = FIELDCAT

    IT_SORT = SORTCAT

    I_SAVE = 'A'

    IT_EVENTS = EVENTCAT[]

    TABLES

    T_OUTTAB = IREPO

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    ENDFORM.

    *******Process Call Back Events (Begin)**************************

    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM

    SELFIELD TYPE SLIS_SELFIELD.

    READ TABLE IREPO INDEX SELFIELD-TABINDEX.

    CHECK SY-SUBRC = 0.

    CASE UCOMM.

    WHEN '&IC1'.

    CASE SELFIELD-SEL_TAB_FIELD.

    WHEN 'IREPO-EQUNR'.

    • Set Parameter ID and call ZTM3

    • Custom transaction to view Trucks

    SET PARAMETER ID 'EQN' FIELD IREPO-EQUNR.

    CALL TRANSACTION 'ZTM3' AND SKIP FIRST SCREEN.

    ENDCASE.

    ENDCASE.

    ENDFORM.

    *******Process Call Back Events (End)*****************************

    • Routine to print out user at the top

    FORM SET_REPORT_HEADER USING LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

    DATA: LS_LINE TYPE SLIS_LISTHEADER.

    PERFORM CONVERT_DATE.

    CLEAR LS_LINE.

    LS_LINE-TYP = 'H'.

    LS_LINE-INFO = 'ZT01 : Truck Master Data Report'.

    APPEND LS_LINE TO LT_TOP_OF_PAGE.

    CLEAR LS_LINE.

    LS_LINE-TYP = 'S'.

    LS_LINE-KEY = 'Run On :'.

    LS_LINE-INFO = W_DATUM.

    APPEND LS_LINE TO LT_TOP_OF_PAGE.

    LS_LINE-KEY = 'User Name :'.

    LS_LINE-INFO = SY-UNAME.

    APPEND LS_LINE TO LT_TOP_OF_PAGE.

    ENDFORM. " SET_REPORT_HEADER

    FORM CONVERT_DATE.

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    DATE_INTERNAL = SY-DATUM

    IMPORTING

    DATE_EXTERNAL = W_DATUM.

    ENDFORM. " CONVERT_DATE

    FORM TOP_OF_PAGE.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = W_LIST_TOP_OF_PAGE.

    ENDFORM. "TOP_OF_PAGE

    FORM STATUS_CHECK USING OBJNR

    STATUS.

    • This uses reverse logic i.e. subrc = 0 means the status being

    • checked (delete / inactive) is active.

    • e.g checking for I0076 and subrc = 0 means it's been flagged for

    • deletion

    CALL FUNCTION 'STATUS_CHECK'

    EXPORTING

    BYPASS_BUFFER = 'X'

    OBJNR = OBJNR

    STATUS = STATUS

    EXCEPTIONS

    OBJECT_NOT_FOUND = 1

    STATUS_NOT_ACTIVE = 2

    OTHERS = 3.

    ENDFORM. " STATUS_CHECK

    **********FORM ROUTINES (END)*************************************

    The other thing to note is that below I include a FORM to call a custom

    status (toolbar). I define this in the repositry browser by copying the

    STANDARD status from another ALV report, but you do not need to do this

    unless you want to add some more buttons to the standard toolbar. I now do

    this as a matter of course, as my users tend to want extra buttons e.g.

    'REFRESH'.

    How to add an extra button:-

    ℹ️ Create a new status using the repository browser by copying an existing

    one from an ALV program. Call it something like ZSTANDARD. Then change it by

    adding a new button to the toolbar - give it an icon and a four digit name

    like '&TMP' so the program knows what button the user has pressed.

    (ii) Within your program include a FORM called something like SET_PF_STATUS

    as in my example program below. Make sure the name of this FORM is included

    in the call to the ALV function module, again as in the example below.

    (iii) In the USER_COMMAND form, insert code to deal with the user pressing

    the new button e.g.

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

    • Example of how to deal with users pressing new buttons

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

    *******Process Call Back Events (Begin)**************************

    FORM user_command USING ucomm LIKE sy-ucomm

    selfield TYPE slis_selfield.

    CASE ucomm.

    WHEN '&IC1'.

    READ TABLE irepo INDEX selfield-tabindex.

    CHECK sy-subrc = 0.

    CASE selfield-sel_tab_field.

    WHEN 'IREPO-VBELN'.

    SET PARAMETER ID 'VL' FIELD irepo-vbeln.

    CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN. "Outbound

    WHEN '&TMP'.

    • We are going to refresh the display so tell the ALV this

    selfield-refresh = 'X'.

    • Isn't that clever!

    PERFORM refresh. "Subroutine to refresh the screen (for example)

    ENDCASE.

    ENDFORM.

    ********Process Call Back Events (End) ****************************

    THANKS

    MRUTYUN

    Add comment
    10|10000 characters needed characters exceeded