26 Apr 2012

Very good Webinar on sapinsider about HANA. Its a webinar 60 mins which can be request through the site www.sapinsider.com

Title :
Learn How You Will Benefit from a Fully
In-Memory-Enabled SAP NetWeaver BW Powered by SAP HANA

25 Apr 2012

Following is youtube link which explains the BW architecture in very efficient way. The video needs to be appreciated in the way it captured the wholestic view and interaction between various sections in BW throughout version 3.5 , 7.0 .  Awaiting video on 7.3

http://www.youtube.com/watch?v=fovmnSIplpc ( BW 3.5 architecture)

http://www.youtube.com/watch?v=dCcyKmdwVYk (BW 7.0 archetecture)




15 Jul 2009

Scheduling Process Chain multiple times a day using Events

On high level, following are the Steps
1)Create an event Eg : 'Z_REDCOP_DAILY_LOAD_CHAIN_EVENT'
2)Create a Program to call the FM : BW_EVENT_RAISE by passing event id like below ( we used Z_BW_EVENT_RAISE here )
3)Create a Job at frequency of 2 hours.( in SM36 ).In the step information of the job specify the above program created
4)Specify the eventid in the process chain start variant also.

Explanation : Step 1
a) Goto Sm62.
b) Open last tab
c) Click on Creat button and give technical name/desc of the event.


Explanation : Step 2
REPORT ZBW_EVENT_TRIGGER_PROGRAM.
DATA : EVENTID LIKE TBTCO-EVENTID.
DATA : DATE TYPE SY-DATUM.

DATE = SY-DATUM.
IF DATE+06(02) LE 16.
EVENTID = 'Z_REDCOP_DAILY_LOAD_CHAIN_EVENT'.

CALL FUNCTION 'Z_BW_EVENT_RAISE'
EXPORTING
EVENTID = EVENTID
EXCEPTIONS
BAD_EVENTID = 1
EVENTID_DOES_NOT_EXIST = 2
EVENTID_MISSING = 3
RAISE_FAILED = 4
BP_EVENT_RAISE_OTHERS = 5
OTHERS = 6
.
IF SY-SUBRC <> 0.
ENDIF.

ENDIF.

Explanation : Step 3
a) Open Sm36.
b) Give Job name and target system. Save

c) If it asks for ABAP program then give our program name ( if notClick on STEP button and it will ask ). Give variants if necessary.

d) Click save. It shows :

e) Now go back to main screen and click on start condition and give 2 hours periodic setting there.
f) Save.
g) Check in Sm37 if job is scheduled….


Explanation : Step 4

Specify the eventid in your Start variant of the process Chain.

30 May 2009

Calculation on data which is split into different packages

During the data load data is split by data packets and the start routine in update rule is applied packet by packet. It is hence not possible to do calculation in start routine which requires a group of the records as they
could be split in to different packets.

Solution1 :
In reference to the blog
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3f91f628-0b01-0010-9da8-9e7ca2cbb104

we have mark the infopackage to load the data only upto to PSA.Then we extract data of PSA , apply our logic for calculation and write back to PSA. After we can update data from PSA to data targets.
That is,
The ABAP for reading the PSA data and writing back to PSA is in four sections
a- Get the request number ( call FM : RSSM_API_REQUEST_GET )
b- Get data ( call FM : RSAR_ODS_API_GET )
c- Change Data ( Custom code to do the calculations that you want )
d- Write data back to PSA ( Call FM : RSAR_ODS_API_PUT )

Solution2:
If your loading data from and ODS to any data target. Then we follow this approach.
You can write a custom program to update the active table of the source ODS.
As active table is a flat table, you can easily do your calculations using a custom program and update the active table. Following is the program i tried for my requirment :

REPORT ZBW_SORTING_HR.

DATA: IT_RESULTS LIKE /BIC/AZPT_O0200 OCCURS 0 WITH HEADER LINE.
DATA: WA_TEMP LIKE /BIC/AZPT_O0200.
DATA: IT_SORTED1 LIKE /BIC/AZPT_O0200 OCCURS 0 WITH HEADER LINE.
DATA: KEY3(255) TYPE C,KEY1(255) TYPE C, KEY2(255) TYPE C.
DATA: END_DATE LIKE /BIC/AZPT_O0200-calday.
DATA: START_DATE LIKE /BIC/AZPT_O0200-calday.
clear : it_results.

SELECT * FROM /BIC/AZPT_O0200 INTO TABLE IT_RESULTS.

SORT it_results by
EMPLOYEE
CALDAY
REPTT
UNIT.

clear : wa_temp,it_sorted1.
clear : key1,key2,start_date,end_date.

LOOP AT IT_RESULTS INTO WA_TEMP.

CONCATENATE WA_TEMP-EMPLOYEE WA_TEMP-REPTT INTO KEY1.

IF KEY2 = KEY1.
END_DATE = WA_TEMP-CALDAY.
WA_TEMP-/BIC/ZDAY_TO = END_DATE.
WA_TEMP-/BIC/ZDAY_FROM = START_DATE.
ELSE.
START_DATE = WA_TEMP-CALDAY.
END_DATE = WA_TEMP-CALDAY.
WA_TEMP-/BIC/ZDAY_TO = END_DATE.
WA_TEMP-/BIC/ZDAY_FROM = START_DATE.

ENDIF.

KEY2 = KEY1.

APPEND WA_TEMP TO IT_SORTED1.
endloop.

UPDATE /BIC/AZPT_O0200 FROM TABLE IT_SORTED1.

20 May 2009

Templates for Start Routine

Following is the sample code for start routine in Transformation :

DATA: WA_TEMP TYPE DATA_PACKAGE_STRUCTURE, KEY1(255) TYPE C, KEY2(255)
TYPE C.
DATA: KEY3(255) TYPE C.
DATA: END_DATE LIKE DATA_PACKAGE-CALDAY.
DATA: START_DATE LIKE DATA_PACKAGE-CALDAY.

SORT DATA_PACKAGE BY
EMPLOYEE
CALDAY
REPTT
UNIT.

LOOP at DATA_PACKAGE INTO WA_TEMP.

CONCATENATE WA_TEMP-EMPLOYEE WA_TEMP-REPTT INTO KEY1.

IF KEY2 = KEY1.
END_DATE = WA_TEMP-CALDAY.
WA_TEMP-/BIC/ZDAY_TO = END_DATE.
WA_TEMP-/BIC/ZDAY_FROM = START_DATE.
ELSE.
START_DATE = WA_TEMP-CALDAY.
END_DATE = WA_TEMP-CALDAY.
WA_TEMP-/BIC/ZDAY_TO = END_DATE.
WA_TEMP-/BIC/ZDAY_FROM = START_DATE.

ENDIF.


KEY2 = KEY1.

MODIFY DATA_PACKAGE FROM WA_TEMP.

ENDLOOP.

18 Mar 2009

Dynamic table name in select statement in ABAP

Here is a sample code piece used :

DATA name_snp_chn(20) TYPE c VALUE '/bic/azmmiv_sc00'.
DATA name_snp_usa(20) TYPE c VALUE '/bic/azmmiv_sU00'.
DATA name_snp_eur(20) TYPE c VALUE '/bic/azmmiv_sE00'.
DATA name_snp(20) TYPE c VALUE '/bic/azmmiv_os00'.

DATA name_mov_chn(20) TYPE c VALUE '/bic/azmmiv_2c00'.
DATA name_mov_usa(20) TYPE c VALUE '/bic/azmmiv_2U00'.
DATA name_mov_eur(20) TYPE c VALUE '/bic/azmmiv_2E00'.
DATA name_mov(20) TYPE c VALUE '/bic/azmmiv_o200'.

DATA : BEGIN OF ITAB OCCURS 0,
FACALID LIKE /BI0/MPLANT-FACTCAL_ID,
END OF ITAB.

if I_ZREGION = 'CHN'.
name_snp = name_snp_chn.
name_mov = name_mov_chn.
elseif I_ZREGION = 'USA'.
name_snp = name_snp_usa.
name_mov = name_mov_usa.
elseif I_ZREGION = 'EUR'.
name_snp = name_snp_eur.
name_mov = name_mov_eur.
endif.



IF i_test = 'X'.
BREAK-POINT.
* xl_plant = 'AA'.
* xl_stor_loc = '7000'.
* xl_material = '000000000000010712'.

xl_plant = 'RYAN'.
xl_stor_loc = '7000'.
xl_material = '000000000007519620'.

* xl_plant = 'CL00'.


SELECT * FROM (name_snp)
INTO CORRESPONDING FIELDS OF TABLE io_snapshot
WHERE plant EQ xl_plant
AND stor_loc EQ xl_stor_loc
AND material EQ xl_material.
ENDIF.

17 Mar 2009

Where to check for code used in extractor of DS

Goto to RSA2 in source system.
Give the datasource.
Check the extractor details. Click on the extractor. It will open the code.