Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Activating the Standard toolbar in ALV using Methods

Hi Abapers ...

I just started to write alv using methods and not the classical FM . My problem is that i can't activate the Standard toolbar of the GUI .

As we know with the "old" way we had the pf status command .

Now how do we do that ?

*&---------------------------------------------------------------------*
*& Report  DOUBLE_ALV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  DOUBLE_ALV.

TABLES : YQM_CERT .

DATA : ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
       CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
       FIELD_CAT TYPE LVC_T_FCAT,
       LAYOUT TYPE LVC_S_LAYO.

DATA : BEGIN OF ITAB OCCURS 0.
        INCLUDE STRUCTURE YQM_CERT.
DATA   END OF ITAB.



*----------------------------------------------------------------------*
*  MODULE DISPLAY_ALV OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE DISPLAY_ALV OUTPUT.

  PERFORM DISPLAY_ALV.

ENDMODULE.                    "DISPLAY_ALV OUTPUT

START-OF-SELECTION.

LAYOUT-ZEBRA = 'X'.
LAYOUT-GRID_TITLE = 'YQM_CERT'.

  SELECT  * FROM  YQM_CERT INTO ITAB.
    APPEND ITAB.
  ENDSELECT.

  CALL SCREEN 100.


END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV.

  IF ALV_GRID IS INITIAL.

    CREATE OBJECT CUSTOM_CONTAINER
      EXPORTING
*      PARENT                      =
        CONTAINER_NAME              = 'CC_ALV'
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      REPID                       =
*      DYNNR                       =
*      NO_AUTODEF_PROGID_DYNNR     =
*    EXCEPTIONS
*      CNTL_ERROR                  = 1
*      CNTL_SYSTEM_ERROR           = 2
*      CREATE_ERROR                = 3
*      LIFETIME_ERROR              = 4
*      LIFETIME_DYNPRO_DYNPRO_LINK = 5
*      others                      = 6
        .
    IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CREATE OBJECT ALV_GRID
      EXPORTING
*    I_SHELLSTYLE      = 0
*    I_LIFETIME        =
        I_PARENT          = CUSTOM_CONTAINER
*    I_APPL_EVENTS     = space
*    I_PARENTDBG       =
*    I_APPLOGPARENT    =
*    I_GRAPHICSPARENT  =
*    I_NAME            =
*    I_FCAT_COMPLETE   = SPACE
*  EXCEPTIONS
*    ERROR_CNTL_CREATE = 1
*    ERROR_CNTL_INIT   = 2
*    ERROR_CNTL_LINK   = 3
*    ERROR_DP_CREATE   = 4
*    others            = 5
        .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
         I_STRUCTURE_NAME              = 'YQM_CERT'
*      IS_VARIANT                    =
*      I_SAVE                        =
*      I_DEFAULT                     = 'X'
       IS_LAYOUT                     = LAYOUT
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
*      IR_SALV_ADAPTER               =
      CHANGING
        IT_OUTTAB                     = ITAB[]
*      IT_FIELDCATALOG               =
*      IT_SORT                       =
*      IT_FILTER                     =
*    EXCEPTIONS
*      INVALID_PARAMETER_COMBINATION = 1
*      PROGRAM_ERROR                 = 2
*      TOO_MANY_LINES                = 3
*      others                        = 4
            .
    IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  ELSE.

    CALL METHOD ALV_GRID->REFRESH_TABLE_DISPLAY
*       EXPORTING
*         IS_STABLE      =
*         I_SOFT_REFRESH =
*       EXCEPTIONS
*         FINISHED       = 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.

  ENDIF.


ENDFORM.                    "DISPLAY_ALV

Look my code ....

Points will be rewarded ....

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question