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
Similar Messages
-
Function Module to convert date to week from Sunday to Saturday
Hi,
In BW the convertion date to week always give week from Monday(1) to Sunday(7)
I'm looking for a function module to convert date to week from Sunday(1) to Saturday(7)
Thanks
SebastienHi,
I think this SAP standardized. Maybe you need to create custom FM.
You can copy SAP FM DATE_GET_WEEK. in the FORM FIRSTWEEK, I see below case,
CASE start_weekday.
WHEN if_calendar_definition=>c_monday.
start_weekday_number = 1.
WHEN if_calendar_definition=>c_tuesday.
start_weekday_number = 2.
WHEN if_calendar_definition=>c_wednesday.
start_weekday_number = 3.
WHEN if_calendar_definition=>c_thursday.
start_weekday_number = 4.
WHEN if_calendar_definition=>c_friday.
start_weekday_number = 5.
WHEN if_calendar_definition=>c_saturday.
start_weekday_number = 6.
WHEN if_calendar_definition=>c_sunday.
start_weekday_number = 7.
ENDCASE.
Maybe you can play something here. -
How to convert the 3.x ABAP Routines into BI 7 ABAP Routines
Hi All,
I am trying to convert a BI 3.x data flow into BI 7 data flow suing DTP's.
But i am stuck at Transformations. We have used several Routines in 3.X data flow and those routines are not converted automatically into the new data flow.
Is there any other tool or program whcih will convert the ABAP routines automatically into the new ABAP format.
my sample ABAP 3.x Code looks like this in Start routine,
LOOP AT DATA_PACKAGE.
IF ( DATA_PACKAGE-CPPVLC EQ 0
AND DATA_PACKAGE-CPPVOC EQ 0
AND DATA_PACKAGE-CPSTLC EQ 0
AND DATA_PACKAGE-CPQUAOU EQ 0
AND DATA_PACKAGE-CPSVLC EQ 0 ).
DELETE DATA_PACKAGE.
CONTINUE.
ENDIF.
I tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
any help will be appreciated.
Cheers
POPSI tried to replace DATA_PACKAGE with SOURCE_PACKAGE, but it did not work.
When you use SOURCE_PACKAGE it will not have header line so you need to use workarea.
Use something like
LOOP AT SOURCE_PACKAGE into WA_SOURCE_PACKAGE.
Define WA_SOURCE_PACKAGE of type SOURCE_PACKAGE.
and replace further data_package in the code with WA_SOURCE_PACKAGE
Hope this helps.
Edited by: Praveen G on Jan 27, 2009 4:10 AM -
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 of the year in Query designer
Hi,
I have a requirement to convert date ( a characteristic in the query) to week of the year. For eg. if the date is 01/11/2008 then the week to be displayed is 2008/44.
Please not that the week is not populated in the Infocube of the same. So i need to convert it in the query designer only.
Please suggest if you have ideas.
Regards
SapnaHi,
I am trying to get the data by using a virtual characteristic. The problem is i am not able to debug METHOD : IF_EX_RSR_OLAP_BADI~COMPUTE. Can u please help me to reach the breakpoint within this.
Done....
Sapna
Edited by: Sapna Jaiswal on Dec 2, 2008 11:21 AM -
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. -
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 AMRoutine 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. -
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.
-
How to convert date (dd/mm/yyyy) to week no. calendar?
hi all,
I have a question about if user enters 12/12/2004(dd/mm/yyyy), which week is that? I just know week no. should from 01 to no more than 53. How to convert date to week no.?
Thanksselect to_char(sysdate,'IW'),to_char(sysdate,'wW') from dual;
for IW, the week 2 starts on the first monday after 1.Jan, for WW, the week 2 starts on 8. Jan.
HTH
Laurent Schneider
OCM DBA -
Convert Date to Calendar week in Query Designer
Hi experts,
Is it possible to convert date to week in the query designer?
Thanks in advance for your help.
Best Regards,
RoseHi,
Can you please explain more about virtual char you mentioned?
What i am actually doing is i am using a formula variable (getting the value from customer exit) and i based the calculation of other keyfigures basing on this value. The input value.. (data type date ) does not filter my query output.. it is only purely used for calculating other keyfigure values. The data types (Dimension Settings ) available in formula variable are only quantity, amount, pice and number, date and time.. there is no week there. So currently I am using the date. If I can convert date to week then.. I can make my query a lot simpler.
Thanks for your reply...
Regards,
Rose -
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? -
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 -
InfoPackage ABAP Routine for Date Range - Only Start Date Extracted
I am using an ABAP Routine in an InfoPackage to select data for a 2 year period. The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period. The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
The Source and Target are both Basic Infocubes.
The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period. Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded. Im guessing that the extract was only performed with the From value, even though a To value was also provided.
I created a simple Infopackage and manually input the selection parameter values just to be sure I wasnt overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
Has anybody ever experienced this before ? Any ideas would be greatly appreciated ?
Thanks,
LyleWe can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
l_s_range-sign = 'I'.
l_s_range-option = 'BT'.
l_s_range-low = lowvalue.
l_s_range-high = highvalue.
MODIFY l_t_range FROM l_s_range INDEX l_idx.
As you can see the key is passing the "BT" information for capturing range.
Hope it helps..
thanks
Kumar -
Useful data selection abap routines
Hello Experts,
Can you advise where I could reference useful abap routines for data selection in infopaks? I desperately need these to help meet specific requirements.
Thanks,
Ernest CorvinoDear Ernesta,
Infopackage->DataSelection->After from and to values you see a column called type, write '6' and enter.. it asks for ABAP routine ..
The following are taken on F1 over there for you..
In this field you determine the variables for periodic data loading.
If you want to load the data periodically from the source system into BW, and you want selection field contents (such as date fields) to change periodically, please choose one of the following F4 options:
For data fields:
get yesterday
Yesterday's date is automatically set in the date field.
get last week
Last week is automatically set in the date field.
get last month
Last month is automatically set in the date field.
get last quarter
Last quarter is automatically set in the date field.
get last year
Last year is automatically set in the date field.
free selection
You can also change other fields periodically as you wish. You can find further information in the documentation under Scheduler.
Regards,
Hari -
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.
Maybe you are looking for
-
URGENT HELP REQUIRED AS REGARDS THIS BILLING FIASC...
Dont know wether aloud to post this here but Have also posted Directly to KerryG but if anyone else can help most appeciated Dear KerryG please forgive me contacting you in this manner but I am desperate today saturday the 20th feb I recived my Bt b
-
TV on my Mac (UK), what do I need, what are best options?
I want to watch live TV on my PowerMac G5. What do I need? How can I do this? What is the best stuff to get to enable me to do this? How reliable are these things, is the quality good, do such devices cause any problems to other operations? Thanks. A
-
Basic standby database configuration in Oracle10g standard edition
Have anyone successfully implemented the technology in Oracle8i and earlier known as "Basic standby database" in Oracle10g SE? From the information, that I've been able to gather, this technology still exists in Oracle9i and later, along with Oracle
-
How to send a Workitem to User Group through WorkFlow
Hi, I am developing a WorkFlow, in this i have an issue that i have to send a WorkItem to User Group on Certain condition. On Agent Assignment I want to assign User Group not a single or multiple Users. Could anyone resolve this issue. How can i reso
-
How to remove Button from Flex Mobile app actionbar with AS3?
How exactly would i remove a Button from the actionBar "actionContent" in a flex mobile app? I tried these: this.stage.removeChild(menu_btn); this.removeChild(menu_btn); stage.removeChild(menu_btn); this.stage.removeElement(menu_btn);