Calculations in Update rules/Start routine/End Routine
Hi Friends,
I have loaded data to a DSO and i have three fields in to it. Lets say Filed1, Filed2 and Field3. Field1 and Field2 are being populated through an update rule in transformation. Aggregation type for these two fields are "Summation".
Now, after the transformation executed, the Field1 and Field2 are filled with values. I want to calculate the value of Field3 as follows:
Field3 = Field1 - Field2
Can anyone tell me where can i do this calculation? I know we can do this in End routine and in Query but i want to know if there is any other place i can do this calculation in transformation? In try to do this calculation in the update rule for Field3 in transformation, i dont see Field1 and Field2 as these are not source fields. I can not write formula also because we can write formula only on source fields not the data target fields.
Your help will be appreciated in terms of points.
Thanks,
manmit
Hi,
in the start routine in the global section define the two fields:
data: g_amount1 type /bic/oi<your keyfigure name>,
g_amount2 type /bic/oi<your keyfigure name>.
in the routines to your 2 keyfigures store the result in that fields too.
routine for field1.
g_amount1 = result.
routine for field2.
g_amount2 = result.
and in the routine to field3
result = g_amount1 - g_amount2." or whatever calculation/derivation has to be done.
kind regards
Siggi
Message was edited by:
Siegfried Szameitat
Similar Messages
-
How to determine InfoCube name within the update rule start routine?
We are attempting to delete all the records where all key figure values are zeroes. We have about 15% of such records and we really don't need them.
We have yearly InfoCubes. We copy the InfoCube and update rules at the end of every year. So, we don't want to hard code any field names within the update rules.
If I could determine the target InfoCube name within the update rule start routine, I can find out all the key figures dynamically. But, I don't see a way of finding out the InfoCube name.
If you would share any ideas, I would really appreciate.
Thanks.
Sudhi Karkada.Hi Sudhi,
I dont know if this is what you are looking for.
if you want to delete a record from being inserted when all the Key figure values are ZERO then you can use a Update Routine for some characteristic in the below way
If looking for the InfoCube:
if COMM_STRUCTURE-KF1 = 0 and COMM_STRUCTURE-KF2 AND....
RETURNCODE = 4.
else
RESULT = COMM_STRUCTURE-ChanracteristicObject.
endif.
If it is to an ODS / InfoCube in the start routine.
DELETE DATAPACKAGE where KF1=0 and kf2=0 and .....
Hope it helps.
Regards,
Praveen.
ENDLOOP.
Message was edited by: Praveen -
How to delete data from a DSO using start or end routine
Is it possible to delete records from a DSO in the start or end routine.
My example: I have order 123, item 10, sched line 1. This gets loaded into the DSO.
Next day I have order 123, item 10, sched line 2 coming in.
I want to delete the first one (with sched line 1) from the DSO and load the second one (with sched line 2).
Can code be put in the start or end routine to do this?unless I can do it within the start routine I don't want to have to create new records.
In the start routine I am comparing records coming in with what are already in the DSO. If there is a match on order and item and the sched line is different, then I want to delete the record from the DSO and load the new one. Is there code that I can put in a start routine to accomplish this? -
VA42 user exit to update contract start and end dates at Item level
Hi Experts,
I need to update contract start and end dates at Item level in 'VA42' transaction, for this i am using user-exit 'USEREXIT_FIELD_MODIFICATION' in the include 'MV45AFZZ'. i am able to display the data into item level through my coding but the data is not getting updated into 'VEDA'
Note: No need to change contract start date and end date in header level. Only at item level i want to change dates.
Thanks,
Sateesh.Thanks For your reply Vikram,
i tried with 'USEREXIT_MOVE_FIELD_TO_VBAP' user-exit earlier it self its not working. Can you suggest me any another way how we can achieve this functionality. modification of Contract start date and end date in only item level.
'USEREXIT_MOVE_FIELD_TO_VBAP':
FORM USEREXIT_MOVE_FIELD_TO_VBAP.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(3) Form USEREXIT_MOVE_FIELD_TO_VBAP, Start A
*$*$-Start: (3)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZSD_CONT_DATE. "active version
DATA : lv_var TYPE CHAR10.
lv_var = '0040000219'.
if sy-tcode = 'VA42'.
IF VBAK-VBELN EQ lv_var.
VEDA-VBEGDAT = '20140502'.
XVEDA-UPDKZ = 'X'.
VEDA-VENDDAT = '20140602'.
XVEDA-UPDKZ = 'X'.
ENDIF.
ENDIF.
ENDENHANCEMENT. -
Update Contract Start and End dates via BAPI_SALESORDER_CREATEFROMDAT2
Hi Experts.
We are successfully using BAPI_SALESORDER_CREATEFROMDAT2 to create sales order.
Only problem is that the contract start and end date do not get updated.
We are passing that in ORDER_HEADER_in-CT_VALID_F and ORDER_HEADER_IN-CT_VALID_T.
After debugging, I found that there is one more table SALES_CONTRACT_IN in SD_SALESDOCUMENT_CREATE. Updating the values in that table works.
But the problem is this table is not available in BAPI_SALESORDER_CREATEFROMDAT2. How to update Contract start and end dates from this FM ?
I could not find anything in the search of this forums. So I guess this is not an issue and I am doing something wrong. Can someone suggest to me please?
Thanks in adv.
AishiAre you creating a contract or a sales order?
-
Calculation in update rule/routine in order to modify DATA_PACKAGE
Hello all,
I want to load some finance data from two ODS objects into an InfoCube. In the update rule I have build a start routine in order to compare two values of two internal tables (itab1 and itab2) which gets loaded with data from the both ODS.
When the value of the itab1 is higher of itab2 then I want to subtract the value from itab2 from itab1.
After that I want to MODIFY the DATA_PACKAGE in order to update later the cube with an new lower value.
The DATA_PACKAGE is defined as standard table as well as itab1 and itab 2 but I get the error message that the line type is not compatible.
How I have to build the MODIFY statement in order to calculate and update values in the DATA_PACKAGE?
Any helps would be great.
Best regards from Munich/Germany,
Stefan LeontiadisHi Stefanos,
My thought is probably not the best in terms of performance, but it should work. The problem you'll hit is not having the entire data set from both ODS Object loads in memory at the same time.
To cover this, you can declare a table in the global section of the start routine, let's call it GT_REF_DATA. Next, perform a SELECT ffrom <other ODS Object> FOR ALL ENTRIES IN DATA_PACKAGE WHERE <selection> into GT_REF_DATA in the local section of the start routine.
In the individual update routine, you can do a READ TABLE GT_REF_DATA INTO LS_REF_DATA WITH KEY <selection> to get the record you want to compare.
Here's where you have to be careful. If I understand your logic right, you can do:
IF LS_REF_DATA-field < COMM_STRUCTURE-field.
RESULT = COMM_STRUCTURE-field - LS_REF_DATA-field.
ELSE.
RESULT = COMM_STRUCTURE-field.
ENDIF.
That avoids processing everything in the start routine and your MODIFY problem. If you prefer the start routine, you can work with the DATA_PACKAGE directly. Just remember that DATA_PACKAGE has a header line, so you can simply LOOP AT DATA_PACKAGE, change the value in DATA_PACKAGE, then MODIFY DATA_PACKAGE.
The way I prefer to do things is to create a separate internal table that is the same type as DATA_PACKAGE. I fill the internal table with all values to store to the InfoCube (even those you don't change from DATA_PACKAGE). At the end of the routine, CLEAR DATA_PACKAGE then APPEND LINES OF itab TO DATA_PACKAGE.
I know there's lots of options above. Let me know if I got your logic wrong or you have questions.
Cheers,
Adam -
What are start and end routines in BI 7.0..
Hi,
Can you please explain and give me a sample code ?
thanksHi,
depending on your data flow you have to use the routines .
Start routines - start routines:
It is used to perform preliminary calculations.if you have any modifications required before the actual transformation is done, then you must write those routines in the start routine of 7.0.
End routines - new:
You can use an end routine to postprocess data after transformation on a package-by-package basis.
Expert routine - update routine :
You can use the expert routine if there are not sufficient functions to perform a transformation. The expert routine should be used as an interim solution until the necessary functions are available in the standard routine. You can use this to program the transformation yourself without using the available rule types. If you have already created transformation rules, the system deletes them once you have created an expert routine.
Also Check the below link for detail info.
Routine in Transformation.
Reg
Pra -
Hi All,
In BI 7 we have a start routine and end routine. In end routine we delete all the transformed records that need not be updated to the infocube. Which we can also do it in the start routine. In that case Y do we need a End routine.
Regards.Hi,
1. Start Routine : whenever you create a start routine, the system will automatically give you some predefined data declaration like structure of the type of your source. In start routine you can declare a local data declaration and Global data declaration also. I will give one example.
Suppose you are creating Start routine for transformation from Datasource to DSO. Then when you create start routine the System will provide you a structure of your datasource. By using this structure it will also define an internal table which will be used as changing parameter of a method of a class. It is this changing parameter where you have to do all sorts of manipulation. The changing parameter is both export as well as import parameter. This changing parameter will contain data in the package wise.
In start routine you can also read some database table and store that data into an internal table and this internal table data can then be read in the field level routine. In this case it acts as a substitute of master data look up in the field level transformation.
2. End routine : The end routine is also same as start routine, the only difference is that here the system will provide you with a structure of the target not the source. and rest is all same as start routine.
assign points if it helps
Thanks & Regards
santo -
Updating Cube in the End Routine based on the incoming Valid From Date
Hello Experts
Here is my scenario.
We are using BW 7.x. There is DSO and from DSO it goes to the Cube, the promotions information. These data targets will have Material (Article), Plant (Site), Promotions Number, Valid from and Valid to dates. The Valid To date will come in as 12/31/9999 all the time.
If I receive a new record from ECC with same Material, Plat and Promotion combination again, I need to get the Valid From Date from the new record and Update the existing record' Valid To date in DSO/Cube as Valid From of the new record - 1.
So Valid To date of the existing record = New Record's Valid From date minus - 1.
I would like to do the update in "End Routine" of the Cube.
Would you please suggest if this can be done and if so would you please provide the sample code.
THANK YOU in Advance.
Nag.yes, you can do this...
just use a RESULT_PACKAGE in end routine.
and using RESULT_PACKAGE fatch the existing records from DSO and append that into RESULT_PACKAGE after your desired changes,
just try to create a code using this l;ogic. if you can't then i will provide you a code.
Regards,
Ashish -
KPI calculations in Update Rules
hi friends,
i am loading data from 7 different datasources into 5 ODS at Item level, and loading the data from these ODS into 5 cubes which is at the header level, no item data is loaded in the infocubes. from the 5 cubes(sales,delivery,shipment,billing and 1 POD custom cube) i have to load the data in to 1 higher level basic cube(its not a multi provider). at this higer level infocube im calculating the KPI's in update rules. here comes my problem, in the KPI calculation i have to do the validation, some of the KPI's are as follows.
deliv_numb = deliv_numb (pod).
deliv_item = deliv_item (pod).
my question is i dont have item info in delivery cube, in this case how do i compare the
DELIV_ITEM = DELIV_ITEM (POD).
I am reading it this way.
0DELIV_NUMB = COMM_STRUCT-DELIV_NUMB. (POD)
0DELIV_ITEM = /BIC/ZAXXXX-DELIV_ITEM. (POD).
i want to know whether what i am doing is right, or if im wrong can anyone please tell me the correct way of doing it.
friends this is a bit urgent, plz let me know the best way of doing it.
thanx a lot in advance.
Regards
AnanthProbably you also have 0DELIV_ITEM in your comunication structure even if you don't need it in the final cube.
Otherwise, it's right to use /BIC/ZAXXXX-DELIV_ITEM. (POD) but you have to do the select before.
Hope it help you.
Regards.
Paolo -
VA42 user exit to update contract start and end dates at header
Hi.
My requirement : In VA42, if a user changes a contract end date at item level, I want the change to be reflected at header level automatically.
I have looked in MV45AFZZ, USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE. I am unable to affect the contract end date in those user exits, whatever I put in VEDA-VENDDAT or XVEDA-VENDDAT or whateverVEDA-VENDDAT, does not have any effect on the actual contract dates.
Can anyone help?
Please note that we are running 46C.
Thank you.Thanks For your reply Vikram,
i tried with 'USEREXIT_MOVE_FIELD_TO_VBAP' user-exit earlier it self its not working. Can you suggest me any another way how we can achieve this functionality. modification of Contract start date and end date in only item level.
'USEREXIT_MOVE_FIELD_TO_VBAP':
FORM USEREXIT_MOVE_FIELD_TO_VBAP.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(3) Form USEREXIT_MOVE_FIELD_TO_VBAP, Start A
*$*$-Start: (3)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZSD_CONT_DATE. "active version
DATA : lv_var TYPE CHAR10.
lv_var = '0040000219'.
if sy-tcode = 'VA42'.
IF VBAK-VBELN EQ lv_var.
VEDA-VBEGDAT = '20140502'.
XVEDA-UPDKZ = 'X'.
VEDA-VENDDAT = '20140602'.
XVEDA-UPDKZ = 'X'.
ENDIF.
ENDIF.
ENDENHANCEMENT. -
BW 3.5 Update rule routine and start routine convert to BI 7.0 Endroutine.
I have bw 3.5 update routine and update rules start routine( r/3 to ODS). i need to replicate that routine into BI 7.0 endroutine with the same logic with some minor changes(DSO to DSO).
IN BW 3.5 the data is getting from r/3 where as in BI7.0 the data fetching from DSO itself but the logic is same as bw 3.5.
following is the start routine:
DATA: G_FISCPER_TO TYPE /BI0/OIFISCPER,
G_CALMONTH LIKE /BI0/PCALMONTH-CALMONTH,
G_MONAT TYPE /BIC/OIYRDFMONAT.
ABORT = 0.
------ Globale Variable füllen --------------------------------------*
CALL FUNCTION 'Y_RDF_FISCPER_FOR_INFOPACKAGE'
EXPORTING
I_ISOURCE = '0FI_AA_001' (*** this is infosurce getting from r/3, in 7.0 this one is DSO 'B")
IMPORTING
E_FISCPER_TO = G_FISCPER_TO
E_MONAT = G_MONAT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
CALL FUNCTION 'Y_RDE_FISCPER_TO_CALMONTH'
EXPORTING
I_PERIV = 'K4'
I_BDATJ = G_FISCPER_TO(4)
I_POPER = G_FISCPER_TO+4(3)
IMPORTING
E_CALMONTH = G_CALMONTH
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0 OR G_CALMONTH IS INITIAL.
CALL FUNCTION 'Y_RDN_MONITOR_SET'
EXPORTING
I_MSGID = 'YRDFBW'
I_MSGNO = '027'
I_MSGV1 = '0FI_AA_001'
I_MSGV2 = 'YRDF_FIAA_PERIOD'
TABLES
T_MONITOR = MONITOR.
ABORT = 1.
ENDIF.
ELSE.
CALL FUNCTION 'Y_RDN_MONITOR_SET'
EXPORTING
I_MSGID = 'YRDFBW'
I_MSGNO = '027'
I_MSGV1 = '0FI_AA_001'
I_MSGV2 = 'YRDF_FIAA_PERIOD'
TABLES
T_MONITOR = MONITOR.
ABORT = 1.
ENDIF.
Update routine:
RETURNCODE = 0.
ABORT = 0.
CLEAR RESULT.
IF NOT COMM_STRUCTURE-ASSET_MAIN BETWEEN '000000200000' AND
'000000299999'.
CALL FUNCTION 'Y_RDF_GET_CCTR_0ASSET'
EXPORTING
I_COMP_CODE = COMM_STRUCTURE-COMP_CODE
I_ASSET = COMM_STRUCTURE-ASSET
I_ASSET_MAIN = COMM_STRUCTURE-ASSET_MAIN
IMPORTING
E_COSTCENTER = RESULT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0 OR RESULT IS INITIAL.
CALL FUNCTION 'Y_RDN_MONITOR_SET'
EXPORTING
I_MSGID = 'YRDFBW'
I_MSGTY = 'E'
I_MSGNO = '061'
I_MSGV1 = COMM_STRUCTURE-COMP_CODE
I_MSGV2 = COMM_STRUCTURE-ASSET
I_MSGV3 = COMM_STRUCTURE-ASSET_MAIN
TABLES
T_MONITOR = MONITOR.
RETURNCODE = 1.
ENDIF.
ENDIF.
How can i write this in BI7.0?
ThanksHi ,
solved on my own. Thankyou very much..
thanks & regards,
M.S
Edited by: M.S on Oct 27, 2009 6:57 AM
Edited by: M.S on Oct 27, 2009 6:59 AM -
Thumbrule for Start/End Routines Usage
Friends,
Is there any thumb rule to decide when to use start or end routine in BW 7 in transformations ? Can anybody provide a scenario for demonstration .. from performing simple lookups on different DSOs to get descriptions vs any other specific scenarios.. Is there any scenario in which only start or only end routine can be performed.. ?
Any thoughts would be great..?
thanks,
SunilStart routine is totally concerned with source data , where you need to write logic for source_package.
Start routine will execute before transformation execution.
Executes packageby package.
loop at source_package into source-feilds.
End routine works on target structure and we have lo write logic on result_package.
Genarally dso lookups are concerned with end routines.
loop at result_package into result-feilds.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e
http://forums.sdn.sap.com/thread.jspa?threadID=1963087
Regards,
rvc -
Check if a DSO has been lookup by other DSO/cube in start/end routine
I have to support on of the client system which I am not part of the development.
I found one DSO has been schedule to load data in daily process chain but it is not update to any target.
Is it possible to check if this DSO has been using in the staging i.e look up the reference field by other cube/DSO in start or end routine ?Hi,
Possible by invoking respective field into code part.
I think not much stuff required in this regard.
Thanks - RK -
Hi Gurus,
I am trying to extract one custom keyfigure from 0EMPLOYEE masterdata to 0PA_C01 cube,
Global declarations include
data: begin of i_s_employee,
l_zfte1 type /bic/mzemployee-/bic/zfte,
end of i_s_employee.
data: i_t_employee like table of i_s_employee.
Start of end routine includes
data: e_s_result type tys_TG_1.
data: e_t_result type tyt_TG_1.
read table i_t_employee index 1 transporting no fields.
if sy-subrc = 4.
select /bic/zfte from /bic/mzemployee into corresponding
fields of table
i_t_employee
where objvers = 'A'
and dateto <= sy-datum
and /bic/zemployee <> ''.
if sy-subrc = 4.
raise exception type CX_RSROUT_ABORT.
endif.
endif.
loop at RESULT_PACKAGE into e_s_result.
read table i_t_employee into i_s_employee with key l_zfte1 =
e_s_result-/bic/zfte.
endloop.
loop at i_t_employee into i_s_employee where l_zfte1 =
e_s_result-/bic/zfte.
append e_s_result to e_t_result.
endloop.
*refresh RESULT_PACKAGE.
move e_t_result[] to RESULT_PACKAGE[].
Nothing gets updated to cube and there are also no syntax errors. Please can anyone tell me where i am making mistakes/overlooking.
any help greatly appreciated.
Best Regards,
Reddy.hi reddy,
did you solve this problem?
i have same problem now and trying to solve.
Maybe you are looking for
-
Borderless printing with iPhoto/Canon iP8600?
Does anyone know if it is possible to print borderless photos with iPhoto? I have a new Canon iP8600 that features borderless printing, but I've not been able to get it to work with iPhoto. The paper options for borderless printing are there, but the
-
Maintain CUBE through back end
Hii I want to write a procedure which generate CUBE from back end. Is is possible? What is the method? Aneesh
-
Isight and built in microphone not working. Is that normal??
Hi there, is it normal if I can't use the built in microphone and I can't set it up also for the cam I found the same problem? There is a lack of drivers maybe? Please let me know, cheers!!!
-
I get a strange error when I try to join my dimensions in order to map the cube - as I do not want to use key lookups (I do not neet outer join!): First error message box: "Trying to access invalid Object" Trying to access invalid Object Trying to ac
-
Xpath checker v0.4.4 not installed with firefox v29.0.1
Hi, Which version xpath checker use for Firefox v29.0.1