ABAP Routine in Transformations Syntax Correction
Hi,
As i am beginner in ABAP please correct the Start/End routine which i have written in Transformations for the below requirement
DSO1------->DSO2
While load data to DSO1-->DSO2 in need a look that refer active table of DSO3 and perform if condition to fill value to a field in DSO2
DSO1 (SOURCE FIELDS)
Field X
Field Y (X,Y are Key fields)
Field Z
Field W
DSO2 (Result Field)
Field P (The field which i want to update with Value by routine)
DSO3 (Look up)
Field A
Field B (A,B are Key fields) (A=X,B=Y)
Field C
Requirement: While loading data from DSO1-->DSO2...We should read active table of DSO3 and pass it to Internal Table (A,B,C)with a key (A=X,B=Y) and in the end routine First check wether
if Field C is not initial...then Result Field P should be updated with E
ELSE CHECK SOURCE FIELD Field Z = 1..then Result Field P should be updated with F
ELSE CHECK SOURCE FIELD Field W = T..then Result Field P should be updated with G
else if all the above conditions are not met .then Result Field P should be updated with H
Syntax i wrote (Not working correctly)
Declaration-Global
TYPES: BEGIN OF ty_sou,
W TYPE /bi0/W,
Z TYPE /bi0/Z, END OF ty_sou,
BEGIN OF ZDSO_3,
A TYPE /bi0/oiA,
B TYPE /bi0/oiB,
C TYPE /bi0/oiC, END OF ZDSO_3.
DATA : ty_ZDSO_3_wa TYPE ZDSO_3,
ty_ZDSO_3_tab TYPE TABLE OF ZDSO_3,
ty_ZDSO_3_tab_temp TYPE TABLE OF ZDSO_3.
DATA : ty_sou_tab TYPE TABLE OF ty_sou,
ty_sou_wa TYPE ty_sou.
Routine Start
LOOP AT SOURCE_PACKAGE ASSIGNING .
IF -XIS NOT INITIAL AND -Y IS NOT INITIAL.
ty_ZDSO_3_wa-A = -X.
ty_ZDSO_3_wa-B = -Y.
ty_sou_wa-Z = -Z.
ty_sou_wa-W = -W.
COLLECT ty_sou_wa INTO ty_sou_tab.
COLLECT ty_ZDSO_3_wa INTO ty_ZDSO_3_tab.
ENDIF.
ENDLOOP.
*Select Statement to select values from ZDSO_3 Active Table
SELECT A B C FROM /bic/aZDSO_300 INTO TABLE ty_ZDSO_3_tab_temp FOR ALL ENTRIES IN ty_ZDSO_3_tab WHERE
A = ty_ZDSO_3_tab-A.
SORT ty_ZDSO_3_tab BY A B.
Routine End
But this is not working...i tried to debug but as i am a learner in ABAP i am not familiar.... Please advise me where or what is wrong with my code and greatful if you can make changes
Edited by: SAP7593 on Jan 21, 2010 7:56 AM
Edited by: SAP7593 on Jan 21, 2010 7:56 AM
Routine End
LOOP AT RESULT_PACKAGE ASSIGNING<RESULT-FIELD>-/ .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa
with key A = -P B = -Q binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<RESULT-FIELD>-/BIC/P = 'E'.
ELSEIF ty_sou_wa-Z = 1.
<RESULT-FIELD>-/-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<RESULT-FIELD>-/-/BIC/P = 'G'.
ELSE.
<RESULT-FIELD>-/-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP.
Similar Messages
-
ABAP routine in Transformations syntax fix
Hi
As i am beginner in ABAP please correct the Start/End routine which i have written in Transformations for the below requirment
DSO1------->DSO2
While load data to DSO1-->DSO2 in need a look that refer active table of DSO3 and perform if condition to fill value to a field in DSO2
DSO1 (SOURCE FIELDS)
Field X
Field Y (X,Y are Key fields)
Field Z
Field W
DSO2 (Result Field)
Field P (The field which i want to update with Value by routine)
DSO3 (Look up)
Field A
Field B (A,B are Key fields) (A=X,B=Y)
Field C
Requirement:
While loading data from DSO1-->DSO2...We should read active table of DSO3 and pass it to Internal Table (A,B,C)with a key (A=X,B=Y)
and in the end routine
First check wether if Field C is not initial...then Result Field P should be updated with E
ELSE CHECK SOURCE FIELD Field Z = 1..then Result Field P should be updated with F
ELSE CHECK SOURCE FIELD Field W = T..then Result Field P should be updated with G
else if all the above conditions are not met .then Result Field P should be updated with H
Syntax i wrote (Not working correctly)
GLOBAL DECLARATION:
TYPES:
BEGIN OF ty_sou,
W TYPE /bi0/W,
Z TYPE /bi0/Z,
END OF ty_sou,
BEGIN OF ZDSO_3,
A TYPE /bi0/oiA,
B TYPE /bi0/oiB,
C TYPE /bi0/oiC,
END OF ZDSO_3.
DATA : ty_ZDSO_3_wa TYPE ZDSO_3,
ty_ZDSO_3_tab TYPE TABLE OF ZDSO_3,
ty_ZDSO_3_tab_temp TYPE TABLE OF ZDSO_3.
DATA : ty_sou_tab TYPE TABLE OF ty_sou,
ty_sou_wa TYPE ty_sou.
START ROUTINE
$$ begin of routine - insert your code only below this line -
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
IF <source_fields>-XIS NOT INITIAL AND
<source_fields>-Y IS NOT INITIAL.
ty_ZDSO_3_wa-A = <source_fields>-X.
ty_ZDSO_3_wa-B = <source_fields>-Y.
ty_sou_wa-Z = <source_fields>-Z.
ty_sou_wa-W = <source_fields>-W.
COLLECT ty_sou_wa INTO ty_sou_tab.
COLLECT ty_ZDSO_3_wa INTO ty_ZDSO_3_tab.
ENDIF.
ENDLOOP.
*Select Statement to select values from ZDSO_3 Active Table
SELECT A B C
FROM /bic/aZDSO_300 INTO TABLE ty_ZDSO_3_tab_temp FOR ALL
ENTRIES IN
ty_ZDSO_3_tab WHERE A = ty_ZDSO_3_tab-A.
SORT ty_ZDSO_3_tab BY A B.
END ROUTINE
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields> .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa with key
A = <result_fields>-P
B = <result_fields>-Q
binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<result_fields>-/BIC/P = 'E'.
ELSEIF
ty_sou_wa-Z = 1.
<result_fields>-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<result_fields>-/BIC/P = 'G'.
ELSE.
<result_fields>-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP.
But this is not working...i tried to debug but as i am a learner in ABAP i am not familiar....
Please advise me where or what is wrong with my code and greatful if you can make changesRoutine End
LOOP AT RESULT_PACKAGE ASSIGNING<RESULT-FIELD>-/ .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa
with key A = -P B = -Q binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<RESULT-FIELD>-/BIC/P = 'E'.
ELSEIF ty_sou_wa-Z = 1.
<RESULT-FIELD>-/-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<RESULT-FIELD>-/-/BIC/P = 'G'.
ELSE.
<RESULT-FIELD>-/-/BIC/P = 'H'.
ENDIF.
Endif.
ENDLOOP. -
Write ABAP routine in transformation rule
Dear all,
I am very new to ABAP. Currently I would like to transfer some data from cube A to cube B. The problem is
Cube A and B have different Unit of Mesure. The product standard cost is based on each Item's UOM. For example:
Cube A data:
ItemNo } UOM } Standard cost
ABC } P5 } 30
Cube B data:
ItemNo } UOM } Standard cost
ABC } EACH } 5 (30/5)
In transformation rule, I plan to use ABAP routine to calculate each record to new Stand cost if Cube A has different UOM than Cube B.
Can I call a program in this ABAP routine?
In ABAP routine, how can I delare other source table and fields?
Thanks for you help!The preferable method, if you're on BI 7 or later, is to create a filter in the DTP so that the records where 0CLR_DOC_NO is blank aren't even passed into the Transformation.
If not, then you can add the following code into the Start Routine of your Transformation.
DELETE
source_package
WHERE
clr_doc_no EQ ' '. -
Convert Date to Week - ABAP Routine in transformation
Hi all,
I am trying to convert a date to a week using ABAP in a transformation.
The date is coming from an external database and has the format YYYYMMDD. I want to convert this into the standard 0CALWEEK format.
I thought that converting the date to the SAP internal format, and then running DATE_GET_WEEK on it, would work. Firstly I am running the FM 'CONVERSION_EXIT_PDATE_OUTPUT' to get the date into the DDMMYYYY format then running DATE_GET_WEEK on the result of the first FM.
This works up until the end of the first step; the internal date format is returned. However, the code fails when it hits the 'DATE_GET_WEEK' FM.
I would be really grateful if someone could tell me where I am going wrong. Thanks, Mischa
My code so far is:
DATA:
WEEK(6) TYPE C,
CS_DT(8) TYPE C,
TEMP_DT TYPE D,
RESULT1 TYPE D.
CLEAR RESULT.
CLEAR RESULT1.
CS_DT = SOURCE_FIELDS-CASE_DT.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
INPUT = CS_DT
IMPORTING
OUTPUT = TEMP_DT
MOVE TEMP_DT TO RESULT1.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = RESULT1
IMPORTING
WEEK = WEEK
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
RESULT = WEEK.Hi all,
Thanks for your replies, but the automatic conversion doesn't work. I assume this is because the source field is a CHAR field with 8 characters, rather than a Date field as recognised by SAP. Literally the field contains 8 characters YYYYMMDD for example 20090601.
If I try to assign directly, I get the error
"Automatic time conversion is not possible for source field CASE_DT
Cannot establish automatic time conversion to 0CALWEEK for source field CASE_DT. The source is a DataSource and consists of fields, not InfoObjects. Time conversion can only be performed automatically for InfoObjects."
This is why I assumed I needed some ABAP code. I have tried assigning the time char 0CALDAY to my source field CASE_DT in the transformation, and this is not accepted either - I get the message
"The properties of the InfoObject selected, 0CALDAY, do not match the properties of the available source field."
Again, grateful for any help.
Mischa -
ABAP in BW Tranformations Syntax Correction
Hi,
As i am beginner in ABAP please correct the Start/End routine which i have written in Transformations for the below requirement
DSO1------->DSO2
While load data to DSO1-->DSO2 in need a look that refer active table of DSO3 and perform if condition to fill value to a field in DSO2
DSO1 (SOURCE FIELDS)
Field X
Field Y (X,Y are Key fields)
Field Z
Field W
DSO2 (Result Field)
Field P (The field which i want to update with Value by routine)
DSO3 (Look up)
Field A
Field B (A,B are Key fields) (A=X,B=Y)
Field C
Requirement: While loading data from DSO1-->DSO2...We should read active table of DSO3 and pass it to Internal Table (A,B,C)with a key (A=X,B=Y) and in the end routine First check wether
if Field C is not initial...then Result Field P should be updated with E
ELSE CHECK SOURCE FIELD Field Z = 1..then Result Field P should be updated with F
ELSE CHECK SOURCE FIELD Field W = T..then Result Field P should be updated with G
else if all the above conditions are not met .then Result Field P should be updated with H
Syntax i wrote (Not working correctly)
Declaration-Global
TYPES: BEGIN OF ty_sou,
W TYPE /bi0/W,
Z TYPE /bi0/Z, END OF ty_sou,
BEGIN OF ZDSO_3,
A TYPE /bi0/oiA,
B TYPE /bi0/oiB,
C TYPE /bi0/oiC, END OF ZDSO_3.
DATA : ty_ZDSO_3_wa TYPE ZDSO_3,
ty_ZDSO_3_tab TYPE TABLE OF ZDSO_3,
ty_ZDSO_3_tab_temp TYPE TABLE OF ZDSO_3.
DATA : ty_sou_tab TYPE TABLE OF ty_sou,
ty_sou_wa TYPE ty_sou.
Routine Start
LOOP AT SOURCE_PACKAGE ASSIGNING .
IF -XIS NOT INITIAL AND -Y IS NOT INITIAL.
ty_ZDSO_3_wa-A = -X.
ty_ZDSO_3_wa-B = -Y.
ty_sou_wa-Z = -Z.
ty_sou_wa-W = -W.
COLLECT ty_sou_wa INTO ty_sou_tab.
COLLECT ty_ZDSO_3_wa INTO ty_ZDSO_3_tab.
ENDIF.
ENDLOOP.
*Select Statement to select values from ZDSO_3 Active Table
SELECT A B C FROM /bic/aZDSO_300 INTO TABLE ty_ZDSO_3_tab_temp FOR ALL ENTRIES IN ty_ZDSO_3_tab WHERE
A = ty_ZDSO_3_tab-A.
SORT ty_ZDSO_3_tab BY A B.
But this is not working...i tried to debug but as i am a learner in ABAP i am not familiar.... Please advise me where or what is wrong with my code and greatful if you can make changesRoutine End
LOOP AT RESULT_PACKAGE ASSIGNING<RESULT-FIELD>-/ .
Read table ty_ZDSO_3_tab_temp into ty_ZDSO_3_wa
with key A = -P B = -Q binary search.
If sy-subrc = 0.
IF ty_ZDSO_3_wa-C IS NOT INITIAL.
<RESULT-FIELD>-/BIC/P = 'E'.
ELSEIF ty_sou_wa-Z = 1.
<RESULT-FIELD>-/-/BIC/P = 'Fu2019.
ELSEIF ty_sou_wa-W= 'T'.
<RESULT-FIELD>-/-/BIC/P = 'G'.
ELSE.
<RESULT-FIELD>-/-/BIC/P = 'H'.
ENDIF.
Endif. -
Explain me the (ABAP) Routine in Transformation
Hi,
Can any one explain me what this code doing
This is written to cal age of emp based on DOB as a routine in Transpormation
if i_week ne SOURCE_FIELDS-/bic/week_kbc.
clear: i_period, i_year, i_date, i_week.
i_week = SOURCE_FIELDS-/bic/week_kbc.
i_year = SOURCE_FIELDS-/bic/week_kbc(4).
concatenate '0' SOURCE_FIELDS-/bic/week_kbc+4(2) into i_period.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
I_GJAHR = i_year
I_MONMIT = 00
I_PERIV = 'TM'
I_POPER = i_period
IMPORTING
E_DATE = i_date.
endif.
IF NOT SOURCE_FIELDS-/bic/emp_dob IS INITIAL.
RESULT = i_date0(4) - SOURCE_FIELDS-/bic/emp_dob0(4).
IF i_date4(4) LT SOURCE_FIELDS-/bic/emp_dob4(4).
RESULT = RESULT - 1.
ENDIF.
endif.This is calculating the age of the employee based on the field Zweek_kbc.
-
Read filter values of DTP by ABAP routine
I am trying to read the filter values of a DTP by ABAP routine in transformation.
I could do it in the past by using the code
DATA: t_filter_values TYPE rsbk_th_range.
t_filter_values = p_r_request->get_th_range( ).
After patching (SAPKW70019), the code does not seem to work.
Are there any other ways to retrieve the DTP filter values in ABAP?Thank you Simon.
Table RSSELDTP contains the filter values comma separated.
But it would be really dirty to read the values from there.
I would have to split the comma separated values. Furthermore, low and high value are just concatenated by a minus sign. I would have to split these values as well.
Is there a better solution to the problem? -
Routine (ABAP Code) in Transformation error
Hi Experts
Please correct the ABAP CODE written as Field routine in Transformations
Requirment
If ZB_AMT = '0.00'
then result should be '0.00'
If ZB_AMT <> '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT <> '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
The code below is not working as it should please update me where i went wrong
Source Fields
SOURCE_FIELDS-/BIC/ZB_AMT (CHAR)
SOURCE_FIELDS-/BIC/ZB_TPE1 (CHAR)
CODE
IF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND
SOURCE_FIELDS-/BIC/ZB_AMT <> '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND
SOURCE_FIELDS-/BIC/ZB_AMT <> '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ENDIF.
ENDIF.
ENDIF.Your logic will not work, if your first check on amount is 0.00 fails, the other checks fail as well. I am not sure of the requirement but..try this..
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
ELSEIF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ELSEIF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
Do nothing or throw any message
ENDIF. -
ABAP (Routine) Error in BW Transformations
Hi Experts,
As i am new(Learner) to BW Please advise me on how can i achieve this and update me with Releavent Start Routine and Field Routine....please
My Requirment is
Employee is Compounded on Location.
On Weekly or Monthly basis (dependending on Employee Payroll run) Employee will be assigned with the Wage Type and Amount for that Wage Type and Payroll Date (When the payroll was run)
Data Currently i have/Data comming from Source System
Loc_ID--Emp_IDWage_IDPayroll_Date-Amount
-1--99900108.08.2008-----100.00
-1--99908808.08.2008-----560.00
-1--99934508.08.2008-----437.00
-1--99900108.07.2008-----654.00
-1--99908808.07.2008-----389.00
-1--99934508.07.2008-----893.00
-1--99926408.06.2008-----600.00
-1--99934508.08.2008-----365.00
(Employee may have Different Wage_ID and Amount for each payroll)
My requirment is to include a new key figure 'Previous_Amount' which will be populated previous Wage_ID Amount.
Loc_ID--Emp_IDWage_IDPayroll_Date-Amount---Previous_Amount
-1--99900108.08.2008---100.00-----654.00
-1--99908808.08.2008---560.00--
389.00
-1--99934508.08.2008---437.00--
893.00
-1--99900108.07.2008---654.00--
0
-1--99908808.07.2008---389.00--
0
-1--99934508.07.2008---893.00--
365.00
-1--99926408.06.2008-----600.00
-1--99934508.08.2008-----365.00
As i am a starter in BW i am struggling to write start routine in transformations (DSO-->CUBE) to transfer the data in DSO Active Table to a internal table and a field routine to update Previous_Amount field by sorting the internal table data and to pick employee's latest record less than the current payroll for that particular wage_id and populate that amout to Previous_Amount field.
Please make necessary corrections to the start routine by fixing where i went wrong and update me with the required field routine (which will read data from internal table used in start routine.
With the help of Vamsi i can able to write this code,But still the Previous Price is filled with 0
Please correct me where it went wrong
Start Routine
Global declaration
Types :
Begin of ITABtype,
ORG TYPE /BIC/OIZORG,
CYEMPNO TYPE /BIC/OIZCYEMPNO,
HED_ID TYPE /BIC/OIZHED_ID,
RHED_ID TYPE /BIC/OIZRHED_ID,
CHNG_DTE TYPE /BIC/OIZCHNG_DTE,
HED_AMT TYPE /BIC/OIZHED_AMT,
HED_PAMT TYPE /BIC/OIZHED_PAMT,
End of ITABtype.
Data : ITAB type standard table of ITABtype
with key
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE
HED_AMT
HED_PAMT,
wa_itab like line of itab.
Data : ITAB1 type standard table of ITABtype
with key
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE
HED_AMT
HED_PAMT,
wa_itab1 like line of itab1.
*Create an internal table with all the field types with u want to have
*in the output */
Data : wa_SOURCE_PACKAGE type tys_SC_1.
Data : tmp(2) type n value 1.
\ The above loop is to get all the values into the internal table*/
Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE.
Move wa_SOURCE_PACKAGE-/BIC/ZORG to wa_itab-ORG.
Move wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO to wa_itab-CYEMPNO.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID to wa_itab-HED_ID.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID to wa_itab-RHED_ID.
Move wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE to wa_itab-CHNG_DTE.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_AMT to wa_itab-HED_AMT.
*Move wa_SOURCE_PACKAGE-/BIC/ZHED_PAMT to wa_itab-HED_PAMT.
Append wa_itab to itab.
Endloop.
Sort itab by
ORG Ascending
CYEMPNO Ascending
HED_ID Ascending
RHED_ID Ascending
CHNG_DTE Descending.
Sort SOURCE_PACKAGE by
/BIC/ZORG Ascending
/BIC/ZCYEMPNO Ascending
/BIC/ZHED_ID Ascending
/BIC/ZHED_ID/BIC/ZRHED_ID Ascending
/BIC/ZCHNG_DTE Descending.
Loop at itab into wa_itab.
tmp = '1' .
Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE from tmp.
If wa_itab-ORG = wa_SOURCE_PACKAGE-/BIC/ZORG.
wa_itab-CYEMPNO = wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO.
wa_itab-HED_ID = wa_SOURCE_PACKAGE-/BIC/ZHED_ID.
wa_itab-RHED_ID = wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID.
wa_itab-CHNG_DTE = wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.
wa_itab-HED_PAMT = wa_SOURCE_PACKAGE-/BIC/ZHED_AMT.
wa_itab-CHNG_DTE gt wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.
tmp = tmp + 1.
Exit.
Endif.
Endloop.
Modify itab from wa_itab.
Endloop.
itab1[] = itab[].
Sort itab1 by
ORG Ascending
CYEMPNO Ascending
HED_ID Ascending
RHED_ID Ascending
CHNG_DTE Descending.
Delete adjacent duplicates from itab1 comparing
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE.
Loop at itab1 into wa_itab1.
wa_itab-HED_PAMT = '0'.
Modify itab1 from wa_itab1.
Endloop.
Loop at itab into wa_itab.
Loop at itab1 into wa_itab1.
If wa_itab1-ORG = wa_itab-ORG.
wa_itab1-CYEMPNO = wa_itab-CYEMPNO.
wa_itab1-HED_ID = wa_itab-HED_ID.
wa_itab1-RHED_ID = wa_itab-RHED_ID.
wa_itab1-CHNG_DTE = wa_itab-CHNG_DTE.
wa_itab1-HED_PAMT = wa_itab-HED_PAMT.
Exit.
Endif.
Endloop.
Modify itab from wa_itab.
Endloop.
Field Routine
Read table ITAB into wa_itab
with key
ORG = SOURCE_FIELDS-/BIC/ZORG
CYEMPNO = SOURCE_FIELDS-/BIC/ZCYEMPNO
HED_ID = SOURCE_FIELDS-/BIC/ZHED_ID
RHED_ID = SOURCE_FIELDS-/BIC/ZHED_ID/BIC/ZRHED_ID
CHNG_DTE = SOURCE_FIELDS-/BIC/ZCHNG_DTE.
if sy-subrc = 0.
RESULT = wa_itab-HED_PAMT.
endif.
Please update me where it was wrong
Thanks in advanceHi again,
i don't have a BW system available now so the code is more as a how to and needs corrections but i hope you will figure out the logic.
declare an internal table and working area similar with the ods object.
data itab type table of ods_type.
data wa_itab type ods_type.
declare a working area for the source package.
data wa_source type type_source_package.
data l_tabix like sy-tabix.
select all active entries from ods .
if you figure out a performance issue here move this select into the loop and use where clauses or use for all entries in source_package
select * from ods_object into table itab .
sort source_package by payroll_date descending.
loop at source_package into wa_source.
l_tabix = sy-tabix.
read table itab into wa_itab with key Loc_ID = wa_source_package-loc_id
Emp_ID = wa_source_package-emp_id
wage_id = wa_source_package-Wage_ID.
wa_source-previous_amount = wa_itab-amount.
modify source_package from wa_source index l_tabix.
endloop.
This code should be in the start routine of the ods update.
Hope this helps
Kostas -
ABAP Logic in Transformations-Start or Field Routine Error
Hi,
Below is the field routine in transformations that will calculacte No of Years between 2 dates (Source Field & System Date)
It is showing me no systex Error but when i started data load ,Load is failing due to below mentioned error
Routine:
IF NOT SOURCE_FIELDS-/BIC/ZCYB_DOB IS INITIAL.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = SOURCE_FIELDS-/BIC/ZCYB_DOB
I_KEY_DAY_FROM = 00
I_DATE_TO = SYST-DATUM
I_KEY_DAY_TO = 00
I_FLAG_SEPERATE = 'X'
IMPORTING
E_YEARS = RESULT.
ENDIF.
Error:
The exception CX_STATIC_CHECK is neither caught nor is it declared in
the RAISING clause of "EXECUTE".
Please update me where i was doing wrong
ThanksIt must have something to do with your input variables - I ran this FM locally using my DOB and today's date and it worked fine.
make sure your input date types are in the correct format for the FM. -
Error while transporting Transformation: Syntax error in Start Routine
Hi Everyone,
I'm facing a strange problem during transporting one of the Business Content cubes from Dev. to Quality.
I'd activated the DSO 'Purchase Order Items (0PUR_O01)' and its entire data flow from the 4 datasources 2LIS_02_CGR, 2LIS_02_SCN, 2LIS_02_SGR, and 2LIS_02_ITM from BC. Then I migrated the Transfer/Update rules to transformations and the DataSources to BI7 DataSource. So far so good. The migration was successful and all the objects were activated.
Now when I transport the same to Quality, the import fails with return code 8 and the error message says:
'Start of the after-import method RS_TRFN_AFTER_IMPORT for object type(s) TRFN (Activation Mode)'
'Start Routine: Syntax error in routine'
I verified that the transformation where the error orrured was the one from InfoSource Z2LIS_02_ITM to DSO 0PUR_O01. I went and checked the start routine and it did indeed have a syntax error:
'In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter SOURCE_PACKAGE" is incompatible with the formal parameter DATA_PACKAGE". '
But when I check in the Dev. system, there is no syntax error for the same routine. Later, I tried to transport only the said transformation by re-activating it in Dev, and again I got the same error.
I have no idea why I'm getting a syntax error in the start routine when there are non in the Dev. system. Also none of the coding is customised, it was only the BC code, migrated to a transformation.
Any suggestions on the steps I could take to transport the transformation to my quality system?
Thanks,
RamHi Ajay, Shanthi, svu and Ray
I do indeed have a start routine in my transformation and it was migrated from a 3.x update rule to a BI 7 transformation routine.
The migration was successful and the Start Routine has NO syntax errors in the start routine in the Dev. system. I only encounter the error while transporting it to the Quality system. I cannot modify the code in the Quality system because it is non-changelable and there is no point in trying to change the code in Dev. because there are no errors over there.
I've also made sure that I've transported all the necessary objects required by the transformations to quality. The routine does not perform a lookup, it simply deletes some records from the data package based on the processkey value (which is itself present in the data package). -
Populate new fields in DSO (DBTable) with ABAP routine
Hi,
I've added a couple of fields to a DSO. The DSO contains a large number of records (60m+) and I have a tight window to cutover so the activation time would be an issue if I use a loop transformation. Therefore, I am looking to populate the additional fields directly in the Active table using an ABAP routine.
One of the fields is a key figure to be derived from an existing CHAR field so would need to apply some logic during update, such as IF <CHAR_FIELD> CA 'ABC'. <KYF_FIELD> = 1 etc.
Aside from fairly basic Start Routines my ABAP is very poor so was wondering if anyone can help me with the syntax or, preferably some sample code to achieve this.
Thanks in advance,
AdHi,
In transformation of the cube, choose routine for char E.
There you can assign value in RESULT field. Actually RESULT field is assigned to E, find the code below,
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
... "to skip a record
raise exception type CX_RSROUT_SKIP_RECORD.
... "to clear target fields
raise exception type CX_RSROUT_SKIP_VAL.
(* insert your abap code here to find the value of E*.)
RESULT = * assign the value you got for E here.
rgrs,
v.sen -
Error while Migrating the custom routines in Transformations
Dear All,
I am in the process of migrating BW 3.5 to BI 7.0.I migrated the Standard cubes and DSO's from BW3.5 to BI 7.0 flow successfully.
But while migrating the transformations which are having the custom routines,I am facing the below errors.
The data object "COMM_STRUCTURE" does not have a component called BIC/ZGROSSPRI".But the routine contains BIC/ZGROSSPRI.
I tried to change the BW 3.5 terminology to BI 7.0 terminology.(Like COMM_STRUCTURE replaced by SOURCE_FIELDS).But unable to solve.There are nearly 20 custome routines written in all transformations.
Can any one guide me who faced the same tyepe of problem?
Thanks & Regards,
DinakarHI,
We need to include Source and Target see the below article.
http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
How to Correct Routines in Transformations
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/how%20to%20correct%20routines%20in%20transformations.pdf
Thanks
Reddy -
(ABAP) Code in Transformation--Modification
Hi Experts,
As i am new(Learner) to BW Please advise me on how can i achieve this and update me with Releavent Start Routine and Field Routine....please
My Requirment is
Employee is Compounded on Location.
On Weekly or Monthly basis (dependending on Employee Payroll run) Employee will be assigned with the Wage Type and Amount for that Wage Type and Payroll Date (When the payroll was run)
Data Currently i have/Data comming from Source System
Loc_ID--Emp_IDWage_IDPayroll_Date-Amount
-1--99900108.08.2008-----100.00
-1--99908808.08.2008-----560.00
-1--99934508.08.2008-----437.00
-1--99900108.07.2008-----654.00
-1--99908808.07.2008-----389.00
-1--99934508.07.2008-----893.00
-1--99926408.06.2008-----600.00
-1--99934508.08.2008-----365.00
(Employee may have Different Wage_ID and Amount for each payroll)
My requirment is to include a new key figure 'Previous_Amount' which will be populated previous Wage_ID Amount.
Loc_ID--Emp_IDWage_IDPayroll_Date-Amount---Previous_Amount
-1--99900108.08.2008---100.00-----654.00
-1--99908808.08.2008---560.00--
389.00
-1--99934508.08.2008---437.00--
893.00
-1--99900108.07.2008---654.00--
0
-1--99908808.07.2008---389.00--
0
-1--99934508.07.2008---893.00--
365.00
-1--99926408.06.2008-----600.00
-1--99934508.08.2008-----365.00
As i am a starter in BW i am struggling to write start routine in transformations (DSO-->CUBE) to transfer the data in DSO Active Table to a internal table and a field routine to update Previous_Amount field by sorting the internal table data and to pick employee's latest record less than the current payroll for that particular wage_id and populate that amout to Previous_Amount field.
Please make necessary corrections to the start routine by fixing where i went wrong and update me with the required field routine (which will read data from internal table used in start routine.
With the help of Vamsi i can able to write this code,But still the Previous Price is filled with 0
Please correct me where it went wrong
Start Routine
Global declaration
Types :
Begin of ITABtype,
ORG TYPE /BIC/OIZORG,
CYEMPNO TYPE /BIC/OIZCYEMPNO,
HED_ID TYPE /BIC/OIZHED_ID,
RHED_ID TYPE /BIC/OIZRHED_ID,
CHNG_DTE TYPE /BIC/OIZCHNG_DTE,
HED_AMT TYPE /BIC/OIZHED_AMT,
HED_PAMT TYPE /BIC/OIZHED_PAMT,
End of ITABtype.
Data : ITAB type standard table of ITABtype
with key
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE
HED_AMT
HED_PAMT,
wa_itab like line of itab.
Data : ITAB1 type standard table of ITABtype
with key
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE
HED_AMT
HED_PAMT,
wa_itab1 like line of itab1.
*Create an internal table with all the field types with u want to have
*in the output */
Data : wa_SOURCE_PACKAGE type tys_SC_1.
Data : tmp(2) type n value 1.
\ The above loop is to get all the values into the internal table*/
Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE.
Move wa_SOURCE_PACKAGE-/BIC/ZORG to wa_itab-ORG.
Move wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO to wa_itab-CYEMPNO.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID to wa_itab-HED_ID.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID to wa_itab-RHED_ID.
Move wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE to wa_itab-CHNG_DTE.
Move wa_SOURCE_PACKAGE-/BIC/ZHED_AMT to wa_itab-HED_AMT.
*Move wa_SOURCE_PACKAGE-/BIC/ZHED_PAMT to wa_itab-HED_PAMT.
Append wa_itab to itab.
Endloop.
Sort itab by
ORG Ascending
CYEMPNO Ascending
HED_ID Ascending
RHED_ID Ascending
CHNG_DTE Descending.
Sort SOURCE_PACKAGE by
/BIC/ZORG Ascending
/BIC/ZCYEMPNO Ascending
/BIC/ZHED_ID Ascending
/BIC/ZHED_ID/BIC/ZRHED_ID Ascending
/BIC/ZCHNG_DTE Descending.
Loop at itab into wa_itab.
tmp = '1' .
Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE from tmp.
If wa_itab-ORG = wa_SOURCE_PACKAGE-/BIC/ZORG.
wa_itab-CYEMPNO = wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO.
wa_itab-HED_ID = wa_SOURCE_PACKAGE-/BIC/ZHED_ID.
wa_itab-RHED_ID = wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID.
wa_itab-CHNG_DTE = wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.
wa_itab-HED_PAMT = wa_SOURCE_PACKAGE-/BIC/ZHED_AMT.
wa_itab-CHNG_DTE gt wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.
tmp = tmp + 1.
Exit.
Endif.
Endloop.
Modify itab from wa_itab.
Endloop.
itab1[] = itab[].
Sort itab1 by
ORG Ascending
CYEMPNO Ascending
HED_ID Ascending
RHED_ID Ascending
CHNG_DTE Descending.
Delete adjacent duplicates from itab1 comparing
ORG
CYEMPNO
HED_ID
RHED_ID
CHNG_DTE.
Loop at itab1 into wa_itab1.
wa_itab-HED_PAMT = '0'.
Modify itab1 from wa_itab1.
Endloop.
Loop at itab into wa_itab.
Loop at itab1 into wa_itab1.
If wa_itab1-ORG = wa_itab-ORG.
wa_itab1-CYEMPNO = wa_itab-CYEMPNO.
wa_itab1-HED_ID = wa_itab-HED_ID.
wa_itab1-RHED_ID = wa_itab-RHED_ID.
wa_itab1-CHNG_DTE = wa_itab-CHNG_DTE.
wa_itab1-HED_PAMT = wa_itab-HED_PAMT.
Exit.
Endif.
Endloop.
Modify itab from wa_itab.
Endloop.
Field Routine
Read table ITAB into wa_itab
with key
ORG = SOURCE_FIELDS-/BIC/ZORG
CYEMPNO = SOURCE_FIELDS-/BIC/ZCYEMPNO
HED_ID = SOURCE_FIELDS-/BIC/ZHED_ID
RHED_ID = SOURCE_FIELDS-/BIC/ZHED_ID/BIC/ZRHED_ID
CHNG_DTE = SOURCE_FIELDS-/BIC/ZCHNG_DTE.
if sy-subrc = 0.
RESULT = wa_itab-HED_PAMT.
endif.
Please update me where it was wrong
Thanks in advancehi
First loop fetches value from source_package into itab like thiss
ITAB
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.08.2008 100 NO VALUE YET
001 08.07.2008 654 NO VALUE YET
088 08.08.2008 560 NO VALUE YET
088 08.07.2008 389 NO VALUE YET
Source_package
Hed_id chng_date Hed_Amt
001 08.08.2008 100
001 08.07.2008 654
088 08.08.2008 560
088 08.07.2008 389
That loop compares the itab and source_package by nrigning one record after another into wa_itab and wa_source_packageu2026.
Wa_itab-chng_date > wa_odurce_package-chng_date and wa_itab-hed-id = wa_source_package-hed_id
1) 08.08.2007 > 08.08.2008 101 =101 false
It will loop for second iteration in source_package outer loop it is at first record only.
2) 08.08.2007 > 08.07.2008 101 = 101 true
So wa_itab-zhed_pamt = wa_source_package-price ( right we has to get that value only )
Wa_itab-zhed_pamt = 654 (wa_source_package-amt).
So exit that loop and modify the itab
So ur itab first record becomes
001 08.08.2008 100 654
3) and it continues in the inner loop and finds no record with the sameu2026.
So after this entire looping
ITAB
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.08.2008 100 654
001 08.07.2008 654 NO VALUE YET
088 08.08.2008 560 389
088 08.07.2008 389 NO VALUE YET
Next itab1 = itab so
ITAB1
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.08.2008 100 654
001 08.07.2008 654 NO VALUE YET
088 08.08.2008 560 389
088 08.07.2008 389 NO VALUE YET
For the 001 08.07.2008 we has to get previous amount 0 for that
Sort and delte adjacent steps after iot becomes like this
ITAB1
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.07.2008 654 NO VALUE YET
088 08.07.2008 389 NO VALUE YET
Next loop modify and add zero to previous amount to these values
ITAB1
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.07.2008 654 0
088 08.07.2008 389 0
Next loop we will modify these values to the internal table
Hed_id chng_date Hed_Amt Hed_Pmat
001 08.08.2008 100 654
001 08.07.2008 654 0
088 08.08.2008 560 389
088 08.07.2008 389 0
Next using field routine suppose incoming record has hed_id 101 and change_date 08.08.2008 then the previous value corresponding to it is read from the itab
U try to do debugging and know those more ......
Regards
vamsi -
(BI 7.0) Debugging Routines in Transformation
Dear All,
I would like to debug my own ABAP routine in the transformation for BI 7.0, anyone know how to set a break-point somewhere for popping up the debugging window? thanks
B.R
Charlie1. find the program behind your transformation (from the Transformation Display screen go to menu Extras > Display Generated Program)
2. put a break-point where you need it
3. create a DTP with Processing Mode (Execute tab) "Serially in the Dialog Process (for Debugging)"
4. launch the DTP
Maybe you are looking for
-
Printing from email (Yahoo and a Rogers webmail) is not working properly. Only P 1 will print, even if "all" is selected in the print window. The print window defaults to "page 1 to 1" and nothing will change it. Docs from "MY Documents" print proper
-
How to trigger navigation to a portal iView from server side event handler
Hi, I am modifying the workset map application. I have created custom URL links under each iView which should navigate to different iViews depending on some business logic. So I had to provide a custom event handler for these iVIew links and the path
-
Schedule Receiver RFC communication channel to call R3 RFC-FM.
Hi, I have requirement that I need to schedule/trigger from PI to RFC call R3 function module. Wonder if anyone here has done similar thing before? I tried to use ATP (Availability time planning) in RWB. But this seem does not success for me as there
-
Custom Java Function in BI Publisher
Hi - Is it possible in BI Publisher to create a custom java function and call this function in RTF template? Thank You
-
How to use Radiobutton Cell Editor in Table using Master Column
Hi Guys, I have a Table that uses a Master Column. I need to have a field that uses a Radio Button type cell editor. A user should only be ably to select ONE row via the Radio Button at a time. I have done all this but I only seem to be able to sel