SAP Crystal Report on SAP ECC o R3

download SAP Crystal Report on SAP ECC o R3

of 12

Transcript of SAP Crystal Report on SAP ECC o R3

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    1/12

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Developing Crystal Reports on ECC

    Applies to:SAP Business Objects Crystal Reports. For more information, visit theBusiness Objects homepage.

    Summary

    This white paper explores various methods of accessing ECC/R3 data through Crystal Reports.

    Author: Arka Roy Chowdhury

    Company: Cognizant

    Created on: 1 February 2011

    Author BioThe author has worked in various support and development projects in SAP BW and Business Objects forover three years. He currently works for Cognizant.

    https://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/boc
  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    2/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Table of Contents

    Introduction ......................................................................................................................................................... 3Connecting Crystal Reports to ECC ................................................................................................................... 3Accessing Data through Function Module .......................................................................................................... 3

    Import Parameters .......................................................................................................................................... 3Tables.............................................................................................................................................................. 3Exceptions ....................................................................................................................................................... 3Source Code ................................................................................................................................................... 4

    Accessing Function module through Crystal Reports ........................................................................................ 5Step 1: ............................................................................................................................................................. 5Step 2: ............................................................................................................................................................. 5

    Accessing Data through Standard Tables or Views ........................................................................................... 6Step 1: ............................................................................................................................................................. 6Step 2: ............................................................................................................................................................. 6Step 3: ............................................................................................................................................................. 7Step 4: ............................................................................................................................................................. 7

    Creating Crystal Report through InfoSet or Query ............................................................................................. 8How to Create an Infoset ................................................................................................................................ 8Step 1: ............................................................................................................................................................. 8Step 2: ............................................................................................................................................................. 8Step 3: ............................................................................................................................................................. 8Step 4: ............................................................................................................................................................. 9Step 5: ............................................................................................................................................................. 9Step 6: ........................................................................................................................................................... 10Step 7: ........................................................................................................................................................... 10

    Related Content ................................................................................................................................................ 11Disclaimer and Liability Notice .......................................................................................................................... 12

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    3/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Introduction

    This white paper explores various methods of accessing ECC/R3 data through Crystal Reports.

    Connecting Crystal Reports to ECC

    The following is discussed as to how data is extracted from ECC to Crystal Reports.

    Function Module

    Table and Table joins InfoSet and Query

    Accessing Data through Function Module

    There is a Function module z_salesorder_item_getdata that extracts header-level data for a particulardocument number. This FM data can easily be accessed by Crystal Reports.

    Here are some details of the Function Module under consideration:

    Import Parameters

    Note: Export parameters are blank.

    Tables

    Exceptions

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    4/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Source Code

    FUNCTION Z_SALESORDER_ITEM_GETDATA.

    *"----------------------------------------------------------------------

    *"*"Local Interface:

    *" IMPORTING

    *" REFERENCE(I_VBELN) LIKE VBAK-VBELN OPTIONAL

    *" TABLES

    *" IT_VBELN STRUCTURE ZVBELN_STRU OPTIONAL*" ET_VBAP STRUCTURE VBAP OPTIONAL

    *" EXCEPTIONS

    *" RECORD_NOT_FOUND

    *"----------------------------------------------------------------------

    DATA : LV_VBELN(10) TYPE N,

    L_VBELN TYPE VBELN.

    DATA : LS_VBELN TYPE ZVBELN_STRU.

    DATA : IT_VBAP TYPE TABLE OF VBAP.

    CALL FUNCTION 'WB2_VBAP_READ_WITH_VBELN'

    EXPORTING

    I_VBELN = I_VBELN

    * I_BYPASSING_BUFFER = ' '

    * I_REFRESH_BUFFER =

    TABLES

    * ET_VBAPVB =

    ET_VBAP = IT_VBAP

    EXCEPTIONS

    RECORD_NOT_FOUND = 1

    OTHERS = 2.

    IF SY-SUBRC 0.

    RAISE RECORD_NOT_FOUND.

    ENDIF.

    APPEND LINES OF IT_VBAP TO ET_VBAP.

    ENDFUNCTION.

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    5/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Accessing Function module through Crystal Reports

    Here are the steps:

    Step 1:

    Go to the database expert. Navigate to the Function module.

    The Function module is listed in the data source tree (Sap Tables, Cluster or Function).

    Step 2:

    Copy it to the right hand space as shown in the figure below:

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    6/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    The function module is now ready to be used for the report. The available fields appear inside the Functionmodule in the Field Explorer.

    Accessing Data through Standard Tables or Views

    Crystal Reports can also access tables or views just like the function modules. Joins can even be createddirectly in the database expert just by selecting more than one table.

    The following example will create a table join between the VBAP and VBAK table

    Step 1:

    Go to the database expert.

    Step 2:

    Select the two tables as shown in the figure below:

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    7/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    The join is automatically generated.

    Step 3:

    Click OK. The table fields are in the field explorer.

    Step 4:

    Drag and drop the field in the canvas to create the report.

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    8/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Creating Crystal Report through InfoSet or Query

    InfoSet Query is suitable for reporting in all areas of the SAP R/3 system.

    How to Create an Infoset

    Step 1:

    Go to tcode SQ02.

    Step 2:

    Give a suitable name to the InfoSet. Click Create.

    Step 3:

    Provide the description and the name of the base table.

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    9/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Step 4:

    Click Insert table on the InfoSet design canvas to select the appropriate table to be joined.

    A join is automatically created, but it can be modified.

    Step 5:

    Provide the field group details.

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    10/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Step 6:

    Click Generate on the InfoSet manage screen.

    The infoset is now ready

    Remember to assign roles and user groups to the infoset. Otherwise, it will not appear in the Crystal Reportsdatabase expert.

    After assigning the roles and user group to the infoset (these should also be mapped to the user ID beingused), the infoset appears in the database expert.

    Since the query area is in global, the test infoset just created appears under the group of G.

    G = global

    L = local

    I = infoset

    Q = query

    Step 7:

    Click Finish. The infoset is ready in the field explorer of the Crystal report.Similarly, access an infoset query.

  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    11/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Related Content

    SAP Query Guide

    Creating Function module

    Crystal install Guide

    For more information, visit theBusiness Objects homepage

    http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdfhttp://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdfhttp://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htmhttp://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_install_guide_2010_en.pdfhttp://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_install_guide_2010_en.pdfhttps://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/bochttps://www.sdn.sap.com/irj/bochttp://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_install_guide_2010_en.pdfhttp://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htmhttp://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
  • 8/3/2019 SAP Crystal Report on SAP ECC o R3

    12/12

    Developing Crystal Reports on ECC

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    Disclaimer and Liability Notice

    This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

    SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,and anyone using these methods does so at his/her own risk.

    SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.