Start/Field Routine in Transformations (ABAP)
Hi Experts
Please update me on how to proceed and ABAP Code required.
DSOFULL->CUBE
DSO Active Table: /BIC/AEMPPED00
Data In DSO
Emp_ID--Emp_SDATE--Emp_TDate
1-----01.01.2008
1---01.01.2008--01.06.2008
1-----01.01.2008
Data Expected in CUBE
Emp_ID--Emp_SDATEEmp_TDate-----Ter_Date
1---01.01.2008--
01.06.2008
1---01.01.200801.06.2008---01.06.2008
1---01.01.2008--
I need a start routine or field routine that
Will loading data from DSO to CUBE the code should look for employee latest record and if it find Emp_TDatevalue then it should populate both recordsTer_date in cube with Emp_TDate
Please advise
Hi,
i am providin you a sample code please modify it (field name and tables name's as per your requirement).
Please write the code in transformation rule of field Emp_TDate.
Map field Emp_SDATE to the target field for Emp_TDATE .
SELECT * FROM /BIC/AEMPPED00
WHERE Emp_SDATE NE ' '.
if sy-subrc is initial.
result = source_field-Emp_SDATE.
else.
result = ' '.
endif.
Please replace the emp_SDATE field with the source field name.
But still i have some question...
1. On what basis u decide the latest record ??
Can u please explain scenarion bit mroe clearly.
Thanks
Dipika
Edited by: Dipika Tyagi on Jun 24, 2008 8:47 AM
Similar Messages
-
ABAP Logic/Structure for a Start and Field Routine in Transformations
My Requirment is to export data from Data Target to Application Server.
And for that purpose i built a APD...
In Transformations to read data from MAster Data Table i had written below Global & Field Routine.
Start Routine:
Glodal Declaration
DATA: it_dep type standard table of /BI0/MDEPT,
is_dep type /BI0/MDEPT.
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
if not SOURCE_PACKAGE[] is initial.
SELECT * FROM /BI0/MDEPT INTO TABLE it_dep for all entries in
SOURCE_PACKAGE
WHERE depLOYEE = SOURCE_PACKAGE-dep AND
OBJVERS = 'A' AND
DATETO GE SY-DATUM.
ENDIF.
ENDLOOP.
FIELD ROUTINE
Clear:is_dep.
Read table it_dep into is_dep with key
depLOYEE = SOURCE_FIELDS-deployee binary search.
if sy-subrc = 0.
RESULT = is_dep-USERNAME.
endif.
Now for another field 'Manager' name.......
My requirment
Start Routine:
(Sub Detp is an attribute to Dept and Sub Dept is referenced on dept)
First it should copy all the Sub depts for the corresponding depts in the source field to a Temperoray table (TEMP1)
For all sub depts in TEMP1 table it should copy manager names from dept master data table to a Temp2 table
In start routine i need to first read temp1 and result from temp1 should be passed to temp2 and the result from tem2 can be passed to result field
Please updateHi,
i am providin you a sample code please modify it (field name and tables name's as per your requirement).
Please write the code in transformation rule of field Emp_TDate.
Map field Emp_SDATE to the target field for Emp_TDATE .
SELECT * FROM /BIC/AEMPPED00
WHERE Emp_SDATE NE ' '.
if sy-subrc is initial.
result = source_field-Emp_SDATE.
else.
result = ' '.
endif.
Please replace the emp_SDATE field with the source field name.
But still i have some question...
1. On what basis u decide the latest record ??
Can u please explain scenarion bit mroe clearly.
Thanks
Dipika
Edited by: Dipika Tyagi on Jun 24, 2008 8:47 AM -
HOw to write/Develop this Start & Field Routine
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.
Start Routine
Data: ITAB_DSOP type table of /BIC/AZDFREW200,
WA_DSOP type /BIC/AZDFREX200.
Data: WA_PACKAGE like line of SOURCE_PACKAGE.
Data: L_TABIX type SY-TABIX.
If not SOURCE_PACKAGE[] is initial.
Sort SOURCE_PACKAGE by
/BIC/ZLOC ascending
/BIC/ZEMP_ID ascending
/BIC/ZPAY_DATE ascending
/BIC/ZWGE_ID ascending.
clear ITAB_DSOP[].
Select from /BIC/AZDFREW200 into table ITAB_DSOP
for all entries in SOURCE_PACKAGE
Where /BIC/ZLOC = SOURCE_PACKAGE-/BIC/ZLOC.
/BIC/ZEMP_ID = SOURCE_PACKAGE-/BIC/ZEMP_ID.
/BIC/ZWGE_ID = SOURCE_PACKAGE-/BIC/ZWGE_ID.
/BIC/ZPAY_DATE < SOURCE_PACKAGE-/BIC/ZPAY_DATE.
If sy-subrc = 0.
Sort ITAB_DSOP by
/BIC/ZLOC ascending
/BIC/ZEMP_ID ascending
/BIC/ZPAY_DATE descending
/BIC/ZWGE_ID ascending.
if sy-subrc = 0.
loop at SOURCE_PACKAGE into wa_package.
l_tabix = sy-tabix.
read table ITAB_DSOP into wa_DSOP with key
/BIC/ZLOC = wa_package-/BIC/ZLOC
/BIC/ZEMP_ID = wa_package-/BIC/ZEMP_ID
/BIC/ZWGE_ID = wa_package-/BIC/ZWGE_ID
binary search.
if sy-subrc = 0.
Please update me with Start Routine and Field Routine required to achieve my requirment
Thanks in advancehii
I created small example as ur case, for that I will explain my logic which i used and i will give the code make the necessary mofications and use in ur case
1) First bring all the input that exist in source_package into a temporary table which we create as that of the output structue.
2) Sort both input i.e source_package and temporary table by wage id and date ascending
3) Next compare both of them and get the value of previous price into the temporary table from the source_package..
4)write a routine at the field level to populate the previous_price by mappign both wage id and payroll date
5) Between 3 step and 4 step i used one more temporary table to get the values of previous price 0
GLOBAl PART
types : begin of itabtype,
job_no type /bic/oirt_jobno,
wage_id type /bic/oirt_wgid1,
date type /bic/oizfrm_dt,
prc type /bic/oirt_prc,
previous_price type /bic/oirt_prc1,
end of itabtype.
data : itab type standard table of itabtype
with key wage_id date,
wa_itab like line of itab.
data : itab1 type standard table of itabtype
with key wage_id date,
wa_itab1 like line of itab1.
\* Create an internal table with all the field types with u want to have in the output */
LOCAL PART
data : wa_SOURCE_PACKAGE type tys_SC_1.
data : tmp(2) type n value 1.
loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE.
move wa_SOURCE_PACKAGE-/bic/rt_jobno to wa_itab-job_no.
move wa_SOURCE_PACKAGE-/bic/rt_wgid1 to wa_itab-wage_id.
move wa_SOURCE_PACKAGE-/bic/zfrm_dt to wa_itab-date.
move wa_SOURCE_PACKAGE-/bic/rt_prc to wa_itab-prc.
append wa_itab to itab.
endloop.
\* The above loop is to get all the values into the internal table*/
sort itab by wage_id ascending date descending.
sort SOURCE_PACKAGE by /bic/rt_wgid1 ascending /bic/zfrm_dt
descending.
loop at itab into wa_itab.
tmp = '1' .
loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE from tmp.
if wa_itab-date gt wa_SOURCE_PACKAGE-/bic/zfrm_dt
and wa_itab-wage_id = wa_SOURCE_PACKAGE-/bic/rt_wgid1
wa_itab-previous_price =
wa_SOURCE_PACKAGE-/bic/rt_prc.
tmp = tmp + 1.
exit.
endif.
endloop.
modify itab from wa_itab.
endloop.
itab1[] = itab[].
sort itab1 by wage_id ascending date ascending.
delete adjacent duplicates from itab1 comparing wage_id.
loop at itab1 into wa_itab1.
wa_itab-previous_price = '0'.
modify itab1 from wa_itab1.
endloop.
loop at itab into wa_itab.
loop at itab1 into wa_itab1.
if wa_itab1-date = wa_itab-date and wa_itab1-wage_id = wa_itab-wage_id.
wa_itab-previous_price = wa_itab1-previous_price.
exit.
endif.
endloop.
modify itab from wa_itab.
endloop.
This looks big but logic is small....
get back to me if any queries u have
regards
vamsi -
Primitive APAB editor in start/end routines in transformations
When editing or viewing ABAP code in BI transformations, for example in a start routine, the editor that opens is very primitive compared to the normal SE38 editor. Some of the limitations include:
The editor window doesn't cover the whole screen with seemingly no way to increase its size.
The syntax check doesn't show on which line syntax errors are located.
There is no option to perform a extended program check.
There is no way to insert break-points (other than with the ABAP keyword of course)
These limitations are present regardless of whether i choose the new front-end editor, the old front-end editor or the back-end editor. We're running SAP Netweaver 2004s.
It is of course possible to create a program in SE38 and copy-paste your start routine code to see the code using the "real" editor, but this is very tiresome and time consuming. Is there a way to make this editor look and behave like the normal editor? I have looked through the setting options an searched SDN without finding a way.Hi,
This is just the settings you need to change to open the start,end, and characteristics routine using the old editor you are comfortable with. No need to go to se38 and check copy the program.
Go to se38->Utilities->settings->abap editor->editor tab->select the old abap editor.
To specifically put break point in transformations (start routine..end routine..)..goto transformation (RSA1) and then display the transformation.
Then goto extra (menu)->generated program. search for start_routine (method now) and put break point in the desired place.
Then from the DTP enable all 4 break points..in tranformation (this will come when u cange it to debug mode simulation). And u can debug the transformation.
The new editor is a good handy one. But take some time to get acquented to it. After you may start liking it :).
Cheers,
-J -
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. -
ABAP Logic in Transformations-Start or Field Routine
Hi Experts,
As i am new to BW Please update me with the ABAP logic i need to implement in Transformation routine...and please advise me wether i can use that as a Start or field routine for a better performance.
Target DSO:
DSO A : Active Table:/BIC/AZDSOA
Fields (ZLOC,ZPAY_ID,ZNPAY_ID,ZOPAY_ID & ZCHG_DTE)
Source DSO
DSO B : Active Table:/BIC/BZDSOA
(ZLOC,ZPAY_ID)
DSO C : Active Table:/BIC/CZDSOA
Fields (ZLOC,ZPAY_ID,ZNPAY_ID & ZCHG_DTE(date))
While Transfering Data from DSO B-->DSO A
It should check DSO C for that ZLOC & ZPAY_ID
If ZCHG_DTE IS Blank then it should pick ZNPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZNPAY_ID in DSO A
if ZCHG_DTE IS not Blank then it should pick ZPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZOPAY_ID & ZCHG_DTE in DSO A
ZPAY_ID - Pay ID
ZNPAY_ID -New Pay ID
ZOPAY_ID -Old Pay ID
ZCHG_DTE -Change Date
ZLOC -Location.
Logic in words:
If Change date is Blank then it should pick new pay id for that Location & Pay Id and update NEw pay id field in DSO A
If Change date is not Blank then it should pick pay id for that Location & Pay Id and update old pay id field & change date in DSO A
Please update me with releavent code
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. -
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. -
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 ' '. -
Problem with READ Statement in the field routine of the Transformation
Hi,
I have problem with read statement with binary search in the field routine of the transformation.
read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
Code in the start routine
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp <> 3.
delete it_zcam where end_dt initial.
sort it_zcam by surce accno.
endif.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif.
this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
this field i am using in the report filter.
please let me know if anybody has the soluton or reason for this strage behaviour.
thanks,
Rahim.i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
1. is the key of zcam_o11 source and accno ?
2. you need to get the sortout of if endif (see code below)
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp 3.
delete it_zcam where end_dt initial.
endif.
sort it_zcam by surce accno.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif. -
Needs sample ABAP code for field routine
Dear Expert,
There is a field "Pay Scale Group" in my DSO which stores the data in the format
AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
I need to write a field routine on the transformation between DSO and Cube.
Can any one please help me with the sample ABAP code for this scenario.
Some more examples for better understanding of the requirement:-
Data in DSO(Source) Data in Cube(Target)
=================== ===================
AA1/B1/CCC2/DD2/EEE1 EEE1
AAA1/BB2/CC1/DDD3/EE2 EE2
A2/BBB2/CC2/DDD3/EEE5 EEE5
AA2/BB1/C1/DDD3/EE3 EE3
A3/B1/CC2/DDD1/EE4 EE4
Many thanks in advance.
Regards,
Prakash
Please do not dump your code requirements in SDN
Edited by: Pravender on May 18, 2011 11:37 AMHi,
You can use the following code :
Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
My assumption is that there will always be 4 '/'.
In the field routine write the below code
data: V1(5) type c,
V2(5) type c,
V3(5) type c,
V4(5) type c,
V5(5) type c.
data : VAR1 TYPE /BIC/OIZPAY_SGRP.
split VAR 1 at '/' into V1 V2 V3 V4 V5.
result = V5.
V5 will be having the characters after the last '/' .That is V5 = EEE1.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh
Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
Edited by: Ashutosh Singh on May 17, 2011 4:17 PM -
Difference between Start Routine and End Routine in Transformations
Hi Friends,
I'm using BI 7.0... here in Transformations step we have two options..that is START ROUTINE... and END ROUTINE... What is the Difference between Start Routine and End Routine in Transformations..
When we go for Start Routine.. and when we go for End Routine..
Plz clarrify... points will be rearded..
thanks
babuHi,
One real time scenario for End Routine.
We have a scenario where in a datasource field is mapped to three infoobjects on the datatarget side. There are 2 key figures which need to get data after these these Infoobjects are filled. The best place for this to happen would be in a End Routine, where in we would loop through the results package and using the values of the infoobjects from the data target ( Cube in this case).
Hope this helps,
HD -
Get the request id from a PSA in start routine in transformation
Hello All,
I need to get the request id of the PSA (source_package) during the start routine or field routine and then use it to look up the Date when requested was created using the table RSREQDONE.
I'm extracting data from ECC, and then I load the data from the Datasource, then I use DTP/Transformation to load data into a ODSO.
<removed>
Thanks Guys,
JMelo
Edited by: Arun Varadarajan on Feb 6, 2009 12:09 PMHi John,
its pretty simple to read data from a Info-cube.
Use the Function Module :RSDRI_INFOPROV_READ".
You can pass the name of fields and filters which you want to read from the cube.
Hope this wil help. -
Start Routine on Transformations
Hi Friends
I've Start routine on transfer rules with internal table and it was working fine.
Now I'm trying to define the internal table with occurs 0 but it's throwing error saying occurs not support in new version.
How can we define an internal table in start routine of transformations in BI7?
The code as follows for internal table.
data: begin of it_ord occurs 0,
AUFNR(000012) TYPE C,
ZZARBPL(000008) TYPE C,
WERKS(000004) TYPE C,
end of it_ord.
Regards,
Chandu.Hi
I've defined as follows
types: begin of it_ord ,
AUFNR(000012) TYPE C,
ARBPL(000008) TYPE C,
WERKS(000004) TYPE C,
end of it_ord.
data: temp_tabix like sy-tabix,
is_datapak type tys_SC_1.
data it_ordt type table of it_ord .
It's throwing error saying it_ort is a table with no header line and therefore has no component called aufnr.
If I define with header line then header line not supported.
What could be the problem?
I've changed like you said but it's giving the following error.
E:"IT_WA" is not a table with header line.
Regards,
Chandu.
Edited by: Chandu on Feb 18, 2009 8:44 AM -
Accessing Global Internal Table in Field Routine Level
I am working on a transformation. I have created a Global Internal Table with the structure of my Source Target + extra fields not in my source target. In the start routine of the transformation I am first copying all corresponding fields from SOURCE_PACKAGE to internal table and then finally doing a lot of manipulations and modifying and appending the internal table with data now ready for populating to target.
I want to populate the target fields at field routine level by the data present in the Global internal table. Can you please tell me how to code here. If data was being read by SOURCE_PACKAGE, I would have read the value of SOURCE_FIELDS - (Value). But incase of value to be read from Global Internal Table, can I refer to the internal table work area directly. Thanks.
Global Internal Table - G_ITAB
Work Area - WA_G_ITAB
Is the below correct ?
Result = WA_G_ITAB-(Field Name).Let me understand this with an example as I am still not clear. Suppose I am loading to a DSO having 17 Key Fields say K1, K2, K3.........K17.
And if the 3.5x logic is
DATA : L1 LIKE COMM_STRUCTURE-amt.
CLEAR L1 .
IF COMM_STRUCTURE-CHK = '222'
OR COMM_STRUCTURE-CHK = '333' .
L1 = COMM_STRUCTURE-amt .
ENDIF.
RESULT = L1 .
Can you tell me the code of the above in BI7 at field level routine now. Please note I need to take data from G_ITAB internal table and that the DSO has 17 key fields?
Maybe you are looking for
-
POD flag set up automatically after BP replicated from CRM to ECC
Hi Experts, we are working on CRM 5.0 and ECC 6 as backend system. *Requirement :*We will create a BP record in CRM and the same will be replicated to ECC.For the BPs which is replicated to ECC from CRM , the "Relevant for POD "(Proof of Delivery) fl
-
BAPI_ALM_ORDER_MAINTAIN deleting g/l account in purchase requision
Hello, I have a program that is using the bapi BAPI_ALM_ORDER_MAINTAIN to update purchasing group in a purchasing requisition. The purchasing group is successfully updated, but at the same time the G/L account is being erased/deleted from the PR in t
-
Interactive pdf first few pages show okay then they show smaller in size. Any advice?
Have tried everything. Viewed on a mac, on a pc, always the same. Page 1,2 and 3 are fine, filling screen. But from page 4 onwards, page shows much smaller. Really need some urgent help please, on a deadline Any advice appreciated
-
[solved] new CPU, lmsensors stopped working (seemingly)
I bought a new CPU: model name : Intel(R) Pentium(R) CPU E6500 @ 2.93GHz flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc arch_perfm
-
My iphone 4 says I have only 273 MB capacity left. By far less than the total capacity (6,2 GB) minus photos, apps and data stored. What can the remaining 'documents and data' and 'others' be? How do I find out?