0% found this document useful (0 votes)
17 views17 pages

S07 B4H Datasource Enhancement+-+Part+2

The document outlines the activation and enhancement processes for data sources in SAP BW/4HANA, including the use of ODP and ODQ frameworks. It details the steps for datasource activation, enhancement using BAdIs, and the operational data provisioning concepts. Additionally, it addresses common questions and issues related to data extraction and provides code examples for enhancing data sources.

Uploaded by

Sipin CP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views17 pages

S07 B4H Datasource Enhancement+-+Part+2

The document outlines the activation and enhancement processes for data sources in SAP BW/4HANA, including the use of ODP and ODQ frameworks. It details the steps for datasource activation, enhancement using BAdIs, and the operational data provisioning concepts. Additionally, it addresses common questions and issues related to data extraction and provides code examples for enhancing data sources.

Uploaded by

Sipin CP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

S07_B4H_Datasource & Enh - Part 2

B4H - Datasource 1. LO Cockpit DS activation. 22nd Aug: 8:30 AM - 10:30 AM


Activation and 2. LO Cockpit DS Enhancement
Enhancement RSU5_SAPI_BADI
ODP and ODQ 1. ODP concept 22nd Aug: 8:30 AM - 10:30 AM
2. ODQs and Delta
3. Delta from stnd datasources - 2LIS_
11_VAHDR/ITM
4. CDS View Intro
5. Datasource based on CDS View -
Full.
6. Datasource based on CDS View -
Delta
(Generic w/o ODQs)
7. Datasource based on CDS View -
Delta
(Generic with ODQs)
8. Enhancing datasource based on CDS
views using extension CDS Views.

Batch_2 Page 1
Q & A Session

Devi Noticed, 2LIS_02_SCN/SGR are still non odp data sources in BW4HANA. If IP is not in functionality, how the delta will be
captured from S4?
How DTP DTIS variates with the old error stack?
how export datasource works in BW4HANA

Shakthi Getting error while trying to get data from Table Function. Attaching the code and error in the "TF Error" tab.
What is Mixed Scenario in SAP BW
How to enable ODP so that we get an entry in ROOSATTR table
Is BADI, the default way to enhance DS in SAP BW on HANA as well?
Any reason for LO extractors alone to have setup table?
Do the delta gets extracted everytime from Set up table? will we be filling setup table everyday to pick the data from source ?
How OpenHub Destinations works
/bic/oh<>
is there any limits for no. of enhancement spots to be created in a BADI?

Vijay RODPS_REPL_TEST (https://wiki.scn.sap.com/wiki/display/BI/Replication+test+with+RODPS_REPL_TEST)


Request your view on this.

Altaf Altaf Shaik


1. What is delta merge?
2. What is hybrid modeling?

Batch_2 Page 2
Batch_2 Page 3
Datasource activation process

Process 1. RSA5 - Activation


2. RSA6 - Check, Save and Generate
3. LBWE (LO Cockpit)
1. Maintain extract structure
2. Maintain Datasource
3. Activate the delta mechanism
4. Delete setup table
5. Dummy entry in ODQ
PGM: RODPS_REPL_TEST
6. Fill setup table
7. Check data (RSA3)

4. Release the DS for ODP.


1. SAP Stnd Datasources - BS_ANLY_DS_RELEASE_ODP
a. ROOSATTR ; Flag should be 'X'.
2. Stnd datasources only for S4 will automatically be exposed.
For ECC/ECC on HANA, you'll have to expose even the Stnd datasources.
3. Custom Datasources - RODPS_OS_EXPOSE

5. Enhance the structure (MCVBAK)


1. Extract Structure - The list of fields which gets transferred to BW.
2. Communication Structure - For LO Cockpit, list of fields in the parent structure.
6. Add the newly added field from CommStruc to ExtractStruc.
7. Write the logic to populate the value for the new field via BADI (RSU5_SAPI_BADI).
8. Test the logic (RSA3)

Batch_2 Page 4
Datasource Enhancement

Steps 1. Check the CommStruc if they field is present.


2. Enhance the structure.
3. Transfer the field from CommStruct to ExtStruct.
4. Write the code for the new fields.
5. Fill the setup table again via tcode.
6. Test the data in the new fields.
Old method Function Module (User Exits) based Enhancement:

Traditionally, we used an SAP Enhancement RSAP0001 in a custom project.


Go to transaction CMOD and put all coding inside:

Transaction data exit_saplrsap_001


Attributes exit_saplrsap_002
Texts exit_saplrsap_003
Hierarchies exit_saplrsap_004

BADI BADI =
• List of Interfaces (list of empty methods - only definition, no implementation)

Batch_2 Page 5
• List of Interfaces (list of empty methods - only definition, no implementation)
• Class which implements the methods of the Interfaces
▪ List of interfaces
▪ Interface has empty methods
▪ Implementing Class for the Interface will be there.
New Method Enhancing DataSources with BAdI RSU5_SAPI_BADI (Classic BADI).

▪ As of SAP_BASIS 6.20 and PI_BASIS 2004_1 (R/3 Release 4.6C), a new way is available to enhance
a standard datasources which is a more efficient way to enhance SAP standard content, using Business
Add-Ins (BAdIs) rather than user exits.
▪ The technical name of this BAdI is RSU5_SAPI_BADI, detailed on the SAP Note 691154.
▪ Two ways:
○ Each datasource is implemented as a separate BADI implementation and Z Class.
○ Each datasource is implemented as a separate method within the same implementation and class.
▪ Create a template method for the developers to copy from.
▪ Declare the variables
▪ Declare Field Symbol for extract structure
▪ Check if C_T_DATA is not initial.
▪ Get details of datasource (RSA1_SINGLE_OLTPSOURCE_GET)
▪ If no details fetched, then exit.
▪ Create data for extract structure
▪ Get Method Name from datasource.
▪ Remove the first character.
▪ Call the datasource method.
Important variable C_T_DATA: This is where the datasource stores all the extracted data.
to remember I_DATASOURCE: This stores the name of the datasource.

Batch_2 Page 6
ODP & ODQ Framework - Intro

ODP ▪ With SAP BW/4HANA, Operational Data Provisioning (ODP) now becomes the central infrastructure for data extraction and
replication from SAP (ABAP) applications to a SAP BW/4HANA Data Warehouse.
▪ Operational Data Provisioning (ODP) is an SAP Netweaver based Framework that became available from BW 7.40.
▪ For SAP BW it's recommended to use ODP for the implementation of new extraction and replication scenarios
from SAP (ABAP) applications.

Before

After

Before and After

Batch_2 Page 7
Salient features • Enables “extract once, deploy multiple times” architectures for data sources.
of ODQ For example, BW and BODS can extract from the same delta queue (ODQ) of the extractor.

• Highly efficient data compression (>90%).

• Supports real-time (Daemon based - streaming process chains) or regularly scheduled loads.

• Parallelisation options for subscribers in high volume scenarios.

• Monitoring of the PSA is replaced with that of the ODQ (Transaction code: ODQMON).

• Data cannot be changed in ODQ (a feature that previously did exist with the PSA).
• Two Type of Request –
• A composite request transfers data from one or more queues that have been grouped together into a subscription
• An extraction request transfers queue data from the provider to the queue storage

A composite request can contain several extraction requests.

• There are different types of data requests:


• Subscribers can request a data snapshot (full or one-off request).
This is supported by almost any BW DataSource and does not require a subscription.
• Subscribers can request data changes (delta request).
This requires to create a subscription first (delta initialization) and usually to transfer the initial data.
This is supported only by some BW DataSources, in one of the following two ways:
▪ The application pushes data into the delta queue
▪ The delta queue pulls data into the delta queue via an extractor

Subscription
Concept

Prerequisite ▪ For SAP_BASIS less than release 730,


ODP 1.0 is available for ECC Systems (SAP Note 1521883)

▪ For SAP_BASIS greater than or equal to release 730,


ODP 2.0 is available for your ECC System.
(SAP Note 1931427)

▪ ODP 1.0 vs ODP 2.0 - SAP Note 2481315

Batch_2 Page 8
Types of
Subscribers

FAQs Handy Link: https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=449284646

• What are the pre-requisites for ODP enabled extractors

ODQ 1. Maintains a highly optimized (compressed) queue.


2. The document flow is:
▪ Queue
▪ Subscriptions to that queue
▪ Requests under that subscription
▪ Units/LUWs
▪ Data in that request
Tcode: ODQMON:

Batch_2 Page 9
Tables in ODQ The ODQ uses three tables to store data:

1. ODQDATA_C
Contains compressed Init request data
2. ODQDATA
Contains compressed Delta request data
3. ODQDATA_F
Contains Full request data (a.k.a data snapshots)

DTP’s fetch data directly from the ODQ. The first time you run a DTP, the ODQ performs a delta initialisation where a request for the DataSource is generated, and table ODQDATA_C is
filled. In the second run, the ODQ does a delta update with those records that were created or changed (including deletions) since the last load. The delta records are stored in the
ODQDATA table in a compressed format.

Handy Tools

Data Retention ▪ The data in ODQ is retained for reconciliation and recovery.
▪ We can control how long to keep the queue’s data after it has been successfully sent to all targets.
▪ The default is 24 hours for any data in the queue that is flagged as retrieved or as cancelled.
▪ The job to reorganise delta queues is created by default when delta initialisation request is executed from
the subscriber, e.g. BW.
▪ The time and schedule of the job can be changed manually by program ODQ_CLEANUP or by selecting
“Reorganize delta queues” under the Goto menu in transaction ODQMON (Figure 6).

Batch_2 Page 10
There are 3 choices for retention:

▪ To recover a delta process that has been canceled:


This is the minimum retention period for data in the queue tables that is flagged as retrieved in the delta process or as can celed.
The default setting is 24 hours.

▪ For data with low relevance:

• It has not yet been declared as retrieved or invalid


• All subscribers have subscribed to it with low relevance.

This period is given in days. The default is 10 days.

▪ For data with medium relevance:


Once this period has elapsed, the periodic reorganization process deletes all data in the queue that meets the following cond itions:
• It has not yet been declared as retrieved or invalid
• All subscribers have subscribed to it with at most medium relevance.

This period is given in days. The default is 31 days (4 weeks plus an extra weekend).
Classification of relevance of data.

Data-relevance

▪ Data that has not yet been retrieved and is business critical is never automatically deleted by the reorganization
process.

▪ At present, the system does not make any relevance-related distinction of delta data.
All data in the delta queue is considered business-critical and is therefore not deleted until it has been flagged as either retrieved or invalid.

▪ Because of the particularly high volume expected, data from delta initialization requests and standard requests is also classified as being
of low relevance.

Delta Types Delta Type ‘D’ – The SAP application writes delta records directly into ODQ (PUSH) for ODP extractors
for ODQ with delta type ‘D’. E.g. LO Cockpit Datasource delta.

Delta Type ‘E’ – The ODP data source determines the delta through the extractor on request.
The extractor must be capable of providing the delta records for the DataSource on demand (PULL).
E.g. FI Datasources (0FI_GL_4)

Real-time When we start a process chain in streaming mode, a daemon process is automatically scheduled in the
Daemon in ODQ delta queue (known as the ODQ daemon). If the daemon process is already schedules,
it adds new subscriptions to the process in real-time mode.

Batch_2 Page 11
it adds new subscriptions to the process in real-time mode.

The daemon is automatically removed from scheduling if the last subscription is cancelled, if the
associated connector is not scheduled any more for real-time indexing.

Procedure.

You monitor the daemon process in the delta queue for real-time processing (ODQ daemon) in the
Delta Queue Monitor by choosing

GoTo->Real-Time Daemon .

You can schedule the daemon manually here if required.

▪ Monitor Daemon Process


By pressing
We can call the Job Selection screen, where all daemon jobs from the last 24 hours are listed.

By pressing
We can call the job overview, where you can call each job's job log.

▪ Manually Schedule Daemon Process


If the daemon process had to be stopped, you can schedule it again by pressing
with the default settings for Period (15 minutes) and Takt Cycle (15 seconds).

If you want to schedule the daemon process with settings other than the default settings,
you can enter the Period in Minutes and the Takt Time in Seconds and schedule the process by pressing

System Demo 2LIS_11_VAHDR (SALES DOC HEADER)


Setup tables are empty
Clear the queues
Init
Delta

Batch_2 Page 12
Important Links

B4H Help Portal https://help.sap.com/viewer/product/SAP_BW4HANA/2.0.5/en-US


SAP Site for Simplification List https://launchpad.support.sap.com/#/sic/
B4H Simplification List https://launchpad.support.sap.com/#/notes/2421930

Batch_2 Page 13
Code Blocks

Enhancing MCVBAK @EndUserText.label : 'Adding Material Attributes'


@AbapCatalog.enhancementCategory : #EXTENSIBLE_CHARACTER_NUMERIC
extend type mcvbak with zamat_attr {
mtart : mtart;
name1 : name1;
land1 : land1;

}
DS Specific Zclass class ZCL_IM_ZRSU5_2LIS_11_VAHDR definition
public
final
create public .

public section.

interfaces IF_EX_RSU5_SAPI_BADI .
protected section.
private section.
ENDCLASS.

CLASS ZCL_IM_ZRSU5_2LIS_11_VAHDR IMPLEMENTATION.

method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.

* FIELD-SYMBOLS: <ls_data> TYPE mc11va0hdr.


*
* CASE i_datasource.
* when '2LIS_11_VAHDR'.
*
* LOOP AT C_T_DATA ASSIGNING <ls_data>.
*
* SELECT from kna1 as a
* FIELDS a~name1, a~land1
* where a~kunnr = @<ls_data>-kunnr
* into ( @<ls_data>-name1, @<ls_data>-land1 ).
* ENDSELECT.
*
* ENDLOOP.
*
* WHEN OTHERS.
** Don't do anything'
*
* endcase.

endmethod.

method IF_EX_RSU5_SAPI_BADI~HIER_TRANSFORM.
endmethod.
ENDCLASS.
Common ZClass

Class Entire Code class ZCL_IM_ZRSU5_BW_EXTRACTION definition


public
final
create public .

public section.

Batch_2 Page 14
public section.

interfaces IF_EX_RSU5_SAPI_BADI .

class-methods _DATASOURCE_TEMPLATE
importing
value(I_DATASOURCE) type RSAOT_OLTPSOURCE
value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
value(I_T_SELECT) type SBIWA_T_SELECT
value(I_T_FIELDS) type SBIWA_T_FIELDS
changing
!C_T_DATA type ANY TABLE
!C_T_MESSAGES type RSU5_T_MESSAGES optional
exceptions
RSAP_BADI_EXIT_ERROR .
**********************************************************************
*Definition for 2LIS_11_VAHDR
**********************************************************************
class-methods LIS_11_VAHDR
importing
value(I_DATASOURCE) type RSAOT_OLTPSOURCE
value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
value(I_T_SELECT) type SBIWA_T_SELECT
value(I_T_FIELDS) type SBIWA_T_FIELDS
changing
!C_T_DATA type ANY TABLE
!C_T_MESSAGES type RSU5_T_MESSAGES optional
exceptions
RSAP_BADI_EXIT_ERROR .
**********************************************************************
*Definition for 2LIS_11_VAITM
**********************************************************************
class-methods LIS_11_VAITM
importing
value(I_DATASOURCE) type RSAOT_OLTPSOURCE
value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
value(I_T_SELECT) type SBIWA_T_SELECT
value(I_T_FIELDS) type SBIWA_T_FIELDS
changing
!C_T_DATA type ANY TABLE
!C_T_MESSAGES type RSU5_T_MESSAGES optional
exceptions
RSAP_BADI_EXIT_ERROR .
**********************************************************************
*Definition for 2LIS_11_VAKON
**********************************************************************
class-methods LIS_11_VAKON
importing
value(I_DATASOURCE) type RSAOT_OLTPSOURCE
value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
value(I_T_SELECT) type SBIWA_T_SELECT
value(I_T_FIELDS) type SBIWA_T_FIELDS
changing
!C_T_DATA type ANY TABLE
!C_T_MESSAGES type RSU5_T_MESSAGES optional
exceptions
RSAP_BADI_EXIT_ERROR .
class-methods LIS_02_HDR
importing
value(I_DATASOURCE) type RSAOT_OLTPSOURCE
value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
value(I_T_SELECT) type SBIWA_T_SELECT
value(I_T_FIELDS) type SBIWA_T_FIELDS
changing
!C_T_DATA type ANY TABLE
!C_T_MESSAGES type RSU5_T_MESSAGES optional
exceptions
RSAP_BADI_EXIT_ERROR .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS ZCL_IM_ZRSU5_BW_EXTRACTION IMPLEMENTATION.

METHOD if_ex_rsu5_sapi_badi~data_transform.

DATA: ls_OLTPSOURCE TYPE rsaot_s_osource,


lo_data TYPE REF TO data,
lv_method TYPE seocmpname.

FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.

CHECK c_t_data IS NOT INITIAL.

Batch_2 Page 15
CALL FUNCTION 'RSA1_SINGLE_OLTPSOURCE_GET'
EXPORTING
i_oltpsource = i_datasource
i_objvers = 'A'
IMPORTING
e_s_oltpsource = ls_oltpsource
EXCEPTIONS
no_authority = 1
not_exist = 2
inconsistent = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.

CREATE DATA lo_data TYPE TABLE OF (ls_oltpsource-exstruct).


ASSIGN lo_data->* TO <lt_data>.
ASSIGN c_t_data TO <lt_data>.

* Get method name


lv_method = i_datasource.

CASE lv_method(1).
WHEN '0' OR '2'.
SHIFT lv_method.
WHEN OTHERS.
* Do Nothing
ENDCASE.

* Call the datasource specific method


try.
CALL METHOD (lv_method)
EXPORTING
i_datasource = i_datasource
i_updmode = i_updmode
i_t_select = i_t_select
i_t_fields = i_t_fields
CHANGING
c_t_data = <lt_data>
c_t_messages = c_t_messages.
CATCH cx_sy_dyn_call_illegal_method.
ENDTRY.

ENDMETHOD.

METHOD if_ex_rsu5_sapi_badi~hier_transform.
ENDMETHOD.

METHOD LIS_02_HDR.

**********************************************************************
* Copy this template 2LIS_02_HDR method and
* implement the code according to the requirement
* Don't change the code here.
**********************************************************************

FIELD-SYMBOLS: <ls_data> TYPE mc02m_0hdr.

LOOP AT c_t_data ASSIGNING <ls_data>.

SELECT FROM ekko AS a


FIELDS a~zterm, a~inco1, a~procstat
WHERE a~ebeln = @<ls_data>-ebeln
INTO ( @<ls_data>-zzterm, @<ls_data>-zzico1, @<ls_data>-zzprocstat ).

ENDSELECT.

SELECT FROM ekpa AS b


FIELDS b~lifn2
WHERE b~ebeln = @<ls_data>-ebeln
INTO ( @<ls_data>-zzlifn2 ).
ENDSELECT.

ENDLOOP.
ENDMETHOD.

METHOD lis_11_vahdr.

**********************************************************************
*Logic for 2LIS_11_VAHDR
**********************************************************************

Batch_2 Page 16
**********************************************************************

FIELD-SYMBOLS: <ls_data> TYPE mc11va0hdr.

LOOP AT c_t_data ASSIGNING <ls_data>.

SELECT FROM kna1 AS a


FIELDS a~name1, a~land1, a~regio
WHERE a~kunnr = @<ls_data>-kunnr
INTO ( @<ls_data>-name1, @<ls_data>-land1, @<ls_data>-regio ).
ENDSELECT.

ENDLOOP.
ENDMETHOD.

METHOD lis_11_vaitm.

**********************************************************************
*Logic for 2LIS_11_VAITM
**********************************************************************

FIELD-SYMBOLS: <ls_data> TYPE mc11va0ITM.

LOOP AT c_t_data ASSIGNING <ls_data>.

SELECT FROM mara AS a


FIELDS a~mtart
WHERE a~matnr = @<ls_data>-matnr
INTO ( @<ls_data>-mtart ).
ENDSELECT.

ENDLOOP.
ENDMETHOD.

METHOD lis_11_vakon.

FIELD-SYMBOLS: <ls_data> TYPE mc11va0kon.

LOOP AT c_t_data ASSIGNING <ls_data>.

SELECT FROM mara AS a


FIELDS a~magrv
WHERE a~matnr = @<ls_data>-matnr
INTO ( @<ls_data>-magrv ).
ENDSELECT.

ENDLOOP.
ENDMETHOD.

METHOD _datasource_template.

**********************************************************************
* Copy this template datasource method and
* implement the code according to the requirement
* Don't change the code here.
**********************************************************************

* FIELD-SYMBOLS: <ls_data> TYPE mc11va0hdr.


*
* LOOP AT c_t_data ASSIGNING <ls_data>.
*
* SELECT FROM kna1 AS a
* FIELDS a~name1, a~land1
* WHERE a~kunnr = @<ls_data>-kunnr
* INTO ( @<ls_data>-name1, @<ls_data>-land1 ).
* ENDSELECT.
*
* ENDLOOP.
ENDMETHOD.
ENDCLASS.

Batch_2 Page 17

You might also like