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
Thanks

It 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.

Similar Messages

  • 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
    Thanks

    It 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.

  • Correct ABAP Logic in Transformations-Start or Field Routine Error

    Hi
    I have written this code in start routine to split the data record into 2 if  bic/zdte_trm is not initial.
    But i am getting below error please correct me where i was wrong
    LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
          IF NOT <source_fields>-/bic/zdte_trm = ' '.
    * append a new record to source_package with this field initialised
            CLEAR wa_source.
            MOVE <source_fields> TO wa_source.
            CLEAR wa_source-/bic/zdte_trm.
            APPEND wa_source TO SOURCE_PACKAGE.
          ENDIF.
        ENDLOOP.
    At a LOOP over an internal table, the table is not allowed to be changed 
      in the loop tail as a whole.                                            
    SORT, MOVE, REFRESH, CLEAR are, for example, not allowed.

    Hi Saurov,
    Thanks for all the help.....
    The code is working fine but
    I got a strange issue while using this code
    DSO Data (Exisiting Data )
    Emp ID---Start Date--End Date
    1-----01/01/2008----
    Data from source system
    Emp ID---Start Date--End Date
    1-----01/01/2008----01/05/2008
    The code is spliting that record into 2 records
    1-----01/01/2008----
    1-----01/01/2008----01/05/2008
    and in source system in can see total 3 records
    1-------01/01/2008   (Exisisting Record)
    1-------01/01/2008   (New)
    1-----01/01/2008----01/05/2008 (New)
    The key fields in DSO is Emp Id and End Date
    Please,please update me how to resolve this issue

  • ABAP Logic in Transformations-Start or Field Routine ENHANCEMENT

    Hi
    Currently i am calculacting age of an employee in years and months using FM.
    Source Object (DOB) is DATS and
    Target object (age) is Char (6)
    My requirment is to show age in YY.MM
    If an employee age is 65Y,8M..then it shoud be displayed as 65.08.
    If an employee age is 5Y,8M..then it shoud be displayed as 05.08
    The below code is working fine for the above sceaniro...
    BUT i need  to enhance the code for
    If an employee age is 100Y,8M..then it shoud be displayed as 100.08  and
    If an employee age is 65Y,8M..then it shoud be displayed as 65.08.
    Please update me how to proceed
    DATA: YEARS TYPE TFMATAGE,
              MONTHS TYPE TFMATAGE.
        DATA: Y_NUM(4) TYPE N,
              M_NUM(2) TYPE N.
    IF NOT SOURCE_FIELDS-/BIC/ZDOB IS INITIAL.
          CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
            EXPORTING
              I_DATE_FROM    = SOURCE_FIELDS-/BIC/ZDOB
              I_DATE_TO      = SY-DATUM
              I_FLG_SEPARATE = 'X'
            IMPORTING
              E_MONTHS       = MONTHS
              E_YEARS        = YEARS.
          Y_NUM = YEARS.
          M_NUM = MONTHS.
          CONCATENATE Y_NUM+2(2) '.' M_NUM INTO RESULT.
        ENDIF.

    piece of cake...
    replace
    CONCATENATE Y_NUM+2(2) '.' M_NUM INTO RESULT.
    with
    IF y_num GE 100.
      CONCATENATE Y_NUM+1(3) '.' M_NUM INTO RESULT.
    ELSE.
      CONCATENATE Y_NUM+2(2) '.' M_NUM INTO RESULT.
    ENDIF.

  • 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 update

    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

  • Abap logic in Transformation End Routine not working correctly

    Hi,
    I wrote a piece of code but during testing I found out that it doesn't meet my requirement.
    Requirement
    I want to extract Standard_Cost for all sales items that meets the conditon. but at the moment only the first sales item in the DSO is showing.
    I would like the following lines to display in the cube as well since the PLITEM is different.
    201021     PI31     REDBACK     999999A     78,850
    201021     PI31     FLXAAA     999999A     3154,000
    DSO Table
    CALWEEK     PLPLANT     PLITEM     SALESITEM     STRDCOST
    201020     IN06     FLXAAA     557868B     6308,000
    201021     FI24     FLXAAA     557868B     6308,000
    201021     FI24     FLXAAA     999999B     0,000
    201021     PI31     REDBACK     999999A     78,850
    201021     PI31     FLXAAA     999999A     3154,000
    InfoCube
    SALESITEM  PLPLANT       SALESDOC       STRDCOST
    999999A     PI31     1100000911         78,850
    Abap Logic
    Data ld_calweek(6) TYPE n.
    Getting the current week based on the system date.
    CALL FUNCTION 'DATE_GET_WEEK'
            EXPORTING
              date         = sy-datum
            IMPORTING
              week         = ld_calweek
            EXCEPTIONS
              date_invalid = 1
              OTHERS       = 2.
    Data rp TYPE tys_TG_1.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SINGLE STRDCOST FROM /N/ABC_EFG00 INTO
    rp-S_STRDCOST
    WHERE SALESITEM = rp-S_ITEMID  AND CALWEEK =
    ld_calweek AND PLPLANT EQ rp-S_SOURCE.
    MODIFY RESULT_PACKAGE FROM rp.
    Clear rp.
    ENDLOOP.
    How do I resolve this
    thanks

    Hi Vaidya
    Select single will always select the first entry from the source which matched your where condition.
    therefore you are not getting all the required data.
    WHERE SALESITEM = rp-S_ITEMID AND CALWEEK =
    ld_calweek AND PLPLANT EQ rp-S_SOURCE.
    according to your logic
    it will pick only one record e.g
    201021 PI31 REDBACK 999999A 78,850
    201021 PI31 FLXAAA 999999A 3154,000
    item id = 999999A
    plplant = PI31
    in this case it will pick only the first record due to select single will fetch only one record (whichever it gets first and which meets your where condition)
    You need to change your code logic and need to include more fileds which differentiates one record from another who have same valued as in your present where condition.
    Thanks
    Navneet

  • Abap logic in Transformation end routine bringing 0 records

    Hi,
    I wrote this logic but is not populating the figure that I need. I am trying to get a Key figure /
    field-symbols: <fs_rp> LIKE LINE OF RESULT_PACKAGE.
    Types : Begin of s_itab,
    S_ITEMID TYPE /N/ADSO_ASPC00-/N42/S_ITEMID,
    STRDCOST TYPE /N/ADSO_ASPC00-/N42/S_STRDCOST,
    End of s_itab.
    Data : it_itab type table of s_itab,
    wa_itab type s_itab.
    LOOP AT RESULT_PACKAGE ASSIGNING <fs_rp>.
    Read table it_itab INTO wa_itab with key S_ITEMID =
    <fs_rp>-/N42/S_ITEMID.
    Clear wa_itab.
    if sy-subrc ne 0.
    SELECT /N/S_STRDCOST /N/S_ITEMID FROM /N/ADSO_ASPC00 INTO
    CORRESPONDING FIELDS OF wa_itab
    FOR ALL ENTRIES IN RESULT_PACKAGE
           WHERE /N/S_ITEMID EQ RESULT_PACKAGE-/N/S_ITEMID.
    ENDSELECT.
    <fs_rp>-/N/S_STRDCOST = wa_itab-STRDCOST.
    ENDIF.
    ENDLOOP.

    1. the name of the fields in the internal table it_itab and in table /n/adso_dsc00 are not the same, so you're move-corresponding is not working.
    2. you need to select in table it_itab not in workarea wa_itab.
    Data rp TYPE tys_TG_1.
    field-symbols: <fs_rp> LIKE LINE OF RESULT_PACKAGE.
    Types : Begin of s_itab,
    /N/S_ITEMID TYPE /N/ADSO_DSOC00-/N/S_ITEMID,
    /N/S_STRDCOST TYPE N/ADSO_DSOC00-/N/S_STRDCOST,
    End of s_itab.
    Data : it_itab type table of s_itab,
    wa_itab type s_itab.
    SELECT /N/S_STRDCOST /N/S_ITEMID FROM N/ADSO_DSOC00 INTO
    INTO table it_itab
    FOR ALL ENTRIES IN RESULT_PACKAGE
    WHERE /N/S_ITEMID EQ RESULT_PACKAGE-/N/S_ITEMID.
    ENDSELECT.
    LOOP AT RESULT_PACKAGE ASSIGNING <fs_rp>.
    Read table it_itab INTO wa_itab with key /N/S_ITEMID =
    <fs_rp>-/N/S_ITEMID.
    if sy-subrc ne 0.
    <fs_rp>-/N/S_STRDCOST = wa_itab-STRDCOST.
    ENDIF.
    ENDLOOP.

  • 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

  • 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,
    Csaba

    Dear 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

  • 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 advance

    hii
        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

  • Using MAX in transformations / Start Routine

    Hi,
    I am trying to use MAX function in an ABAP routine (transformation / Start) and it shows following error -
    "Unknown column name "MAX(/BIC/ZQMCOUNT)" until runtime, you cannot specify a field list.". Here is part of my code -
    >>
    data: v_counter(10) type n.
    SELECT MAX(/BIC/ZQMCOUNT)
    INTO v_counter
    FROM /BIC/AZDPM_DS300.
    <<
    Any thoughts please.
    Regards
    Vikash

    Hi there,
    Sometimes you have to put some spaces between the parantehsis in the max, min or count, like this:
    data: v_counter(10) type n.
    SELECT MAX( /BIC/ZQMCOUNT )
    INTO v_counter
    FROM /BIC/AZDPM_DS300.
    Can you try that?
    Diogo.

  • 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.

  • 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 AM

    Hi,
    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

Maybe you are looking for

  • CS3 won't open in windows vista

    My photoshop was working fine yesterday, now every time I try to open it, I get an error message that says "Photoshop CS3 has stopped working" then it closes down.  Any suggestions?

  • Streaming to two Apple-TV

    Hello, is it possible to multiplexing two different songs from iTunes to two Apple-TV in they same wlan-network? Thanks

  • Swap element in array

    I am trying to control a screw elevator with labview.  I have an array which holds the values for current lift position.  Once the lift is at a new position I need to overwrite the old position of the lift with the new value in the array.  I went thr

  • Switching image from Photoshop to ImageReady, CS1

    I am making a website of my art, and after I edit it in Photoshop, I then switch to Imageready and add the image to a webpage. However, the quality goes way down every time, and it's frustrating. The color becomes muted, and the artwork becomes grain

  • String to SY-UNAME

    hi all, I'm new to Java WD. As my scenario, i implement GetSAPUser() then i already get a USER NAME. Firstly, i convert the user name to String. After that, i want to call bapi which imports SY-UNAME to SAP. In other word, from userName(type String)