SAP BW .....all info @ one place
SAP BW relevant Information
Loading
Showing posts with label customer exit. Show all posts
Showing posts with label customer exit. Show all posts

Ref: SDN Wiki
Author: Ramakrishna Gattikoppula

Scenario
In BW Queries very often there is a requirement to restrict a characteristic with some values to get the correct result. Let us say we have a requirement where we need to restrict the query to only those Departments for which the Department ID starts with D1 or D2. This will be very simple task when there are limited number of Departments IDs starting with D1 or D2, but what if there are many Departments whose ID starts with D1 or D2.

Solution
This Can be achieved using a Customer Exit Variable.

Following are the steps you need to perform to restrict the characteristic with values having certain pattern.

Step1: Create a New Variable(say ZVAR_DEPT) on the Characteristic Department with following properties.

Type of Variable: Characteristic Value.
Processing By: Customer Exit.
Variable Represents: Multiple Single Values.
Variable Entry is: Mandatory, Not Ready for Input and Cannot be changed in Query Navigation

Step 2: Restrict the Characteristic with the variable ZVAR_DEPT.

Step 3: Go to Transaction SE37 and enter "EXIT_SAPLRRS0_001". In the next screen double click on "ZXRSRU01", this will take you to the screen where you can define Customer exit code for Global Variables in Reporting.

Step 4: Include the following code in the Customer Exit code.

WHEN 'ZVAR_DEPT'.
IF I_STEP = 1.
DATA: ITAB1 TYPE STANDARD TABLE OF /BI0/SDEPT_ID WITH HEADER LINE.
SELECT * FROM /BI0/SDEPT_ID INTO TABLE ITAB1 WHERE DEPT_ID LIKE 'D1%' OR DEPT_ID LIKE 'D2%'.
CLEAR: L_S_RANGE.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
LOOP AT ITAB1.
L_S_RANGE-LOW = ITAB1-DEPT_ID.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
CLEAR L_S_RANGE.
ENDIF.


 

Requirement may come up to add new fields to LO cockpit extractor which is up & running in production environment. This means the extractor is delivering daily deltas from SAP R/3 to BW system .Since this change is to be done in R/3 Production system, there is always a risk that daily deltas of LO cockpit extractor would get disturbed. If the delta mechanism is disturbed (delta queue is broken) then there no another way than doing re-initialization for that extractor. However this re-init is not easy in terms of time & resource. Moreover no organization would be willing to provide that much downtime for live reporting based on that extractor.
As all of us know that initialization of LO Extractor is critical, resource intensive & time consuming task. Pre-requisites to perform fill setup tables are - we need to lock the users from transactional updates in R/3 system, Stop all batch jobs that update the base tables of the extractor. Then we need to schedule the setup jobs with suitable date ranges/document number ranges.
We also came across such scenario where there was a requirement to add 3 new fields to existing LO cockpit extractor 2LIS_12_VCITM. Initialization was done for this extractor 1 year back and the data volume was high.We adopted step by step approach to minimize the risk of delta queue getting broken /disturbed. Hope this step by step procedure will help all of us who have to work out similar scenarios.
Step by Step Procedure:-
1.Carry out changes in LO Cockpit extractor in SAP R/3 Dev system.As per the requirement add new fields to Extractor.These new fields might be present in standard supporting structures that you get when you execute "Maintain Data source" for extractor in LBWE. If all required fields are present in supporting structure mentioned above then just add these fields using arrow buttons provided and there is no need to write user exit code to populate these new fields.However if these fields (or some of the required fields) are not present in supporting structures then you have to go for append structure and user exit code. The coding in user exit is required to populate the newly added fields. You have to write ABAP code in User exit under CMOD & in Include ZXRSAU01.All above changes will ask you for transport request. Assign appropriate development class/Package and assign all these objects into a transport request.
2.Carry out changes in BW Dev system for objects related to this change.Carry out all necessary changes in BW Dev system for objects related to this change (Info source, transfer rules, ODS, Info cubes, Queries & workbooks). Assign appropriate development class/Package and assign all these objects into a transport request
3.Test the changes in QA system.Test the new changes in SAP R/3 and BW QA systems. Make necessary changes (if needed) and include them in follow-up transports.
4.Stop V3 batch jobs for this extractor.V3 batch jobs for this extractor are scheduled to run periodically (hourly/daily etc) Ask R/3 System Administrator to put on hold/cancel this job schedule.
5.Lock out users, batch jobs on R/3 side & stop Process chain schedule on BW.In order to avoid the changes in database tables for this extractor and hence possible risk of loss of data, ask R/3 System Administrator to lock out the users. Also batch job schedule need to be put on hold /cancel.Ask System Administrator to clear pending queues for this extractor (if any) in SMQ1/SMQ2. Also pending /error out v3 updates in SM58 should be processed.On BW production system the process chain related to delta Info package for this extractor should be stopped or put on hold.
6.Drain the delta queue to Zero for this extractor.Execute the delta Info package from BW and load the data into ODS & Info cubes. Keep executing delta Info package till you get 0 records with green light for the request on BW side. Also you should get 0 LUW entries in RSA7 for this extractor on R/3 side.
7.Import R/3 transports into R/3 Production system.In this step we import R/3 transport request related to this extractor. This will include user exit code also. Please ensure that there is no syntax error in include ZXRSAU01 and it is active. Also ensure that objects such as append structure is active after transport.
8.Replicate the data source in BW system.On BW production system, replicate the extractor (data source).
9.Import BW transport into BW Production system.In this step we import BW transport related to this change into BW Production system.
10.Run program to activate transfer rulesExecute program RS_TRANSTRU_ACTIVATE_ALL. Enter the Info source and source system name and execute. This will make sure that transfer rules for this Info source are active
11.Execute V3 job Manually in R/3 sideGo to LBWE and click on Job Control for Application area related to this extractor (for 2LIS_12_VCITM it is application 12). Execute the job immediately and it should finish with no errors.
12.Execute delta Info package from BW systemRun delta Info package from BW system. Since there is no data update, this extraction request should be green with zero records (successful delta extraction)
13.Restore the schedule on R/3 & BW systemsAsk System Administrator to resume V3 update job schedule, batch job schedule and unlock the users. On BW side, restore the process chains schedule.From next day onwards (or as per frequency), you should be able to receive the delta for this extractor with data also populated for new fields.

 

How to Papers, related to BW direct download

Google
 

Recent Posts

SAP Jobs