<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ABAP (Routine) Error in BW Transformations in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426243#M1050986</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the ODS is loading with deltas or full upload? In case of a delta in the field update routine you can read all the active data from the ODS for this Emp_ID and Wage_ID into an internal table, then sort the internal table by Payroll_Date descending and read the first line of the table. This way you can have the previous payroll date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of a full update you have to change the source package and fill the previous amount field in the start routine. &lt;/P&gt;&lt;P&gt;1. Declare an internal table similar as table source package &lt;/P&gt;&lt;P&gt;2. move contents of source package to int table&lt;/P&gt;&lt;P&gt;2. sort and loop at source package and use&lt;/P&gt;&lt;P&gt;at new payroll date.\&lt;/P&gt;&lt;P&gt;loop at int1 where Loc_ID = source-loc_id &lt;/P&gt;&lt;P&gt;                      and Emp_ID = source-emp_id&lt;/P&gt;&lt;P&gt;                      and wage_id = source--Wage_ID&lt;/P&gt;&lt;P&gt;                     and payroll_date &amp;lt; source-payrol_date.&lt;/P&gt;&lt;P&gt;remember to exit the loop after the first loop pass.&lt;/P&gt;&lt;P&gt;get the previous payroll date and move the source data and previous date and modify source package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kostas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Sep 2008 13:58:41 GMT</pubDate>
    <dc:creator>kostas_tsioubris</dc:creator>
    <dc:date>2008-09-11T13:58:41Z</dc:date>
    <item>
      <title>ABAP (Routine) Error in BW Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426242#M1050985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Requirment is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee is Compounded on Location.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Currently i have/Data comming from Source System&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loc_ID--&lt;DEL&gt;Emp_ID&lt;/DEL&gt;&lt;DEL&gt;Wage_ID&lt;/DEL&gt;&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="-------" /&gt;Payroll_Date-Amount&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;001&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;-----100.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;088&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;-----560.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;-----437.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;001&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;-----654.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;088&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;-----389.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;-----893.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;264&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.06.2008&lt;/DEL&gt;-----600.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;-----365.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Employee may have Different Wage_ID and Amount for each payroll)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirment is to include a new key figure 'Previous_Amount' which will be populated previous Wage_ID Amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loc_ID--&lt;DEL&gt;Emp_ID&lt;/DEL&gt;&lt;DEL&gt;Wage_ID&lt;/DEL&gt;&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="-------" /&gt;Payroll_Date-Amount---Previous_Amount&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;001&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;--&lt;DEL&gt;-100.00&lt;/DEL&gt;-----&lt;STRONG&gt;654.00&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;088&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;--&lt;DEL&gt;-560.00&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;STRONG&gt;389.00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;--&lt;DEL&gt;-437.00&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;STRONG&gt;893.00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;001&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;--&lt;DEL&gt;-&lt;STRONG&gt;654.00&lt;/STRONG&gt;&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;088&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;--&lt;DEL&gt;-&lt;STRONG&gt;389.00&lt;/STRONG&gt;&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.07.2008&lt;/DEL&gt;--&lt;DEL&gt;-&lt;STRONG&gt;893.00&lt;/STRONG&gt;&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;STRONG&gt;365.00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;264&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.06.2008&lt;/DEL&gt;-----600.00&lt;P&gt;&lt;/P&gt;&lt;P&gt;-1--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;999&lt;DEL&gt;&lt;HR originaltext="--------" /&gt;345&lt;/DEL&gt;&lt;DEL&gt;&lt;HR originaltext="-----------" /&gt;08.08.2008&lt;/DEL&gt;-----&lt;STRONG&gt;365.00&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As i am a starter in BW i am struggling to write start routine in transformations (DSO--&amp;gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the help of Vamsi i can able to write this code,But still the Previous Price is filled with 0&lt;/P&gt;&lt;P&gt;Please correct me where it went wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start Routine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Global declaration&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types :&lt;/P&gt;&lt;P&gt;Begin of ITABtype,&lt;/P&gt;&lt;P&gt;ORG               TYPE /BIC/OIZORG,&lt;/P&gt;&lt;P&gt;CYEMPNO           TYPE /BIC/OIZCYEMPNO,&lt;/P&gt;&lt;P&gt;HED_ID           TYPE /BIC/OIZHED_ID,&lt;/P&gt;&lt;P&gt;RHED_ID           TYPE /BIC/OIZRHED_ID,&lt;/P&gt;&lt;P&gt;CHNG_DTE          TYPE /BIC/OIZCHNG_DTE,&lt;/P&gt;&lt;P&gt;HED_AMT           TYPE /BIC/OIZHED_AMT,&lt;/P&gt;&lt;P&gt;HED_PAMT          TYPE /BIC/OIZHED_PAMT,&lt;/P&gt;&lt;P&gt;End of ITABtype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data : ITAB type standard table of ITABtype&lt;/P&gt;&lt;P&gt;with key&lt;/P&gt;&lt;P&gt;ORG&lt;/P&gt;&lt;P&gt;CYEMPNO&lt;/P&gt;&lt;P&gt;HED_ID&lt;/P&gt;&lt;P&gt;RHED_ID&lt;/P&gt;&lt;P&gt;CHNG_DTE&lt;/P&gt;&lt;P&gt;HED_AMT&lt;/P&gt;&lt;P&gt;HED_PAMT,&lt;/P&gt;&lt;P&gt;wa_itab like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data : ITAB1 type standard table of ITABtype&lt;/P&gt;&lt;P&gt;with key&lt;/P&gt;&lt;P&gt;ORG&lt;/P&gt;&lt;P&gt;CYEMPNO&lt;/P&gt;&lt;P&gt;HED_ID&lt;/P&gt;&lt;P&gt;RHED_ID&lt;/P&gt;&lt;P&gt;CHNG_DTE&lt;/P&gt;&lt;P&gt;HED_AMT&lt;/P&gt;&lt;P&gt;HED_PAMT,&lt;/P&gt;&lt;P&gt;wa_itab1 like line of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Create an internal table with all the field types with u want to have&lt;/P&gt;&lt;P&gt;*in the output */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data : wa_SOURCE_PACKAGE type &lt;U&gt;ty&lt;/U&gt;s_SC_1.&lt;/P&gt;&lt;P&gt;Data : tmp(2) type n value 1.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;\&lt;/STRONG&gt; The above loop is to get all the values into the internal table*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZORG to wa_itab-ORG.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO to wa_itab-CYEMPNO.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID to wa_itab-HED_ID.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID to wa_itab-RHED_ID.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE to wa_itab-CHNG_DTE.&lt;/P&gt;&lt;P&gt;Move wa_SOURCE_PACKAGE-/BIC/ZHED_AMT to wa_itab-HED_AMT.&lt;/P&gt;&lt;P&gt;*Move wa_SOURCE_PACKAGE-/BIC/ZHED_PAMT to wa_itab-HED_PAMT.&lt;/P&gt;&lt;P&gt;Append wa_itab to itab.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort itab by&lt;/P&gt;&lt;P&gt;ORG       Ascending&lt;/P&gt;&lt;P&gt;CYEMPNO   Ascending&lt;/P&gt;&lt;P&gt;HED_ID    Ascending&lt;/P&gt;&lt;P&gt;RHED_ID   Ascending&lt;/P&gt;&lt;P&gt;CHNG_DTE  Descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort SOURCE_PACKAGE by&lt;/P&gt;&lt;P&gt;/BIC/ZORG                   Ascending&lt;/P&gt;&lt;P&gt;/BIC/ZCYEMPNO               Ascending&lt;/P&gt;&lt;P&gt;/BIC/ZHED_ID                Ascending&lt;/P&gt;&lt;P&gt;/BIC/ZHED_ID/BIC/ZRHED_ID   Ascending&lt;/P&gt;&lt;P&gt;/BIC/ZCHNG_DTE              Descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;tmp = '1' .&lt;/P&gt;&lt;P&gt;Loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE from tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If wa_itab-ORG = wa_SOURCE_PACKAGE-/BIC/ZORG.&lt;/P&gt;&lt;P&gt;   wa_itab-CYEMPNO  = wa_SOURCE_PACKAGE-/BIC/ZCYEMPNO.&lt;/P&gt;&lt;P&gt;   wa_itab-HED_ID   = wa_SOURCE_PACKAGE-/BIC/ZHED_ID.&lt;/P&gt;&lt;P&gt;   wa_itab-RHED_ID  = wa_SOURCE_PACKAGE-/BIC/ZHED_ID/BIC/ZRHED_ID.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_itab-CHNG_DTE = wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   wa_itab-HED_PAMT = wa_SOURCE_PACKAGE-/BIC/ZHED_AMT.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  wa_itab-CHNG_DTE gt wa_SOURCE_PACKAGE-/BIC/ZCHNG_DTE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;tmp = tmp + 1.&lt;/P&gt;&lt;P&gt;Exit.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;Modify itab from wa_itab.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1[] = itab[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort itab1 by&lt;/P&gt;&lt;P&gt;ORG       Ascending&lt;/P&gt;&lt;P&gt;CYEMPNO   Ascending&lt;/P&gt;&lt;P&gt;HED_ID    Ascending&lt;/P&gt;&lt;P&gt;RHED_ID   Ascending&lt;/P&gt;&lt;P&gt;CHNG_DTE  Descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates from itab1 comparing&lt;/P&gt;&lt;P&gt;ORG&lt;/P&gt;&lt;P&gt;CYEMPNO&lt;/P&gt;&lt;P&gt;HED_ID&lt;/P&gt;&lt;P&gt;RHED_ID&lt;/P&gt;&lt;P&gt;CHNG_DTE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;wa_itab-HED_PAMT = '0'.&lt;/P&gt;&lt;P&gt;Modify itab1 from wa_itab1.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;Loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;If wa_itab1-ORG = wa_itab-ORG.&lt;/P&gt;&lt;P&gt;   wa_itab1-CYEMPNO = wa_itab-CYEMPNO.&lt;/P&gt;&lt;P&gt;   wa_itab1-HED_ID  = wa_itab-HED_ID.&lt;/P&gt;&lt;P&gt;   wa_itab1-RHED_ID = wa_itab-RHED_ID.&lt;/P&gt;&lt;P&gt;   wa_itab1-CHNG_DTE = wa_itab-CHNG_DTE.&lt;/P&gt;&lt;P&gt;   wa_itab1-HED_PAMT = wa_itab-HED_PAMT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exit.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;Modify itab from wa_itab.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field Routine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table ITAB into wa_itab&lt;/P&gt;&lt;P&gt;with key&lt;/P&gt;&lt;P&gt;ORG       = SOURCE_FIELDS-/BIC/ZORG&lt;/P&gt;&lt;P&gt;CYEMPNO   = SOURCE_FIELDS-/BIC/ZCYEMPNO&lt;/P&gt;&lt;P&gt;HED_ID    = SOURCE_FIELDS-/BIC/ZHED_ID&lt;/P&gt;&lt;P&gt;RHED_ID   = SOURCE_FIELDS-/BIC/ZHED_ID/BIC/ZRHED_ID&lt;/P&gt;&lt;P&gt;CHNG_DTE  = SOURCE_FIELDS-/BIC/ZCHNG_DTE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;RESULT = wa_itab-HED_PAMT.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please update me where it was wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 13:26:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426242#M1050985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T13:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP (Routine) Error in BW Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426243#M1050986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the ODS is loading with deltas or full upload? In case of a delta in the field update routine you can read all the active data from the ODS for this Emp_ID and Wage_ID into an internal table, then sort the internal table by Payroll_Date descending and read the first line of the table. This way you can have the previous payroll date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of a full update you have to change the source package and fill the previous amount field in the start routine. &lt;/P&gt;&lt;P&gt;1. Declare an internal table similar as table source package &lt;/P&gt;&lt;P&gt;2. move contents of source package to int table&lt;/P&gt;&lt;P&gt;2. sort and loop at source package and use&lt;/P&gt;&lt;P&gt;at new payroll date.\&lt;/P&gt;&lt;P&gt;loop at int1 where Loc_ID = source-loc_id &lt;/P&gt;&lt;P&gt;                      and Emp_ID = source-emp_id&lt;/P&gt;&lt;P&gt;                      and wage_id = source--Wage_ID&lt;/P&gt;&lt;P&gt;                     and payroll_date &amp;lt; source-payrol_date.&lt;/P&gt;&lt;P&gt;remember to exit the loop after the first loop pass.&lt;/P&gt;&lt;P&gt;get the previous payroll date and move the source data and previous date and modify source package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kostas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 13:58:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426243#M1050986</guid>
      <dc:creator>kostas_tsioubris</dc:creator>
      <dc:date>2008-09-11T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP (Routine) Error in BW Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426244#M1050987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kostas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source System--&lt;DEL&gt;-delta&lt;/DEL&gt;--&lt;DEL&gt;&amp;gt;DSO&lt;/DEL&gt;--&lt;DEL&gt;-delta&lt;/DEL&gt;--&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt;Cube&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please update me with code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Sep 2008 06:57:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426244#M1050987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-12T06:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP (Routine) Error in BW Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426245#M1050988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;declare an internal table and working area similar with the ods object.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;data itab type table of ods_type.&lt;/P&gt;&lt;P&gt;data wa_itab type ods_type.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;declare a working area for the source package.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data wa_source type type_source_package.&lt;/P&gt;&lt;P&gt;data l_tabix like sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select all &lt;STRONG&gt;active&lt;/STRONG&gt; entries from ods .&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;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&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;select * from ods_object into table itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort source_package by payroll_date descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at source_package into wa_source.&lt;/P&gt;&lt;P&gt;l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;read table itab into wa_itab with key Loc_ID = wa_source_package-loc_id &lt;/P&gt;&lt;P&gt;                                      Emp_ID = wa_source_package-emp_id&lt;/P&gt;&lt;P&gt;                                      wage_id = wa_source_package-Wage_ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_source-previous_amount = wa_itab-amount.&lt;/P&gt;&lt;P&gt;modify source_package from wa_source index l_tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code should be in the start routine of the ods update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kostas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Sep 2008 08:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426245#M1050988</guid>
      <dc:creator>kostas_tsioubris</dc:creator>
      <dc:date>2008-09-12T08:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP (Routine) Error in BW Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426246#M1050989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kostas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Thanks fro the update..really useful.&lt;/P&gt;&lt;P&gt;   I shall be greatful if you can rectify few queries i had.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   As you mentioned...in ODS start routine i defined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Internal Table similar to ODS Active Table and passing all the active entries of that ODAS to the Internal Table and sorting on Payroll Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the Start Routine logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please update me how can i write Field routine that will read only the First record of each employee&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2008 15:40:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-routine-error-in-bw-transformations/m-p/4426246#M1050989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-15T15:40:20Z</dc:date>
    </item>
  </channel>
</rss>

