Routine code in transformation
Hi all,
For filling Info Object ( ZPLANTYPE) , I am to fetch from other DSO, for that I have written code in routine please see below , but I am getting this error like this ''SOURCE_FIELDS-/BIC/ZCARR_ID" is unknown. It is neither in one of please help me in this the specified tables nor defined by a "DATA" statement.''
TABLES : /BIC/AZFLIGHTS00.
data : WA_ptype like /BIC/AZFLIGHTS00.
SELECT SINGLE /BIC/ZPLANTYPE INTO WA_ptype FROM /BIC/AZFLIGHTS00 where
/BIC/ZCARR_ID = source_fields-/BIC/ZCARR_ID AND
/BIC/ZCONNID = source_fields-/BIC/ZCONNID.
RESULT = WA_ptype .
Please correct me If something wrong in Code.
Regards.
hari
Also 1 small correction
>
> TABLES : /BIC/AZFLIGHTS00.
> data : WA_ptype like /BIC/ZPLANTYPE.
> SELECT SINGLE /BIC/ZPLANTYPE INTO WA_ptype FROM /BIC/AZFLIGHTS00 where
> /BIC/ZCARR_ID = source_fields-/BIC/ZCARR_ID AND
> /BIC/ZCONNID = source_fields-/BIC/ZCONNID.
>
>
> RESULT = WA_ptype .
>
Regards,
Rathy
Similar Messages
-
How do you identify the Logical system in start routine of a transformation
My scenario is this. I have five r3 systems that I am extracting from. In the start routine of the transformation from the r3 data source to my data store I am going to delete data and I need to know the source system id. How do I identify the logical system or source system id in the transformation. Is there a system field that contains this information. I do not want to hard code the source system id in the routine.
hi
have a lool at tables rsreqdone and rsbkrequest with a join you should be able to determine the source.
regards
Boujema
How to give points: Mark your thread as a question while creating it. In the answers you get, you can assign the points by clicking on the stars to the left. You also get a point yourself for rewarding (one per thread).
Edited by: Boujema Bouhazama on May 9, 2008 12:04 AM -
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. -
End Routine Code not Working after Support Pack Upgrade
Hi BI Community,
We have recently upgraded to SPS17 (BW SP19) for our production system and the code deriving the values of several attributes in the end routine of the transformation for one InfoObject (as info provider) does not work anymore. We have been trying to identify the root cause but the fact is that we did not change anything to the InfoObject and its transformation and this used to work fine. The strange thing is that when we debugged the code we could see the value of the aforementioned attributes was derived correctly but the value is just not updated to the InfoObject where we still see the old values for these attributes.
We have a similar InfoObject with the same end routine code in the transformation and it is working fine. We are out of idea what could have caused this during the SP upgrade.
Thanks in advance for your feedback.
Regards,
PeterCannot say what might have caused it but one check you can perform.
Open your transformation in change mode and you can see a button next to create end routine button, titled ' Update Behavior of End Routine Change', click on that and say all fields.
Hope it helps...
Regards,
Ashish -
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.... -
Question for inverse routine in the transformation for a virtual infocube
Hello,
I have a virtual infocube with it transformation and i want to know if there is a way to know in the inverse routine or in the start routine if in the query the user is selecting a filter value.
When the user want to select one value for a characteristic the transformation is executed in order to obtain the infoprovider values. In this moment the inverse routine is executed and i want to know if there is a way to identify when the user is making a drilldown or a filter.
In the start routine of the transformation i have an abap code with a very expensive time of execution to obtain some key figures values but i dont want that this abap code will be executed when the system executed the transformation to obtain the values for one characteristic in order to make a filter.
Thanks in advance for your help.
Best regards.
IgnacioHi Ashish,
Your document is very useful, in fact I used it to write my abap code, now Iu2019m getting the values of the query selection conditions, but what I need is after the report is showed in the first time.
When data in report is showed, user has the possibility to filter values for one characteristic. If the characteristic has the option for filter value selection during query execution equal to u201COnly Values in infoprovideru201D , the inverse routine is executed to obtain the values that are contained in the infoprovider and then the system show all the possible values. What I need is to identify this event, because in this case I donu2019t want to make some calculations in the transformation that are very expensive in time.
Thanks a lot for your information.
Best regards
Ignacio -
How to find hard code in Transformation?
Hi,
We are on a merge project and we want to find some hard code in Transformation to replace checking in each Transformation(start routine ,end routine),would anyone know how to find the hard code for examply through table or function module? thanksHi Kenny,
See if this is helpful for you.
http://wiki.sdn.sap.com/wiki/display/BI/ABAPprogramtofindBIlookupsandcodePatterns
Thanks and Regards
Subray Hegde -
Syntax Error in Routine while Activating Transformation
Dear All,
I am activating whole scenario for 0SD_C03. we have made transformation for 2lis_11_vaitm, during installation we get below errors:
- Rule (target: 0SUBTOT_1S, group: 01 Standard Group): Syntax error in routine
-Rule (target: 0NET_VAL_S, group: 01 Standard Group): Syntax error in routine
-Rule (target: 0PROD_CATEG, group: 01 Standard Group): Syntax error in routine
I really appreciate your any input for this.
Thanks & Regards,
DarshanHi,
I hope there is inbalance in between SOURCE Datapackage and Target Datapackage. So in the start routines pls check it and it not found then add in DATA_PACKAGE...
Check with ABAPer
under ,
TYPES:
BEGIN OF tys_TG_1_full,
SUBTOT_1S TYPE /BI0/OISUBTOT_1S,
and also you can fin dsimilar kind of threads in SDN.
Re: Syntax Error in Routine while Activating Transformation
Re: Issue while creating Transformation from Update rule.
Re: 0IC_C03 activation of Transformation rule ends with ERROR
Re: Error in activation of transformation
Thanks
Reddy -
ABAP Routine code for the below logic
Hello BW Experts ,
I need to write a complex ABAP routine in BW .
Following is the detail explaination .
Can anyone tell me the ABAP code for the below logic?
It would be a greate help as I am unable to do this
since last two days.
WBS Elements are maintained at IOS and Warranty levels in R/3 side.
The IOS WBS is a top level of WBS element and below that the Warranty WBS level.
The IOS and Warranty WBS elements can be differentiated by means of priority field.
When priority = i , WBS Element is known as IOS Level WBS Element and
When priority = Y the WBS element is known as Warranty WBS element.
The Equipment Number is maintained compulsorily at IOS Level WBS elements only.
It is not maintained at Warranty WBS Element.
But the Cost is maintained at Warranty WBS Elements.
In BW I need all Warranty WBS ( priority = Y) along with their cost figures and Equipment Numbers.
But as the Equipment Number is not maintained compulsorily at Warranty WBS level we have asked to
Copy it from IOS WBS ( priority = i ) and assign it to Warranty WBS level ( priority = Y ).
So I have included the Equipment Number in the ODS and in update rules I need to write the routine for it as
per the above logic.
The Equipment Number is coming from Master data of WBS Element.
The WBS element master data we are loading in BW .
Also the same WBS Element transaction data is coming from the transaction data data source in BW.
Following fields / infoobjects and the table names in BW :
1. Equipment Number : /BIC/ZEQUIPMNT and table name /BIC/MZWBS_ELEM.
2. WBS Element : ZWBS_ELEM is coming from transaction data data source as well as master data.
In ODS update rules it is coming from transaction data data source Comm_structure-ZWBS_ELEM.
Also we are loading separetly the master data for ZWBS_ELEM.
The ZEQUIPMNT is an attribute of ZWBS_ELEM.
3. Priority : PRIORITY and table name /BIC/MZWBS_ELEM.
The info object name for Priority is 0Priority but in master data table /BIC/MZWBS_ELEM
the field name is PRIORITY.
When PRIORITY = ' i ' then ZWBS_ELEM is at IOS Level
When PRIORITY = ' y ' then ZWBS_ELEM is at Warranty Level.
4. ODS name : /BIC/AZCOST00 and same is table name active data table .
So please tell me the routine Code .
Best Regards ,
Amol.Hi Dinaker,
Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
Thanks,
SAPBWI -
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. -
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 -
Source Field in End Routine of DSO Transformation
Hi,
I made a transformation from source DSO to Target DSO.
There are 7 fields in source & 6 fields in target..All the 6 fields are one to one mapped from the source to Target
I need to write a simple ABAP Logic in End Routine based on the 7th source field which is not mapped.
Please let me know the piece of ABAP code or steps where i can get the value of Source table in End routine
Regards
SureshHi Suresh,
Check here.........
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e73bfc19-0e01-0010-23bc-ef0ad53f2fab
http://help.sap.com/saphelp_nw70/helpdata/en/e3/732c42be6fde2ce10000000a1550b0/frameset.htm
Regards,
Vijay. -
An issue regarding the routines in a transformation rule
Hi experts,
I have two fields in my transformation rule which i fill through characteristic routines. The second routine needs information provided by the first routine. For example:
First char. A
Sec. char. B
In the routine for B i am using the field A which has to be filled in this moment through the first routine for a certain assignment.
The problem is that i recognized that i get here the wrong assignment because in this moment in which the routine B is running the information provided by routine A is still not there. So i have analyzed and saw that the char. B has the position 25 in the transformation rule and the char. A has the position 27. Does it really mean that in the loading the char. B is filled at first and the char. A after that because of the order? Is that the problem why I don't still have information of char. A while i am filling char. B?
If yes has anyone a good idea how to handle it? The further problem is that we can not change the order because the cube is filled and we have to delete the data at first in order to do it and it is not possible at the moment.
I would really appreciate it.
Thank you in advance.
Kind regards,
AliHi,
AS we do not know what logic you are trying to write in field level routine so its pretty difficult to understand the scenario.
I can suggest you to write the same logic in END Routine based on your requirement.
Share your logic and code for more inputs.
Hope it helps.
Regards,
AL -
(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 -
How to declare a internal table in start routine i.e. transformations
Hi Gurus,
How to define an internal table in a start rotuine?
any help greatly appreciated.
Best Regards,
Reddy.Hi,
types: begin of str,
field1 type c,
field2 type c,
end of str.
data : itab type table of str with header line.
the above code should be inserted where it says insert code below this. this will be like a global decleration. this table will be available for all the routines that you write in the transformation.
All the best !!
Regards
Aparna
Maybe you are looking for
-
Add Wireless N Router To Network With An Actiontec Router
Hi everyone, I know this wireless N thing is being beaten to death but I just really need to be pointed in the right direction. I recently built a HTPC setup with a SiliconDust HD Homerun network tuner so I could share three tuners with computers on
-
I can be on the gaming site anywhere to a few mins to a few hours but in the end it ALWAYS crashes. I don't have any problems playing on other gaming sites, so not sure as to why I would only crash on this one.
-
When searching the calendar in list view, en appointmet erlier than a few years could not be find although the appointmet is listed in the List wiew ???, An appointment from 1974 could not be found, in SEARCH MODE, although it appears in the calendar
-
My iphone 4 doesn´t connect through Wi-Fi, Apple replaced my phone for a new one, but the new one has the same problem. I have an ipod third generation and it doesn´t have this problem. Having compared both working at the same time, the iphone alswa
-
Proxying with HttpClusterServlet
Hi, I'm using a multihomed NT Server with WLS 6.0. I have one domain configured with an admin server and two managed servers which are clustered. I configured a second domain with one server and a web app deployed with