sap bw - reconcile sap crm installed base data with sap bw datasource

34
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2011 SAP AG 1 SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource Applies to: SAP BI 7.0 consultants having knowledge in SAP CRM 5.0 / SAP CRM 7.0. For more information, visit the EDW homepage Summary This document specifies the detailed understanding for reconciling the SAP CRM Installed base data with the SAP BW datasource 0CRM_SRV_IBASE_ATTR - CRM Installed Base Master Data (dataSource). Author: Suraj Tigga Company: Capgemini Consulting Created on: 01 March 2011 Author Bio Suraj Tigga is a Senior SAP BI / ABAP consultant at Capgemini Consulting, India. Suraj joined Capgemini Consulting in 2008 and has worked on multiple SAP BI implementation and support Projects.

Upload: arav

Post on 10-Dec-2015

370 views

Category:

Documents


16 download

DESCRIPTION

BW

TRANSCRIPT

Page 1: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

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

© 2011 SAP AG 1

SAP BW - Reconcile SAP CRM

Installed Base Data with SAP BW

Datasource

Applies to:

SAP BI 7.0 consultants having knowledge in SAP CRM 5.0 / SAP CRM 7.0. For more information, visit the EDW homepage

Summary

This document specifies the detailed understanding for reconciling the SAP CRM Installed base data with the SAP BW datasource 0CRM_SRV_IBASE_ATTR - CRM Installed Base Master Data (dataSource).

Author: Suraj Tigga

Company: Capgemini Consulting

Created on: 01 March 2011

Author Bio

Suraj Tigga is a Senior SAP BI / ABAP consultant at Capgemini Consulting, India. Suraj joined Capgemini Consulting in 2008 and has worked on multiple SAP BI implementation and support Projects.

Page 2: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 2

Table of Contents

Scenario .............................................................................................................................................................. 3

Step-by-Step Solution ..................................................................................................................................... 3 Data Flow (CRM- BI) – Installed Base ......................................................................................................................... 3

Reconciliation – ABAP Code (Logic) ............................................................................................................................ 4

Execution ................................................................................................................................................................... 12

ABAP Code (Complete) ............................................................................................................................................. 15

Related Content ................................................................................................................................................ 33

Disclaimer and Liability Notice .......................................................................................................................... 34

Page 3: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 3

Scenario

Oftentimes SAP CRM-BW projects has to face situations to reconcile the loaded to SAP BI from CRM .Since no standard reports are available in SAP CRM which reconcile the CRM data to the data loaded to SAP BI .

This article focalizes to reconcile SAP CRM Installed Base data with the BW datasource (0CRM_SRV_IBASE_ATTR - CRM IBase Master Data (DataSource)), which is further loaded to DSO 0CRM_IBCO (Installed Bases and Components).It primarily concentrates to create ABAP report which focuses to get the relevant Installed Base data and then reconciling the report data (Can be schedules in Background) with the BI report built on DSO 0CRM_IBCO.

Step-by-Step Solution

Complete solution is explained in three steps:

Data Flow (CRM-BI) Installed Base: Explains briefly about CRM Installed Base and their database tables.

Reconciliation – ABAP Code (Logic): Briefly explains the flow logic of the ABAP code, with the display in the ABAP report.

Execution: Executing the ABAP report in background. Further reconcile the BI BEx report data with ABAP report data.

Data Flow (CRM- BI) – Installed Base

Installed Base Management is SAP CRM enables the representation of objects installed at customers place (For example devices, machines, software and so on) for which a service is offered.

Installed Base- An installed Base is a multilevel structure of installed base components for managing objects (for example devices, machines, software) that are installed or as going to be installed on site at the customer site. An installed base can represent the reference basis for services. An installed base describes the hierarchical structure of these objects and their individual parts (components).

Installed Base Component-Individual elements of an installed base at the customer’s that contain service-relevant information and can be referred to in business processes. All components for an installed base are arranged in a structure. An installed base component always has specific component types. The following component types are possible:

Product- Assign existing product to an installed base as a component

Text Item-Assign a text item as an installed base as a component, in which manual defining of short text is possible

Installed Bases-Assign an existing installed base to another installed base as a component.

Object-Assign an individual object to an installed base as a component. An individual object contains data that uniquely identifies the object.(Individual Object contains general information about the goods or services that it describes. Individual data that is valid for exactly one object is stored in the individual object e.g location and identification number)

Page 4: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 4

Reconciliation – ABAP Code (Logic)

Purpose of the ABAP report is to generate a report output to have installed base and installed based component information similar to what is stored in the SAP BW DSO 0CRM_IBCO fetched from datasource 0CRM_SRV_IBASE_ATTR - CRM IBase Master Data (DataSource).Advantage of this report is that we can schedule this in background and validate the complete set of records with the BI Query. Validation we can also do it using RSA3 but only for specific Installed bases , not for all the records (Because we cannot execute RSA3 in background).

Installed Base 102: Electronic data processing system

Address Branch at Vineyard

Partner: Miller Inc. Maintenance

Room A01

Room A02

Room B01

Location 1

Location 2

Location 3

PC_010

PC_022

PC_125

Location 1

PC_010

PC_010

PC_010

Laser Unit 4587-AD78 Copier ABC 201

Installation Serv045: Printer Server

Page 5: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 5

Step 1: Go to transaction IB53 (Display Installed Base).Look for installed base ‘3618’:

Installed Base: 3618

Component(Instance) Superior Component Top-Most Component (Installed Base)

3619 0 3619

3621 0 3621

3623 0 3623

3625 3619 3619

3626 3619 3619

3628 3619 3619

3630 3619 3619

While mentioning all the following steps, I would consider the above installed base 3618.

Page 6: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 6

Step 2: Selection Screen (Report – Reconciliation (Installed Base CRM and BI))

Code:

selection-screen begin of block b1 with frame title text-001 .

* Selection screen input fields for Input

select-options:

s_ibase for ibib-ibase modif id op2 . " Installed Base

selection-screen end of block b1.

Step3: Retrieve the relevant installed base and installed base component details from

the applicable database tables:

IBIB (IB: Installed Base/IBase) Function Module

CRM_IBASE_GET_DETAIL

IBASE = I_IBASE_HEAD (Import parameters)

COMM_IL_PRDBP (Master

Data of Relationship Type Partner)

OBJNR (Export parameter) = SOURCEGUID

BUT000 (Business Partner

General Data)

DESTINGUID = PARTNER_GUID

BUT020 (BP: Addresses)

PARTNER = PARTNER

ADRC (Addresses)

ADDRNUMBER = ADDRNUMBER

COMM_PRODUCT (Product)

Objnr (Export Parameter) =

product_guid

Function Module

CRM_IBASE_GET_PARTNER

IBASE = I_IBASE_HEAD (Import

parameters)

CDBD_IBPART

(Partner link for IBase)

IB_GUID_16 = REFGUID

REF_PARTNER_NO = PARTNER_GUID

Page 7: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 7

- Retrieve all the installed base present in the SAP CRM :

* Retrieve data form Installed Base

SELECT ib_guid_16

ibase

ibtyp

extid

authg

crnam

crtim

FROM ibib

INTO TABLE t_ibib

WHERE ibase IN s_ibase.

- Retrieve component details for the individual installed base:

LOOP AT t_ibib INTO wa_ibib.

* Pass the IBASE details

wl_ibase_head-ibase = wa_ibib-ibase.

wl_ibase_head-guid_ibase = wa_ibib-ib_guid_16.

* Retrieve IBASE details

CALL FUNCTION 'CRM_IBASE_GET_DETAIL'

EXPORTING

i_ibase_head = wl_ibase_head

IMPORTING

e_ibib1 = tl_ibib1

e_ibibt1 = tl_ibibt1

e_struc_ibase_tab = tl_ibap_struc1

* TABLES

* ET_STATUS =

EXCEPTIONS

not_specified = 1

doesnt_exist = 2

OTHERS = 3

.

ENDLOOP

- Fetch all the relevant partner and address details for the components:

* Retrieve the product details

SELECT sourceguid

destinguid

link_partner_fct

FROM comm_il_prdbp

INTO TABLE t_comm_il_prdbp

FOR ALL ENTRIES IN t_source_guid

WHERE sourceguid EQ t_source_guid-objnr.

IF sy-subrc EQ 0.

* Retrieve Business partner values

SELECT partner

partner_guid

FROM but000

INTO TABLE tl_but000_c

FOR ALL ENTRIES IN t_comm_il_prdbp

WHERE partner_guid EQ t_comm_il_prdbp-destinguid.

IF sy-subrc EQ 0.

Page 8: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 8

LOOP AT tl_but000_c INTO wl_but000_c.

MOVE-CORRESPONDING wl_but000_c TO wa_but000_c.

APPEND wa_but000_c TO t_but000_c.

CLEAR: wa_but000_c , wl_but000_c.

ENDLOOP.

* Fetch the Address Number relevant to the Business Partner

SELECT partner

addrnumber

FROM but020

INTO TABLE tl_but020_c

FOR ALL ENTRIES IN tl_but000_c

WHERE partner EQ tl_but000_c-partner.

IF sy-subrc EQ 0.

LOOP AT tl_but020_c INTO wl_but020_c.

MOVE-CORRESPONDING wl_but020_c TO wa_but020_c.

APPEND wa_but020_c TO t_but020_c.

CLEAR : wa_but020_c , wl_but020_c.

ENDLOOP.

* retrieve the address details

SELECT addrnumber

street

streetcode

house_num1

post_code1

city1

city_code

country

region

regiogroup

FROM adrc

INTO TABLE tl_adrc_c

FOR ALL ENTRIES IN tl_but020_c

WHERE addrnumber EQ tl_but020_c-addrnumber.

IF sy-subrc EQ 0.

LOOP AT tl_adrc_c INTO wl_adrc_c.

MOVE wl_adrc_c TO wa_adrc_c.

APPEND wa_adrc_c TO t_adrc_c.

CLEAR : wl_adrc_c , wa_adrc_c.

ENDLOOP.

ENDIF.

- Retrieve the partner and address details present in the Installed base:

wl_i_ibase_head-ibase = wa_ibib-ibase.

wl_i_ibase_head-guid_ibase = wa_ibib-ib_guid_16.

* Fetch the Partner GUID

CALL FUNCTION 'CRM_IBASE_GET_PARTNER'

EXPORTING

i_ibase_head = wl_i_ibase_head

IMPORTING

e_partner_tab = tl_e_partner_tab

EXCEPTIONS

not_specified = 1

doesnt_exist = 2

no_authority = 3

OTHERS = 4

Page 9: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 9

.

IF sy-subrc EQ 0.

LOOP AT tl_e_partner_tab INTO wl_e_partner_tab.

MOVE-CORRESPONDING wl_e_partner_tab TO wa_e_partner_tab.

APPEND wa_e_partner_tab TO t_e_partner_tab.

CLEAR wa_e_partner_tab.

ENDLOOP.

ENDIF.

* Fetch the IBASE (HEADER LEVEL) details:

i_guid_16 = wa_ibib-ib_guid_16.

i_guid_32 = cl_ibase_service=>cl_convert_guid_16_32( i_guid_16 ).

SELECT refguid

ref_partner_fct

ref_partner_no

FROM cdbd_ibpart

INTO TABLE tl_cdbd_ibpart1

WHERE refguid EQ i_guid_32.

IF sy-subrc EQ 0.

LOOP AT tl_cdbd_ibpart1 INTO wl_cdbd_ibpart1.

* IBASE GUID

r_guid_32 = wl_cdbd_ibpart1-refguid.

w_ibase_guid_16 = cl_ibase_service=>cl_convert_guid_32_16( r_guid_32 ).

wa_cdbd_ibpart-ib_guid_16 = w_ibase_guid_16.

wl_cdbd_ibpart-ib_guid_16 = w_ibase_guid_16.

CLEAR : r_guid_32.

* Business Partner GUID

r_guid_32 = wl_cdbd_ibpart1-ref_partner_no.

w_partner_guid_16 = cl_ibase_service=>cl_convert_guid_32_16( r_guid_32 ).

wa_cdbd_ibpart-partner_guid = w_partner_guid_16.

wl_cdbd_ibpart-partner_guid = w_partner_guid_16.

MOVE-CORRESPONDING wl_cdbd_ibpart1 TO wa_cdbd_ibpart.

MOVE-CORRESPONDING wl_cdbd_ibpart1 TO wl_cdbd_ibpart.

APPEND wa_cdbd_ibpart TO t_cdbd_ibpart.

APPEND wl_cdbd_ibpart TO tl_cdbd_ibpart.

CLEAR: wa_cdbd_ibpart , wl_cdbd_ibpart1 , wl_cdbd_ibpart , r_guid_32 ,

w_partner_guid_16 , wl_cdbd_ibpart.

ENDLOOP.

* Fetch the Business Partner Details:

SELECT partner

partner_guid

FROM but000

INTO TABLE tl_but000_h

FOR ALL ENTRIES IN tl_cdbd_ibpart

WHERE partner_guid EQ tl_cdbd_ibpart-partner_guid.

IF sy-subrc EQ 0.

LOOP AT tl_but000_h INTO wl_but000_h.

MOVE-CORRESPONDING wl_but000_h TO wa_but000_h.

APPEND wa_but000_h TO t_but000_h.

CLEAR: wa_but000_h , wl_but000_h.

ENDLOOP.

Page 10: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 10

* Fetch the Address Number relevant to the Business Partner(HEADER)

SELECT partner

addrnumber

FROM but020

INTO TABLE tl_but020_h

FOR ALL ENTRIES IN tl_but000_h

WHERE partner EQ tl_but000_h-partner.

IF sy-subrc EQ 0.

LOOP AT tl_but020_h INTO wl_but020_h.

MOVE-CORRESPONDING wl_but020_h TO wa_but020_h.

APPEND wa_but020_h TO t_but020_h.

CLEAR : wa_but020_h , wl_but020_h.

ENDLOOP.

* retrieve the address details

SELECT addrnumber

street

streetcode

house_num1

post_code1

city1

city_code

country

region

regiogroup

FROM adrc

INTO TABLE tl_adrc_h

FOR ALL ENTRIES IN tl_but020_h

WHERE addrnumber EQ tl_but020_h-addrnumber.

IF sy-subrc EQ 0.

LOOP AT tl_adrc_h INTO wl_adrc_h.

MOVE wl_adrc_h TO wa_adrc_h.

APPEND wa_adrc_h TO t_adrc_h.

CLEAR : wl_adrc_h , wa_adrc_h.

ENDLOOP.

ENDIF.

- Get the product details from the table COMM_PRODUCT:

SELECT product_guid

product_id

product_type

object_family

logsys

FROM comm_product

INTO TABLE tl_comm_product

FOR ALL ENTRIES IN t_source_guid

WHERE product_guid EQ t_source_guid-objnr.

IF sy-subrc EQ 0.

LOOP AT tl_comm_product INTO wl_comm_product.

MOVE-CORRESPONDING wl_comm_product TO wa_comm_product.

APPEND wa_comm_product TO t_comm_product.

CLEAR: wa_comm_product , wl_comm_product.

ENDLOOP.

ENDIF.

Page 11: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 11

Note: Retrieve the Business Partner and Address details separately for Installed Base and components.

Page 12: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 12

Execution

Step 1: Go to transaction SE38 and execute the ABAP Code ‘YCRM_INSTALLED_BASE_BW’ in background:

Step 2: Check the spool created for the ABAP Report Output:

Page 13: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 13

Advantage of using the above method is we have a option of background schedule to execute the report output and further validating the data with the SAP BW report.

For Validation of the data (Would take the sample example of Installed Base 3618).Reconciliation of the report data can be done with various references either from RSA3 (Execution of the data source),DSO (0CRM_IBCO) Output , or Query Execution. Here I would validate the report output data with the RSA3 transaction.

Step 1: Go to SE38 transaction and execute the report for the below mentioned selection:

Go to transaction RSA3 and execute the datasource 0CRM_SRV_IBASE_ATTR for Installed Base 3618:

Page 14: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 14

Step 2: Validate the data between report output and RSA3 output:

Page 15: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 15

ABAP Code (Complete)

Sections of ABAP Code:

ABAP Code: YCRM_INSTALLED_BASE_BW

Include: YSUB_SUBROUTINES

Include: YSUB_SELECTION_SCREEN

ABAP Code: YCRM_INSTALLED_BASE_BW

*&---------------------------------------------------------------------*

*& Report YCRM_INSTALLED_BASE_BW

*&

*&---------------------------------------------------------------------*

*& Reconciliation of the CRM Installed Base data with the data loaded

*& to SAP BI using datasource 0CRM_SRV_IBASE_ATTR

*&---------------------------------------------------------------------*

REPORT ycrm_installed_base_bw NO STANDARD PAGE HEADING

LINE-SIZE 190

LINE-COUNT 80.

TABLES : ibib.

TYPE-POOLS : slis.

* Installed Base

TYPES: BEGIN OF typ_ibib ,

ib_guid_16 TYPE guid_16 ,

ibase TYPE ib_ibase ,

ibtyp TYPE ib_ibtyp ,

extid TYPE ib_extid ,

authg TYPE ib_authg ,

crnam TYPE bu_crusr ,

crtim TYPE icrts ,

END OF typ_ibib ,

* Partner Fucntion

BEGIN OF typ_crmc_partner_fct ,

partner_fct TYPE comt_partner_fct ,

END OF typ_crmc_partner_fct ,

* Address

BEGIN OF typ_adrc ,

addrnumber TYPE ad_addrnum,

street TYPE ad_street ,

streetcode TYPE ad_strnum ,

house_num1 TYPE ad_hsnm1 ,

post_code1 TYPE ad_pstcd1 ,

city1 TYPE ad_city1 ,

city_code TYPE ad_citynum ,

country TYPE land1 ,

region TYPE regio ,

regiogroup TYPE regiogroup ,

END OF typ_adrc,

* Instance(Components)

Page 16: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 16

BEGIN OF typ_instance ,

instance TYPE ib_instance ,

guid_compc TYPE ib_recno_16 ,

END OF typ_instance ,

* Master Data of Relationship Type Partner

BEGIN OF typ_comm_il_prdbp ,

sourceguid TYPE comt_il_sourceguid ,

destinguid TYPE comt_il_destinguid ,

link_partner_fct TYPE comt_link_partner_fct ,

END OF typ_comm_il_prdbp ,

* Product GUID

BEGIN OF typ_source_guid ,

objnr TYPE ib_objnr_16 ,

END OF typ_source_guid ,

* Business Partner

BEGIN OF typ_but000,

partner TYPE bu_partner ,

partner_guid TYPE bu_partner_guid ,

END OF typ_but000 ,

* Business Partner and Address Number

BEGIN OF typ_but020 ,

partner TYPE bu_partner ,

addrnumber TYPE ad_addrnum ,

END OF typ_but020 ,

* Comm_product

BEGIN OF typ_comm_product ,

product_guid TYPE comt_product_guid ,

product_id TYPE comt_product_id ,

product_type TYPE comt_product_type ,

object_family TYPE comt_product_object_family ,

logsys TYPE comt_logsys,

END OF typ_comm_product ,

* IBASE and Business Partner GUID link

BEGIN OF typ_cdbd_ibpart,

ib_guid_16 TYPE bu_partner_guid ,

ref_partner_fct TYPE crmt_partner_fct ,

partner_guid TYPE guid_16 ,

END OF typ_cdbd_ibpart.

DATA : wa_ibib TYPE typ_ibib ,

wa_crmc_partner_fct TYPE typ_crmc_partner_fct ,

wa_comm_il_prdbp TYPE typ_comm_il_prdbp ,

wa_adrc_c TYPE typ_adrc ,

wa_adrc_h TYPE typ_adrc ,

wa_instance TYPE typ_instance ,

wa_i_comp TYPE ibap_dat1 ,

wa_e_comp_det TYPE ibap_comp2,

wa_et_status TYPE jstat ,

wa_source_guid TYPE typ_source_guid ,

wa_but000_c TYPE typ_but000 ,

wa_but000_h TYPE typ_but000 ,

wa_extract TYPE crmt_bw_srv_ibase_attr ,

wa_comm_product TYPE typ_comm_product ,

wa_but020_c TYPE typ_but020 ,

wa_but020_h TYPE typ_but020 ,

wa_cdbd_ibpart TYPE typ_cdbd_ibpart ,

Page 17: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 17

wa_ibap_struc1 TYPE ibap_struc1,

wa_i_ibase_head TYPE ibap_head1 ,

wa_e_partner_tab TYPE ibap_part2.

DATA : t_ibib TYPE STANDARD TABLE OF typ_ibib INITIAL SIZE 0 ,

t_crmc_partner_fct TYPE STANDARD TABLE OF typ_crmc_partner_fct INITIAL SIZE 0

,

t_comm_il_prdbp TYPE STANDARD TABLE OF typ_comm_il_prdbp INITIAL SIZE 0 ,

t_adrc_c TYPE STANDARD TABLE OF typ_adrc INITIAL SIZE 0 ,

t_adrc_h TYPE STANDARD TABLE OF typ_adrc INITIAL SIZE 0 ,

t_ibib1 TYPE ibib1 ,

t_ibibt1 TYPE ibibt1 ,

t_ibap_struc1 TYPE STANDARD TABLE OF IBAP_STRUC1 ,

t_instance TYPE STANDARD TABLE OF typ_instance ,

t_i_comp TYPE ibap_dat1 ,

t_e_comp_det TYPE STANDARD TABLE OF ibap_comp2,

t_et_status TYPE ttjstat ,

t_source_guid TYPE STANDARD TABLE OF typ_source_guid ,

t_but000_c TYPE STANDARD TABLE OF typ_but000 ,

t_but000_h TYPE STANDARD TABLE OF typ_but000 ,

t_extract TYPE STANDARD TABLE OF crmt_bw_srv_ibase_attr ,

t_comm_product TYPE STANDARD TABLE OF typ_comm_product ,

t_but020_c TYPE STANDARD TABLE OF typ_but020 ,

t_but020_h TYPE STANDARD TABLE OF typ_but020 ,

t_cdbd_ibpart TYPE STANDARD TABLE OF typ_cdbd_ibpart ,

t_e_partner_tab TYPE STANDARD TABLE OF ibap_part2 .

* Fieldcatalogue :

DATA :

t_fieldcat TYPE slis_t_fieldcat_alv ,

t_event TYPE slis_t_event ,

wa_layout_ven TYPE slis_layout_alv .

* Selection Screen

INCLUDE ysub_selection_screen.

* Sub Routines

INCLUDE ysub_subroutines.

******* START OF SELECTION ***************

START-OF-SELECTION.

* Retreive data from Installed Base tables

PERFORM sub_retrive_data.

* Prepare final data

PERFORM sub_prepare_extract_data.

******* END OF SELECTION *****************

END-OF-SELECTION.

* Display Output

PERFORM sub_display_output.

Page 18: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 18

INCLUDE: YSUB_SELECTION_SCREEN

selection-screen begin of block b1 with frame title text-001 .

* Selection screen input fields for Input

select-options:

s_ibase for ibib-ibase modif id op2 . " Installed Base

selection-screen end of block b1.

INCLUDE: YSUB_SUBROUTINES

*&---------------------------------------------------------------------*

*& Include YSUB_SUBROUTINES

*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*& Form SUB_RETRIVE_DATA

*&---------------------------------------------------------------------*

* Retriece data from tables related to installed base

*----------------------------------------------------------------------*

form sub_retrive_data .

types : begin of d_cdbd_ibpart,

refguid type smo_guid ,

ref_partner_fct type crmt_partner_fct ,

ref_partner_no type crmt_partner_no ,

end of d_cdbd_ibpart.

data : l_ibase type ib_ibase ,

wl_ibase_head type ibap_head1 ,

wl_ibap_struc1 type ibap_struc1 ,

tl_comm_il_prdbp type standard table of typ_comm_il_prdbp ,

wl_comm_il_prdbp type typ_comm_il_prdbp ,

tl_cdbd_ibpart type standard table of typ_cdbd_ibpart ,

tl_cdbd_ibpart1 type standard table of d_cdbd_ibpart ,

wl_cdbd_ibpart1 type d_cdbd_ibpart ,

wl_cdbd_ibpart type typ_cdbd_ibpart ,

tl_but020_h type standard table of typ_but020 ,

tl_but020_c type standard table of typ_but020 ,

wl_but020_h type typ_but020 ,

wl_but020_c type typ_but020 ,

tl_adrc_c type standard table of typ_adrc ,

wl_adrc_c type typ_adrc ,

tl_adrc_h type standard table of typ_adrc ,

wl_adrc_h type typ_adrc ,

tl_but000_h type standard table of typ_but000 ,

wl_but000_h type typ_but000 ,

tl_but000_c type standard table of typ_but000 ,

wl_but000_c type typ_but000 ,

tl_comm_product type standard table of typ_comm_product ,

wl_comm_product type typ_comm_product ,

tl_ibap_struc1 type ibap_struc1_tab ,

tl_ibibt1 type ibibt1 ,

tl_ibib1 type ibib1 ,

Page 19: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 19

wl_i_ibase_head type ibap_head1 ,

tl_e_partner_tab type ibap_part2_tab ,

wl_e_partner_tab type ibap_part2.

data: w_partner_guid_16 type bu_partner_guid ,

w_ibase_guid_16 type guid_16 ,

i_guid_32 type guid_32 ,

i_guid_16 type guid_16 ,

r_guid_16 type guid_16 ,

r_guid_32 type guid_32 .

* Retrieve data form Installed Base

select ib_guid_16

ibase

ibtyp

extid

authg

crnam

crtim

from ibib

into table t_ibib

where ibase in s_ibase.

if sy-subrc ne 0.

leave list-processing.

else.

sort t_ibib by ib_guid_16 ibase ascending.

delete adjacent duplicates from t_ibib comparing ib_guid_16 ibase.

endif.

* Process each Installed Base

loop at t_ibib into wa_ibib.

* Pass the IBASE details

wl_ibase_head-ibase = wa_ibib-ibase.

wl_ibase_head-guid_ibase = wa_ibib-ib_guid_16.

* Retrieve IBASE details

call function 'CRM_IBASE_GET_DETAIL'

exporting

i_ibase_head = wl_ibase_head

importing

e_ibib1 = tl_ibib1

e_ibibt1 = tl_ibibt1

e_struc_ibase_tab = tl_ibap_struc1

* TABLES

* ET_STATUS =

exceptions

not_specified = 1

doesnt_exist = 2

others = 3

.

if sy-subrc eq 0.

loop at tl_ibap_struc1 into wl_ibap_struc1 .

wa_instance-instance = wl_ibap_struc1-instance.

wa_instance-guid_compc = wl_ibap_struc1-guid_compc.

append wa_instance to t_instance.

Page 20: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 20

clear wa_instance.

wa_source_guid-objnr = wl_ibap_struc1-objnr.

append wa_source_guid to t_source_guid.

clear wa_source_guid.

wl_ibap_struc1-ibase = wa_ibib-ibase.

append wl_ibap_struc1 to t_ibap_struc1 .

clear wl_ibap_struc1.

endloop.

delete adjacent duplicates from t_instance comparing instance guid_compc .

* Delete adjacent duplicates product GUID

delete adjacent duplicates from t_source_guid comparing objnr.

* Retrieve the product details

select sourceguid

destinguid

link_partner_fct

from comm_il_prdbp

into table t_comm_il_prdbp

for all entries in t_source_guid

where sourceguid eq t_source_guid-objnr.

if sy-subrc eq 0.

* Retrieve Business partner values

select partner

partner_guid

from but000

into table tl_but000_c

for all entries in t_comm_il_prdbp

where partner_guid eq t_comm_il_prdbp-destinguid.

if sy-subrc eq 0.

loop at tl_but000_c into wl_but000_c.

move-corresponding wl_but000_c to wa_but000_c.

append wa_but000_c to t_but000_c.

clear: wa_but000_c , wl_but000_c.

endloop.

* Fetch the Address Number relevant to the Business Partner

select partner

addrnumber

from but020

into table tl_but020_c

for all entries in tl_but000_c

where partner eq tl_but000_c-partner.

if sy-subrc eq 0.

loop at tl_but020_c into wl_but020_c.

move-corresponding wl_but020_c to wa_but020_c.

append wa_but020_c to t_but020_c.

clear : wa_but020_c , wl_but020_c.

endloop.

* retrieve the address details

select addrnumber

street

streetcode

house_num1

post_code1

city1

city_code

Page 21: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 21

country

region

regiogroup

from adrc

into table tl_adrc_c

for all entries in tl_but020_c

where addrnumber eq tl_but020_c-addrnumber.

if sy-subrc eq 0.

loop at tl_adrc_c into wl_adrc_c.

move wl_adrc_c to wa_adrc_c.

append wa_adrc_c to t_adrc_c.

clear : wl_adrc_c , wa_adrc_c.

endloop.

endif.

endif.

endif.

endif.

* Retrieve the values from COMM_PRODCUT

select product_guid

product_id

product_type

object_family

logsys

from comm_product

into table tl_comm_product

for all entries in t_source_guid

where product_guid eq t_source_guid-objnr.

if sy-subrc eq 0.

loop at tl_comm_product into wl_comm_product.

move-corresponding wl_comm_product to wa_comm_product.

append wa_comm_product to t_comm_product.

clear: wa_comm_product , wl_comm_product.

endloop.

endif.

endif.

wl_i_ibase_head-ibase = wa_ibib-ibase.

wl_i_ibase_head-guid_ibase = wa_ibib-ib_guid_16.

* Fetch the Partner GUID

call function 'CRM_IBASE_GET_PARTNER'

exporting

i_ibase_head = wl_i_ibase_head

importing

e_partner_tab = tl_e_partner_tab

exceptions

not_specified = 1

doesnt_exist = 2

no_authority = 3

others = 4

.

if sy-subrc eq 0.

loop at tl_e_partner_tab into wl_e_partner_tab.

move-corresponding wl_e_partner_tab to wa_e_partner_tab.

append wa_e_partner_tab to t_e_partner_tab.

clear wa_e_partner_tab.

endloop.

Page 22: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 22

endif.

* Fetch the IBASE (HEADER LEVEL) details:

i_guid_16 = wa_ibib-ib_guid_16.

i_guid_32 = cl_ibase_service=>cl_convert_guid_16_32( i_guid_16 ).

select refguid

ref_partner_fct

ref_partner_no

from cdbd_ibpart

into table tl_cdbd_ibpart1

where refguid eq i_guid_32.

if sy-subrc eq 0.

loop at tl_cdbd_ibpart1 into wl_cdbd_ibpart1.

* IBASE GUID

r_guid_32 = wl_cdbd_ibpart1-refguid.

w_ibase_guid_16 = cl_ibase_service=>cl_convert_guid_32_16( r_guid_32 ).

wa_cdbd_ibpart-ib_guid_16 = w_ibase_guid_16.

wl_cdbd_ibpart-ib_guid_16 = w_ibase_guid_16.

clear : r_guid_32.

* Business Partner GUID

r_guid_32 = wl_cdbd_ibpart1-ref_partner_no.

w_partner_guid_16 = cl_ibase_service=>cl_convert_guid_32_16( r_guid_32 ).

wa_cdbd_ibpart-partner_guid = w_partner_guid_16.

wl_cdbd_ibpart-partner_guid = w_partner_guid_16.

move-corresponding wl_cdbd_ibpart1 to wa_cdbd_ibpart.

move-corresponding wl_cdbd_ibpart1 to wl_cdbd_ibpart.

append wa_cdbd_ibpart to t_cdbd_ibpart.

append wl_cdbd_ibpart to tl_cdbd_ibpart.

clear: wa_cdbd_ibpart , wl_cdbd_ibpart1 , wl_cdbd_ibpart , r_guid_32 ,

w_partner_guid_16 , wl_cdbd_ibpart.

endloop.

* Fetch the Business Partner Details:

select partner

partner_guid

from but000

into table tl_but000_h

for all entries in tl_cdbd_ibpart

where partner_guid eq tl_cdbd_ibpart-partner_guid.

if sy-subrc eq 0.

loop at tl_but000_h into wl_but000_h.

move-corresponding wl_but000_h to wa_but000_h.

append wa_but000_h to t_but000_h.

clear: wa_but000_h , wl_but000_h.

endloop.

* Fetch the Address Number relevant to the Business Partner(HEADER)

select partner

addrnumber

from but020

into table tl_but020_h

for all entries in tl_but000_h

where partner eq tl_but000_h-partner.

Page 23: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 23

if sy-subrc eq 0.

loop at tl_but020_h into wl_but020_h.

move-corresponding wl_but020_h to wa_but020_h.

append wa_but020_h to t_but020_h.

clear : wa_but020_h , wl_but020_h.

endloop.

* retrieve the address details

select addrnumber

street

streetcode

house_num1

post_code1

city1

city_code

country

region

regiogroup

from adrc

into table tl_adrc_h

for all entries in tl_but020_h

where addrnumber eq tl_but020_h-addrnumber.

if sy-subrc eq 0.

loop at tl_adrc_h into wl_adrc_h.

move wl_adrc_h to wa_adrc_h.

append wa_adrc_h to t_adrc_h.

clear : wl_adrc_h , wa_adrc_h.

endloop.

endif.

endif.

endif.

endif.

clear : tl_e_partner_tab.

endloop.

sort t_cdbd_ibpart by ib_guid_16 ref_partner_fct descending.

sort t_e_partner_tab by partner_number ascending.

endform. " SUB_RETRIVE_DATA

*&---------------------------------------------------------------------*

*& Form SUB_PREPARE_EXTRACT_DATA

*&---------------------------------------------------------------------*

* Prepare the final data for which the ALV GRID would be displayed

*----------------------------------------------------------------------*

form sub_prepare_extract_data .

data : wl_top type ib_parent ,

wl_sub type ib_root ,

wl_ptguid type crmt_ib_comp_guid ,

w_unit type msehi ,

wl_partner type bu_partner ,

w_string type string ,

w_date type sy-datum.

loop at t_ibib into wa_ibib.

wa_extract-ibase = wa_ibib-ibase.

wa_extract-ibase_guid = wa_ibib-ib_guid_16 .

Page 24: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 24

wa_extract-ibtyp = wa_ibib-ibtyp.

wa_extract-extid = wa_ibib-extid.

wa_extract-header_guid = wa_ibib-ib_guid_16 .

wa_extract-authg = wa_ibib-authg.

wa_extract-ib_crnam = wa_ibib-crnam.

w_string = wa_ibib-crtim+0(8).

wa_extract-ib_created_at = w_string+0(8).

wa_extract-ib_comp_flag = 'H'.

read table t_cdbd_ibpart into wa_cdbd_ibpart

with key ib_guid_16 = wa_ibib-ib_guid_16 binary search.

if sy-subrc eq 0.

read table t_but000_h into wa_but000_h

with key partner_guid = wa_cdbd_ibpart-partner_guid binary search.

if sy-subrc eq 0.

wa_extract-ib_ptn_num = wa_but000_h-partner.

wa_extract-ib_ptn_fct = wa_cdbd_ibpart-ref_partner_fct.

wl_partner = wa_but000_h-partner.

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'

exporting

input = wa_but000_h-partner

importing

output = wa_but000_h-partner.

read table t_e_partner_tab into wa_e_partner_tab

with key partner_number = wa_but000_h-partner binary search.

if sy-subrc eq 0.

wa_extract-ib_partnerset_1 = wa_e_partner_tab-partnerset.

endif.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = wa_but000_h-partner

importing

output = wa_but000_h-partner.

* Read address details

read table t_but020_h into wa_but020_h

with key partner = wa_but000_h-partner binary search.

if sy-subrc eq 0.

read table t_adrc_h into wa_adrc_h

with key addrnumber = wa_but020_h-addrnumber binary search.

if sy-subrc eq 0.

* Retrieve the Business Partner Address details (If asked for) -

HEADER Installed Base

endif.

endif.

endif.

endif.

append wa_extract to t_extract.

clear wa_extract.

loop at t_ibap_struc1 into wa_ibap_struc1 where ibase = wa_ibib-ibase.

wa_extract-ibase_guid = wa_ibap_struc1-guid_compc.

wa_extract-ibase = wa_ibib-ibase.

Page 25: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 25

wa_extract-ibtyp = wa_ibib-ibtyp.

wa_extract-extid = wa_ibib-extid.

wa_extract-header_guid = wa_ibib-ib_guid_16 .

wa_extract-authg = wa_ibib-authg.

wa_extract-ib_crnam = wa_ibib-crnam.

w_string = wa_ibib-crtim+0(8).

wa_extract-ib_created_at = w_string+0(8).

wa_extract-ib_comp_flag = 'C'.

read table t_instance into wa_instance

with key instance = wa_ibap_struc1-instance

guid_compc = wa_ibap_struc1-guid_compc binary search.

if sy-subrc eq 0.

wa_extract-ib_comp_number = wa_instance-instance.

wa_extract-ibase_guid = wa_instance-guid_compc.

endif.

wa_extract-ib_comp_refobj = wa_ibap_struc1-objnr.

wa_extract-ib_comp_devi_id = wa_ibap_struc1-deviceid.

wa_extract-ib_comp_number = wa_ibap_struc1-instance.

wa_extract-ib_comp_amount = wa_ibap_struc1-amount.

* Conversion exit for UNIT

call function 'CONVERSION_EXIT_CUNIT_OUTPUT'

exporting

input = wa_ibap_struc1-unit

* language = 'EN'

importing

output = w_unit

exceptions

unit_not_found = 1

others = 2.

if sy-subrc eq 0.

wa_extract-ib_comp_unit = w_unit.

endif.

*wa_extract-ib_comp_unit = wa_ibap_struc1-unit.

wa_extract-ib_comp_unit = w_unit.

* Product details

read table t_comm_product into wa_comm_product

with key product_guid = wa_ibap_struc1-objnr binary search.

if sy-subrc eq 0.

wa_extract-ib_comp_refob_id = wa_comm_product-product_id.

wa_extract-ib_comp_reftyp = wa_comm_product-product_type.

wa_extract-ib_comp_objfam = wa_comm_product-object_family.

wa_extract-ib_comp_logsys = wa_comm_product-logsys.

endif.

* Business Partner Details

read table t_comm_il_prdbp into wa_comm_il_prdbp

with key sourceguid = wa_ibap_struc1-objnr binary search.

if sy-subrc eq 0.

wa_extract-ib_ptn_fct = wa_comm_il_prdbp-link_partner_fct.

read table t_but000_c into wa_but000_c

with key partner_guid = wa_comm_il_prdbp-destinguid binary search.

if sy-subrc eq 0.

wa_extract-ib_ptn_num = wa_but000_c-partner .

Page 26: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 26

read table t_but020_c into wa_but020_c

with key partner = wa_but000_c-partner binary search.

if sy-subrc eq 0.

read table t_adrc_c into wa_adrc_c

with key addrnumber = wa_but020_c-addrnumber binary search.

if sy-subrc eq 0.

* Retrieve the Business Partner Item details (If asked for ) - COMPONENTS

endif.

endif.

endif.

endif.

if wa_ibap_struc1-parent eq '0'.

clear wl_ptguid.

wl_top = wa_ibap_struc1-instance.

wl_sub = '0'.

wa_extract-ib_comp_ptguid = wa_ibib-ib_guid_16.

wa_extract-ib_comp_parent = '0'.

wa_extract-ib_comp_root = wa_ibap_struc1-instance.

if wl_ptguid is initial.

wl_ptguid = wa_ibap_struc1-guid_compc.

endif.

else.

wl_sub = wl_top.

wa_extract-ib_comp_ptguid = wl_ptguid .

wa_extract-ib_comp_parent = wl_sub.

wa_extract-ib_comp_root = wl_top.

endif.

append wa_extract to t_extract.

clear : wa_extract , wa_adrc_c , wa_but000_c , wa_but020_c , wa_comm_il_prdbp ,

wa_comm_product , wa_ibap_struc1 , wa_instance .

endloop.

clear : wa_ibib.

endloop.

sort t_extract by ibase ib_comp_number ascending.

endform. " SUB_PREPARE_EXTRACT_DATA

*&---------------------------------------------------------------------*

*& Form SUB_DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

* Populate the FIELDCATALOGUE and display the output

*----------------------------------------------------------------------*

form sub_display_output .

* Populate the Fieldcatalogue

perform sub_fieldcat_populate.

* Display ALV GRID output display

perform sub_alv_display.

endform. " SUB_DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

Page 27: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 27

*& Form SUB_FIELDCAT_POPULATE

*&---------------------------------------------------------------------*

* Populate the Fieldcatalogue

*----------------------------------------------------------------------*

form sub_fieldcat_populate .

* Definition of Fieldcatalogue

data : wl_fieldcat_phsdcpc1 type slis_fieldcat_alv.

* Clearing work area of fieldcatalogue

clear wl_fieldcat_phsdcpc1.

* IBASE Guid

wl_fieldcat_phsdcpc1-col_pos = '1'.

wl_fieldcat_phsdcpc1-fieldname = 'IBASE_GUID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-002.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IBASE

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '2'.

wl_fieldcat_phsdcpc1-fieldname = 'IBASE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-003.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IBASE Category

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '3'.

wl_fieldcat_phsdcpc1-fieldname = 'IBTYP'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-004.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* External ID

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '4'.

wl_fieldcat_phsdcpc1-fieldname = 'EXTID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-005.

wl_fieldcat_phsdcpc1-outputlen = '15'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Header GUID

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '5'.

wl_fieldcat_phsdcpc1-fieldname = 'HEADER_GUID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-006.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Authorization Group (IBASE)

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '6'.

wl_fieldcat_phsdcpc1-fieldname = 'AUTHG'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-007.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* User Created

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '7'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_CRNAM'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-008.

Page 28: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 28

wl_fieldcat_phsdcpc1-outputlen = '15'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Installed Base Creation Date

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '8'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_CREATED_AT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-009.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Partner Function

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '9'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_PTN_FCT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-010.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Business Partner ID

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '10'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_PTN_NUM'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-011.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* UUID in character form

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '11'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_PARTNERSET_1'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-012.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* UUID in Character Form

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '12'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_PARTNERSET_2'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-013.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Street

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '13'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_STREET'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-014.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Street Code

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '14'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_STREETCODE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-015.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* House Number

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '15'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_HOUSE_NO'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-016.

Page 29: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 29

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* City postal code

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '16'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_POSTCODE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-017.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* City

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '17'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_CITY'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-018.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* City code for city/street file

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '18'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_CITY_CODE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-019.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Country Key

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '19'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COUNTRY'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-020.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Region

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '20'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_REGION'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-021.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Region group

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '21'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_REGIOGROUP'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-022.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Geo location longitude

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '22'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_LONGITUDE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-023.

wl_fieldcat_phsdcpc1-outputlen = '15'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Geo location latitude

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '23'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_LATITUDE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-024.

Page 30: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 30

wl_fieldcat_phsdcpc1-outputlen = '15'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Precision

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '24'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_PRECIS'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-025.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IB: Component (instance)

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '25'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_NUMBER'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-026.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IB: Identification

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '26'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_DEVI_ID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-027.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IB: Object Type

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '27'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_OBJ_TYPE'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-028.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IB: Component Assignment

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '28'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_REFOBJ'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-029.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Product ID

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '29'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_REFOB_ID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-030.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Product Type

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '30'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_REFTYP'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-031.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Object Family

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '31'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_OBJFAM'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-032.

Page 31: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 31

wl_fieldcat_phsdcpc1-outputlen = '4'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Original System

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '32'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_LOGSYS'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-043.

wl_fieldcat_phsdcpc1-outputlen = '15'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Language Key

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '33'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_MLANG'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-033.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Sort string

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '34'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_SORTF'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-034.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Amount

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '35'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_AMOUNT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-035.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Base Unit of Measure

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '36'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_UNIT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-036.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Characteristics for Installed Base or Component

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '37'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_FLAG'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-037.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Checkbox

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '38'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_DEL'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-038.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Parent

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '39'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_PARENT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-039.

Page 32: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 32

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* Top most component

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '40'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_ROOT'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-041.

wl_fieldcat_phsdcpc1-outputlen = '10'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

* IB: Component Assignment

clear wl_fieldcat_phsdcpc1.

wl_fieldcat_phsdcpc1-col_pos = '41'.

wl_fieldcat_phsdcpc1-fieldname = 'IB_COMP_PTGUID'.

wl_fieldcat_phsdcpc1-reptext_ddic = text-042.

wl_fieldcat_phsdcpc1-outputlen = '35'.

append wl_fieldcat_phsdcpc1 to t_fieldcat.

endform. " SUB_FIELDCAT_POPULATE

*&---------------------------------------------------------------------*

*& Form SUB_ALV_DISPLAY

*&---------------------------------------------------------------------*

* ALV Display

*----------------------------------------------------------------------*

form sub_alv_display .

* Populate the Layout table

wa_layout_ven-box_tabname = 'T_EXTRACT'.

* Display the Report Ouptut

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

is_layout = wa_layout_ven

it_fieldcat = t_fieldcat

tables

t_outtab = t_extract

exceptions

program_error = 1

others = 2

.

endform. " SUB_ALV_DISPLAY

Page 33: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 33

Related Content

help.sap.com

For more information, visit the EDW homepage

Page 34: SAP BW - Reconcile SAP CRM Installed Base Data With SAP BW Datasource

SAP BW - Reconcile SAP CRM Installed Base Data with SAP BW Datasource

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

© 2011 SAP AG 34

Disclaimer and Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported 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 or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.