Skip to Content

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

Problem activating the back and exit button with the ALV using OO

I have wrote my first alv using Methods.My problem is that i can't activete the BACK and EXIT button in the standart toolbar .

Look my code please .....

Without PF-STATUS can i do it ?

*&---------------------------------------------------------------------*
*& Report  YDP_DOUBLE_ALV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YDP_DOUBLE_ALV.

TABLES : YQM_CERT , MARA , YOUTPUT_APPL.

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 : ALV_GRID2 TYPE REF TO CL_GUI_ALV_GRID,
       CUSTOM_CONTAINER2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*       FIELD_CAT TYPE LVC_T_FCAT,
*       LAYOUT TYPE LVC_S_LAYO.



DATA: DYNNR TYPE SY-DYNNR,
      REPID TYPE SY-REPID.
DATA: OK_CODE TYPE SY-UCOMM.

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

DATA : BEGIN OF ITAB1 OCCURS 0.
        INCLUDE STRUCTURE YOUTPUT_APPL.
DATA   END OF ITAB1.


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

  SET PF-STATUS 'ZST9'.
  PERFORM DISPLAY_ALV.

ENDMODULE.                    "DISPLAY_ALV OUTPUT
                   "DISPLAY_ALV OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

  CASE OK_CODE.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

START-OF-SELECTION.

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

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

  SELECT  * FROM  YOUTPUT_APPL INTO ITAB1.
    APPEND ITAB1.
  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                       = REPID
      DYNNR                       = 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

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