Ads

OBJECT ORIENTED(OO) ALV Report Guide-SAP ABAP Tutorial

OBJECT ORIENTED(OO) ALV Report Guide-SAP ABAP Tutorial

OBJECT ORIENTED(OO) ALV Report Guide-SAP ABAP Tutorial


This Object Oriented(OO) ALV Report tutorial helpful for all SAP ABAP Technical students who can develop OO ALV report if they follow this guide step by step.



Basic OO-ALV Report ( SE38 )

Steps:

1.Get the data into internal table

  • Go to Transaction code SE38.
OBJECT ORIENTED ALV Report
  • Enter the program name which start's with Y or Z< Program name > and click on create Button.
OBJECT ORIENTED ALV Report
  • Enter the Title.
  • Select the Attribute Type as Executable Program.
  • Click on SAVE button.
OBJECT ORIENTED ALV Report
  • Enter the logic.
TABLES : EKKO.

DATA : IT_EKKO  TYPE TABLE OF EKKO.

SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN.

START-OF-SELECTION.

PERFORM FETCH_DATA USING S_EBELN[] CHANGING IT_EKKO.

  • Double click on Subroutine name.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on Yes.
OBJECT ORIENTED ALV Report

  •   Select the include and click on Continue.
OBJECT ORIENTED ALV Report

  • Enter the Logic,
 SELECT * FROM EKKO INTO TABLE P_IT_EKKO WHERE EBELN IN P_S_EBELN.

OBJECT ORIENTED ALV Report



2.Create a custom control Screen

  • Call the custom Container screen.
OBJECT ORIENTED ALV Report
  • To Create screen .
  • Double click on Screen Number.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on Yes.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on Yes.
OBJECT ORIENTED ALV Report
  • Enter the short description.
OBJECT ORIENTED ALV Report
  • Click on Layout.
OBJECT ORIENTED ALV Report
  • Click on Custom Container.
OBJECT ORIENTED ALV Report
  • Drag the Custom Container.
OBJECT ORIENTED ALV Report
  • Enter the Name for Custom Container.
OBJECT ORIENTED ALV Report
  • Save -> Check -> Activate.
  • Click on Back.
OBJECT ORIENTED ALV Report

  • Click on Back.
OBJECT ORIENTED ALV Report



3.Create object for CL_GUI_CUSTOM_CONTAINER(pass custom control name)


  • Declare the Objects.
OBJECT ORIENTED ALV Report
  • Double click on Screen number.
OBJECT ORIENTED ALV Report
  • Enable the PBO module using CTRL + >.
OBJECT ORIENTED ALV Report

  • Double click on PBO module name.
  • Pop-up will appear.
OBJECT ORIENTED ALV Report

  • Pop-up will appear.
  • Select the include and click on continue.
OBJECT ORIENTED ALV Report

  • Pop-up will appear.
  • Click on Yes.
OBJECT ORIENTED ALV Report


  • Click on Pattern.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on ABAP object Pattern radio button.
  • Click on continue.
OBJECT ORIENTED ALV Report

  • Pop-up will appear.
  • Click on Create Object radio Button.
  • Enter the Instance name.
  • Enter the Class name and click on continue.
OBJECT ORIENTED ALV Report

  • Enter the custom container name.
OBJECT ORIENTED ALV Report



4.Create object for CL_GUI_ALV_GRID ( pass object of custom container)

  • Create object for class CL_GUI_ALV_GRID.
  • Click on Pattern.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on ABAP object Pattern radio button.
  • Click on continue.

OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on Create Object radio Button.
  • Enter the Instance name.
  • Enter the Class name and click on continue.
OBJECT ORIENTED ALV Report
  • Enter the parent name as Custom container Object name.
OBJECT ORIENTED ALV Report


Call the method SET_TABLE_FOR_FIRST_DISPLAY).
  • Pop-up will appear.
  • Click on ABAP object Pattern radio button.
  • Click on continue.
OBJECT ORIENTED ALV Report
  • Pop-up will appear.
  • Click on Call method radio button.
  • Enter the instance name.
  • Enter the Class name and method name.
  • Click on continue.
OBJECT ORIENTED ALV Report
  • Pass the Global Table structure name.
OBJECT ORIENTED ALV Report

  • Pass the Internal table and Enable the Exceptions.
OBJECT ORIENTED ALV Report
  • Save -> Check -> Activate.
OBJECT ORIENTED ALV Report
  • Click on Back button.
OBJECT ORIENTED ALV Report
  • Save -> Check -> activate.
OBJECT ORIENTED ALV Report
  • Click on Back button.
OBJECT ORIENTED ALV Report
  • Save -> Check -> Activate.
OBJECT ORIENTED ALV Report
  • Click on Execute.
OBJECT ORIENTED ALV Report


Input

  • Enter the input.
OBJECT ORIENTED ALV Report
  • Execute.

Output


OBJECT ORIENTED ALV Report


Source Code:


REPORT  ZOOALV_BASIC.

TABLES : EKKO.

DATA : IT_EKKO  TYPE TABLE OF EKKO.

DATA : O_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
       O_ALV TYPE REF TO CL_GUI_ALV_GRID.

SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN.

START-OF-SELECTION.

PERFORM FETCH_DATA USING S_EBELN[] CHANGING IT_EKKO.

CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*&      Form  FETCH_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_S_EBELN[]  text
*      <--P_IT_EKKO  text
*----------------------------------------------------------------------*
FORM FETCH_DATA  USING    P_S_EBELN LIKE  S_EBELN[]
                 CHANGING P_IT_EKKO LIKE  IT_EKKO.

  SELECT * FROM EKKO INTO TABLE P_IT_EKKO WHERE EBELN IN P_S_EBELN.

ENDFORM.                    " FETCH_DATA
*&---------------------------------------------------------------------*
*&      Module  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
CREATE OBJECT O_CUST
  EXPORTING
*    PARENT                      =
    CONTAINER_NAME              = 'CUST'
*    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 O_ALV
  EXPORTING
*    I_SHELLSTYLE      = 0
*    I_LIFETIME        =
    I_PARENT          = O_CUST
*    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 O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
  EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
    I_STRUCTURE_NAME              = 'EKKO'
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
*    IS_LAYOUT                     =
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
*    IR_SALV_ADAPTER               =
  CHANGING
    IT_OUTTAB                     = IT_EKKO
*    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.


ENDMODULE.                 " STATUS_9000  OUTPUT.



Conclusion

Let me know if you other technical guide on OO ALV reports, or share this post to helpful others.



Comments

  1. This post is extremely radiant. I extremely like this post. It is outstanding amongst other posts that I’ve read in quite a while. Much obliged for this better than average post. I truly value it! best institute for sap training in hyderabad

    ReplyDelete

Post a Comment

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced