(ABAP) Code in Transformation--Please explain
I am getting a strange issue when used the below code
Target : Charasteristic,Data Type CHAR 5
Code:
DATA: years TYPE tfmatage,
months TYPE tfmatage.
*DATA: result TYPE c LENGTH 5.(Showing error if included:Result is already declared)
DATA: l_res TYPE p DECIMALS 2.
IF source-field-/bic/zdob IS INITIAL.
result = ''.
ELSE.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
i_date_from = source-field-/bic/zdob
i_date_to = sy-datum
i_flg_separate = 'X'
IMPORTING
e_months = months
e_years = years.
if months 0.
l_res = years + months / 100.
WRITE l_res TO RESULT.
else.
write years to RESULT.
ENDIF.
ENDIF.
WRITE / RESULT.
I am using the above code (given by Mat in SDN) as a field routine in Transformations...can any one please explain me in detail(step by step) whats it doing.
My requirment is to cal age of the employee in YY:MM format based on his DOB & SY datum.
FIMA_DAYS_AND_MONTHS_AND_YEARS give Years & Months between 2 dates
Please update me where i was doing wrong
If months = 0 the the result should be only years
Ex: if Months & Years of FM Output is 40Y,0M the i want only 40 to be updated insted of 40.00 so that the reason why i enhanced your code
But it is giving me strange output
For Output which got months it is being update correctly but
for output for which months are 0 it is being update as
If FM output is 40Y,0M
then the output being updated is ' 40' (2 spaces before 40)
In report i need to enter 2 spaces before 40 to retrive values of 40
Please correct error
Please ask if you need any info
Thanks
Hi,
Are you using transformations?
You should not use Result because Result field is a part of SAP generated code.
Exclude declaration of result and check the code.
Similar Messages
-
In Data Quality transform please explain Associate transform with the help of any example.
In Data Quality transform please explain Associate transform with the help of any example.
Hi Neha,
If we are using multiple match transforms and consolidate the final output we will use associate transform .
Let me explain with one example based on data quality blue prints for USA .
We have customer/vendor data . We need to find the duplicates .
1. First we will find the duplicates on Name and Address
2. Second we will find the duplicates on Name and Email
3. Third we will find the duplicates on Name and Phone
Here why we need to find the duplicates in multiple stages . If we are finding the duplicates on combination of Name, Address, Email and Phone we may not get proper duplicates as we are finding the potential duplicates . That's why we are finding the duplicates on different combinations .
In this case we will get the different group numbers for each match combination . Each combination name is there .
We want to consolidate and give the group number to the whole set of duplicates . We will pass these 3 match groups to associative transform and generate the consolidated match group for the input data.
I hope you understand the concept .
Thanks & Regards,
Ramana. -
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. -
Hello,
I have a transformation routine as follows:
DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR,
l_greybatch TYPE /BI0/MBATCH-BATCH,
oref TYPE REF TO cx_root,
l_num type i,
l_len type i,
l_len1(2) type c.
l_len = strlen( SOURCE_FIELDS-/BIC/ZBAT_SUP ).
l_len1 = ( l_len - 1 ).
try.
concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into
l_greybatch.
catch CX_SY_CONVERSION_NO_NUMBER INTO oref.
ENDTRY.
=============
this transformation is between a infosource and infoobject. When i run the DTP, it gives an error at the line "concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into l_greybatch."
This -/BIC/ZBAT_SUP is calculated using a routine in the transformation between the datasource and the infosource. The same DTP is used for both load across both these transformations.
what is wrong? any suggestions?Hello Siegfried,
Thank you very much.
As you rightly pointed out -/BIC/ZBAT_SUP is not filled.
But i didnt want to fill it in the second transformation(between the infosrc and infoobject) becoz, this is used for populating 2 differnt objects for which there are different rules. I will have to run the logic(for populating -/BIC/ZBAT_SUP) twice in these 2 rules.
Hence i was trying to populate it in the first transformation(between the datasrc and the infosrc) and then use this value in the 2 rules in the second transformation.
Can you give me some other logic to do the same with the necessary ABAP code?
Following is the routine use to populate -/BIC/ZBAT_SUP in the first transformation:
$$ begin of routine - insert your code only below this line -
DATA: l_charg TYPE /BIC/AZMM_O0100-BATCH.
SELECT SINGLE /BIC/ZBAT_SUP FROM /BIC/AZMM_O0100
into l_charg
WHERE BATCH = SOURCE_FIELDS-CHARG.
RESULT = l_charg .
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_ZBAT_SUP
====================================================
The second transformation populates 2 different vendor fields in 2 different rules. Both the rules use the follwing 2 routines:
$$ begin of routine - insert your code only below this line -
DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR,
l_greybatch TYPE /BI0/MBATCH-BATCH,
oref TYPE REF TO cx_root,
l_num type i,
l_len type i,
l_len1(2) type c.
l_len = strlen( SOURCE_FIELDS-/BIC/ZBAT_SUP ).
l_len1 = ( l_len - 1 ).
try.
concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into
l_greybatch.
move SOURCE_FIELDS-/BIC/ZBAT_SUP(l_len1) to l_greybatch.
move 'G' to l_greybatch+l_len1(1).
catch CX_SY_CONVERSION_NO_NUMBER INTO oref.
ENDTRY.
*Populating Supplying(finished) batch vendor
select single VENDOR from /BI0/MBATCH
into l_lifnr1
where BATCH = l_greybatch.
RESULT = l_lifnr1.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_0VENDOR
=====================================================
METHOD compute_ZVENDOR.
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS-/BIC/ZBAT_SUP TYPE /BIC/OIZBAT_SUP
EXPORTING
RESULT type tys_TG_1-/BIC/ZVENDOR
DATA:
MONITOR_REC TYPE rsmonitor.
$$ begin of routine - insert your code only below this line -
DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR.
*Populating Supplying(finished) batch vendor
select single VENDOR from /BI0/MBATCH
into l_lifnr1
where BATCH = SOURCE_FIELDS-/BIC/ZBAT_SUP.
RESULT = l_lifnr1.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_ZVENDOR
===================================
thank you.... -
Not able to remove the ABAP code from Transformation
Hello Experts,
We have transformation for DSO in that for one infoobject, field routine is written, Break Point is hard coded there and it's move to production. Now we are trying to remove that break point from development and then move it production.
we are doing following activity to remove the break point.
1. Open the transformation.
2. Open the field routine.
3. Going to ABAP code in field routine.
4. Remove the hard coded Break Point from ABAP code.
5. Saving the code.
6. It's taking to again filed routine window.
7. We close the window and activate the transformation.
8. When again check the ABAP code in field routine then it shows hard coded Break Point again.
9. Not able to remove the hard coded break point.
Can anyone know how to do this.
Help will be appreciated.
ThanksHi,
As pointed above, after point 6 don't simply close the window but click on Transfer Value and then activate your transformation. Refresh the system and check again.
Regards,
Arminder -
(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 -
Routine (ABAP Code) in Transformation for the below sceaniro
Hi Experts,
Please update me with the routine (ABAP)(transformations)
Source Char:
Policy Start Date: ZSTRT_DTE (CHAR:Data Type: DATS)
Target Char:
Policy Expiry Date: ZEXP_DTE (CHAR:Data Type: DATS)
FM: FIMA_VTBKOND_CALC_DATES
Months(I_MONTHS) = 6
Using Policy Start Date as input need to call the FM and months input is 6 MOnths and pass that result to Target char.
ThanksHi,
try the following :
CALL FUNCTION 'FIMA_VTBKOND_CALC_DATES'
EXPORTING
i_date = source_fields-/bic/ZSTRT_DTE
i_months = '6'
IMPORTING
e_date = result.
hope it helps...
regards,
Raju -
WILL this code run and please explain
package onlinetest;
public class Animal {
public static void main(String[] args) {
Animal cat=new Animal();
Plz explain the concept if the code runs, how come jvm is handling by creating a object of the same class in itself. It seems to be a loop...??
Edited by: Jaguar on Apr 21, 2011 12:09 AMJaguar wrote:
Plz explain the concept if the code runs, how come jvm is handling by creating a object of the same class in itself. It seems to be a loop...??No it isn't, but this would be:public class Animal {
private Animal animal = new Animal();
public static void main(String[] args) {
Animal cat=new Animal();
}See the difference?
Winston -
Abap code sample..please
Hello friends,
need some help.
i have created the datasource which si based on infoset. i would like to go for the structre which will be based on program. my structure is based on pa0001 and most of the fields are from the same table.
could you please tell me how should i write a code as i not good in coding. please provide me sample code as well...
my extract structure name is ztest . it will be a nice help for me
regardsAkshay,
I thaught Generic DS with Function Module..Please guide me if i'm wrong...
you have one infoset(It is also some thing like table... won't contain data physically)... from which you want to extract data...?
no need of any code... you after creating the DS save that one. Goto RSA3, check the contents for that DS.
Replicate DS in BW. Build the Data flow in BW.
all the best.
Regards,
Nagesh Ganisetti. -
(ABAP) Code in Transformation--TO ADD LEADING ZERO FOR VALUES 10
Hi,
I am calculacting years and months between 2 given dates by using a Function Module.
The result of FM will be E_YEARS & E_MONTHS
as per my requirment i need to present the output in YY.MM format for that reason i am doing the below calculaction
l_res = years + months / 100.
WRITE l_res TO RESULT.
ENDIF.
(Ex: Y-40 & M-9 the the output will be 40.09 from above calculaction)
I want to include a condition in above logic if years<10 then i want to add 0 in front of it.
Ex: Y-9,M-8 THEN the output should be 09.08 (YY.MM)
pLEASE UPDATE ME WITH THE LOGIC
tHANKSHello,
You can format the output like YY.MM
See this [Formatting Options|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/content.htm]
You can also use USING EDIT MASK Statment
Date format
Thanks
Chandran -
Help with abap code in Transformation
Hi Experts,
we have a scenario where we load delta data from an DSO into a Cube.
The records in the DSO looks like below.
Location as (L)
WorkOrder as (W)
Startdate(DDMMYYYY)/time (HH:MM:SS) as (S)
Finishdate/time as (F)
L1
W1
21/04/2009/10:00:00
21/04/2009/12:00:00
L1
W2
21/04/2009/14:00:00
21/04/2009/23:00:00
|| L1 ||W3|| 21/04/2009/16:00:00 ||21/04/2009/20:00:00 ||
Total time ( April 2009 ) for above Location L1 should be calculated as a difference between W1 and W2 since W3 is a overlapping record. So the result would be 13 Hrs. Work Orders are summarised, so we dont need work order info in the output.
Can you experts help me with the code to implement??
Thanks,
DVFor each location, for example L1, move the records to an internal table itab.
sort itab by startdate.
read table itab index 1.
You will get the first value.
sort itab by finishdate descending.
read table itab index 1.
you will get the second value.
Calculate the difference and populate it to the internal table.
finally modify the source package.
I have just given the logic. I hope you can build upon this.
I hope it helps.
Thanks. -
Please explain what are form groups and form routines
Hello ABAP Experts,
Could you please explain what are form groups and form routines? I would certainly appreciate some examples.
Thank you in advance, AleksandraHi,
I've found the Form Group in transaction J7LE. It is part of Industry Specific solution for hi tech companies, so I'm not sure if you'll be able to access it. In this tcode you define master data of your partner. The first step is to choose the Form Group - they simply group Form Routines. Depending on which one I choose, different entry fields get activated. However there are routines that will enable input to the same fields, so I suppose there must be some additional functionality behind it. Could you please specify what does it mean?
>>Form ROUTINES, are subroutines for modularizing your code<<
I'm afraid I have no ABAP experience at all...
Cheers, A. -
ABAP code for BI 7.0 transformations start routine
Hi all,
I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
DSO1 has CUSTOMER as part of key
DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
Please give me the abap code for the above logic.
Appreciate any help in this regard.
Thanks.This is a doc from this site:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
Ravi Thothadri -
Convert ABAP code in start routine/update rule to transform. start routine
Dear BW ABAPers,
I have created a custom purchasing info cube (YCP_PURC1) based on 0CP_PURC1 standard cube. I would like to convert this new data flow to BI7 (from 3.x), and convert the standard update rule to transformation. I would need to rewrite the below start routine from the standard update rule to a start routine ABAP code in the newly created transformation / start routine. My ABAP knowledge is limited. Will you please help?
*this is the start routine from the update rule. As a side note, the data source is 2LIS_02_SCL.
LOOP AT SOURCE_PACKAGE.
IF ( SOURCE_PACKAGE-cppvlc EQ 0
AND SOURCE_PACKAGE-cppvoc EQ 0
AND SOURCE_PACKAGE-cpquaou EQ 0 ).
DELETE SOURCE_PACKAGE.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF SOURCE_PACKAGE-no_scl IS INITIAL.
IF SOURCE_PACKAGE-storno = 'X'.
SOURCE_PACKAGE-no_scl = -1.
ELSE.
SOURCE_PACKAGE-no_scl = 1.
ENDIF.
MODIFY SOURCE_PACKAGE.
ENDIF.
ENDLOOP.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
Many thanks and look forward to your kind feedback.
Kind regards,
CsabaDear All, Durgesh,
thanks to you all for your valuable input. Mainly the ABAP part was more interesting for me.
Durgesh, thanks for your input, it was useful. I just had to change the info objects to data source fields and add the lines before the loop:
DATA: I_PACKAGE TYPE TYT_SC_1.
FIELD-SYMBOLS <i_package> TYPE tys_sc_1.
I_PACKAGE[] = SOURCE_PACKAGE[].
LOOP AT SOURCE_PACKAGE assigning <i_package>.
IF ( <i_package>-BWGEO EQ 0
AND <i_package>-BWGEOO EQ 0
AND <i_package>-BWMNG EQ 0 ).
DELETE SOURCE_PACKAGE index sy-tabix.
CONTINUE.
ENDIF.
no_scl is initial ( e.g. for good receipts, billing)
value has to be set depending on storno
IF <i_package>-NOSCL IS INITIAL.
IF <i_package>-ROCANCEL = 'X'.
<i_package>-NOSCL = -1.
ELSE.
<i_package>-NOSCL = 1.
ENDIF.
ENDIF.
ENDLOOP.
Points have been assigned accordingly.
Thanks,
Csaba -
Can anyone please explain this code to me?
I am a new (junior)programmer?Can anyone please explain this code to me in lame terms? I am working at a client location and found this code in a project.
_file name is AtccJndiTemplate.java_
Why do we use the Context class?
Why do we use the properties class?
package org.atcc.common.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.springframework.jndi.JndiTemplate;
public class AtccJndiTemplate extends JndiTemplate
private static Logger logger = Logger.getLogger(AtccJndiTemplate.class.getName());
private String jndiProperties;
protected Context createInitialContext()
throws NamingException
Context context = null;
InputStream in = null;
Properties env = new Properties();
logger.info("Load JNDI properties from classpath file " + this.jndiProperties);
try
in = AtccJndiTemplate.class.getResourceAsStream(this.jndiProperties);
env.load(in);
in.close();
catch (NullPointerException e) {
logger.warning("Did not read JNDI properties file, using existing properties");
env = System.getProperties();
} catch (IOException e) {
logger.warning("Caught IOException for file [" + this.jndiProperties + "]");
throw new NamingException(e.getMessage());
logger.config("ENV: java.naming.factory.initial = " + env.getProperty
("java.naming.factory.initial"));
logger.config("ENV: java.naming.factory.url.pkgs = " + env.getProperty
("java.naming.factory.url.pkgs"));
logger.info("ENV: java.naming.provider.url = " + env.getProperty
("java.naming.provider.url") + " timeout=" + env.getProperty("jnp.timeout"));
context = new InitialContext(env);
return context;
public String getJndiProperties()
return this.jndiProperties;
public void setJndiProperties(String jndiProperties)
this.jndiProperties = jndiProperties;
}Hi,
JNDI needs some property such as the
java.naming.factory.initial
java.naming.provider.url
which are needed by the
InitialContext(env);
where env is a properties object
Now if you can not find the physical property file on the class path
by AtccJndiTemplate.class.getResourceAsStream(this.jndiProperties);
where the String "jndiProperties" get injected by certain IOC ( inverse of control container ) such as Spring framework
if not found then it will take the property from the system which will come from the evniromental variables which are set during the application start up i.e through the command line
java -Djava.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory -Danother=value etc..
I hope this could help
Regards,
Alan Mehio
London,UK
Maybe you are looking for
-
Can't locate fiiles with Itunes 9.0.1.8 then after 30minute period can.
My library said it couldn't locate the music putting the ! point on a bunch. I re-added the folder and it created duplicates for every file. Then I sorted by added date and deleted all the files I just added. 30 minutes later all the files could be l
-
I have GeForce fx tdr 5200. Is there any way to use it in agp 4x slot? When I install the drivers 44.03 I can't start any 3d programs.Why is that?I get this error in dxdiag D3D7 Test Result: Failure at step 8 (Creating 3D Device): HRESULT = 0x8000400
-
What settings do I have to make to get Ş Ţ ş ţ when I type and NOT Ș Ț ș ț as I do when I choose Romanian in the Systems Preferences-International-Input menu-Romanian Standard. It might seem to be a minor thing, but it creats problems with links, etc
-
i found a very strange behaviour in A3 - when "reprocessing" old Nikon D70s Raw files, they turn green'ish. both the preview as well as the thumbnails. this happens with every D70s Nef file. once i quit and restart A3, they are rendered correctly. th
-
I am using mplayer "SVN-r36498-snapshot-4.8.2". I found that the OSD is not showing. I toggled many times. Searched on google. says some font is missing. Any idea how to resolve