Start Routine (ABAP) in Transformations

Hi Experts,
As i am new to BW please update me with the required ABAP Code or atlease with the skeleton  Code
Source & target fields
Emp_ID       ZEMP_ID  (CHAR)
Start Date:  ZESTA_DT (DATS)
End Date  :  ZEEND_DT (DATS)
My requirment is to write a start routine that split the record in to 2
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---01/01/2008
0002----01/01/2007---
(Termination date will be blank if emp is still working)
As per my requirment i would like to see data in DSO as
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---
0001----01/01/2005---01/01/2008
0002----01/01/2007---
I want to split the records of an employee
Please let me know if u need any information
Thanks

Hi bw learner,
In Update rules, at any keyfigure, you write a routine with return table check box selected.
Write the below code.
first of all you need to declare a internal table of type data target
(Example: DATA: ITAB LIKE /BIC/FZ_CUBE). here i consider Z_CUBE as data target.
then loop the DATA_PACKAGE.
loop at DATA_PACKAGE.
transfer corresponding values from DATA_PACKAGE to itab.
then assign itab-Termination Date = ZEEND_DT.
append ITAB to RESULT_TABLE.=
endloop.
By this, whatever the records that are present in the RESULT_TABLE will be added into the Data target.
I hope you can handle now.
Regards,
S P.

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

  • How to write the start routine in the transformations ?

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

  • 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

  • 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

  • Declaration in start routine in transformations

    Hi guru's
    What is the difference between first and second global declaration in the start routine of a transformation?
    First: $$ begin of global - insert your declaration only below this line  -
    Second: $$ begin of 2nd part global - insert your code only below this line  *
    Kind regards
    Erik

    Hi Shambhu
    We usually write out code in the section:
    $$ begin of routine - insert your code only below this line        -
    What is the difference between writing the code in
    $$ begin of 2nd part global - insert your code only below this line  *
    and
    $$ begin of routine - insert your code only below this line        - ?
    Kind regards
    Erik

  • Error while transporting Transformation: Syntax error in Start Routine

    Hi Everyone,
    I'm facing a strange problem during transporting one of the Business Content cubes from Dev. to Quality.
    I'd activated the DSO 'Purchase Order Items (0PUR_O01)' and its entire data flow from the 4 datasources 2LIS_02_CGR, 2LIS_02_SCN, 2LIS_02_SGR, and 2LIS_02_ITM from BC. Then I migrated the Transfer/Update rules to transformations and the DataSources to BI7 DataSource. So far so good. The migration was successful and all the objects were activated.
    Now when I transport the same to Quality, the import fails with return code 8 and the error message says:
    'Start of the after-import method RS_TRFN_AFTER_IMPORT for object type(s) TRFN (Activation Mode)'
    'Start Routine: Syntax error in routine'
    I verified that the transformation where the error orrured was the one from InfoSource Z2LIS_02_ITM to DSO 0PUR_O01. I went and checked the start routine and it did indeed have a syntax error:
    'In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter SOURCE_PACKAGE" is incompatible with the formal parameter DATA_PACKAGE". '
    But when I check in the Dev. system, there is no syntax error for the same routine. Later, I tried to transport only the said transformation by re-activating it in Dev, and again I got the same error.
    I have no idea why I'm getting a syntax error in the start routine when there are non in the Dev. system. Also none of the coding is customised, it was only the BC code, migrated to a transformation.
    Any suggestions on the steps I could take to transport the transformation to my quality system?
    Thanks,
    Ram

    Hi Ajay, Shanthi, svu and Ray
    I do indeed have a start routine in my transformation and it was migrated from a 3.x update rule to a BI 7 transformation routine.
    The migration was successful and the Start Routine has NO syntax errors in the start routine in the Dev. system. I only encounter the error while transporting it to the Quality system. I cannot modify the code in the Quality system because it is non-changelable and there is no point in trying to change the code in Dev. because there are no errors over there.
    I've also made sure that I've transported all the necessary objects required by the transformations to quality. The routine does not perform a lookup, it simply deletes some records from the data package based on the processkey value (which is itself present in the data package).

  • Execute ABAP code in Start Routine only once

    I have ABAP code in a start routine that I only want to execute once. Is there a way to tell this is first execution of the start routine?
    Also can I find out these value in the start routine ABAP:
    1. How many data packets there are?
    2. What data packet I am processing?
    Regards,
    Mike...

    Hi,
    I've just setup a little test:
    TRules, Start Routine Global Decl:
    DATA: GVI TYPE I, GVN(5) TYPE N.
    Start Routine:
    IF GVI IS INITIAL.
    GVI = 1.
    ELSE.
    ADD 1 TO GVI.
    ENDIF.
    MOVE GVI TO GVN.
    This is basically counting the times the start routine is executed and populating the var GVN; I am posting GVN in a char ZTESTGV in the target cube. I am posting as well the datapakID in my cube.
    I have loaded two requests (each 4 packets)
    the first one first to PSA and then from the PSA to the target: this is Serially using one single process. Here's the result in the cube:
    Request________________________________DATAPAKID_____ZTESTGV
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________1____________1
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________2____________2
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________3____________3
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________4____________4
    In this case the global variable is persistent accross packets.
    the second request is loaded in paralell: this is, multiple processes are executed at the time. Here's the result in the cube:
    Request________________________________DATAPAKID_____ZTESTGV
    REQU_14QVH21BSVH44FAJW94BD7N2H____________1____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________2____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________3____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________4____________1
    In this case the global variable is always1 !!
    This is logic since several a process cannot access the internal memory used by another one...
    Conclusion; the global variable will work only if the load is serial...
    hope this helps...
    Olivier.

  • Start routine error - infosource 2LIS_13_VDITM

    Hello,
    During the activation of the standard InfoCube 0SD_C03 (Sales: Overview), I have encountered a problem in a transformation between the infosource 2LIS_13_VDITM and the afrementioned Cube (this transformation has been transferred during the activation of Business Content).
    The transformation is inactive after the installation (other dataflow structures, for other datasources attached to this Cube have been automatically activated). When I try to active it, an error message appers, informing that:
    a) Initial update has been set for some of the key rules (e.g. for target field 0VERSION) - but that is a minor obstacle; the bigger problem is that
    b) there is a syntax error in the start routine for this transformation
    Checking that start routine results with the following error:
    E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter
    "SOURCE_PACKAGE" is incompatible with the formal parameter
    "DATA_PACKAGE".
    Since I'm not an ABAPer, that info is a bit vague to me.
    I have tried to find an answer in the forums but with no success. So if anyone could provide a solution this problem or point me to a thread where it has been answered, I would be very grateful.
    I can provide more details should those be needed.
    Best Regards,
    Alek

    Thanks for the info Umesh,
    Just to be sure - I should simply change "SOURCE_PACKAGE" to "DATA_PACKAGE" in the code of the start routine? "Source_Package" is present in two places in that code:
    METHODS
          start_routine
            IMPORTING
              request                  type rsrequest
              datapackid               type rsdatapid
            EXPORTING
              monitor                  type rstr_ty_t_monitors
            CHANGING
              SOURCE_PACKAGE              type tyt_SC_1
            RAISING
              cx_rsrout_abort.
    and then after that in:
    Migrated update rule call
      Perform routine_9998
      TABLES
        SOURCE_PACKAGE
      CHANGING
        l_abort.
    Or should I revert to the 3.5 version? (as a side note, that Data Source (2LIS_13_VDITM) has been activated in 7.0 version by default, when I replicated data sources in BW).
    Praveen, as to your remarks, I have the datasource 2LIS_13_VDITM (in version 7.0) active, along with the appropriate Infosource. Transformation between the DataSource and InfoSource is active, and only the transformation between the InforSource and the Cube poses problems.
    BR,
    Alek

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

    Hi 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

  • Help needed on start routines in update rules

    Hi All,
    I want to extract data from two data sources(For ex 2LIS_02_HDR, 2LIS_02_ITM).
    I am using 2 first layer ODS' and one second layer ODS for consolidation.I want to write a start routine in the update rules so that the data of the MATNR(Material Number) field from 2LIS_02_ITM will be populated in the second layer ODS when the keys (EBELN) of the datasources are equal in the first layer ODS'.
    Can anyone send me the code for this requirement?
    Thanks in Advance,
    Sanjana.

    i am assuming u have a direct transformation with 2lis_02_hdr
    and u want to look up on the DSO of 2lis_02_ITM to get the material.
    MATNR = 0material
    EBELN = 0docnum.
    put this code in the start routine of the transformation of 2lis_02_HDR.
    TYPES: BEGIN OF s_itm,
                material TYPE /bi0/oimaterial,
                docnum TYPE /bi0/oidocnum,
                END OF s_itm.
        DATA: wa_itm TYPE s_itm,
              t_itm TYPE STANDARD TABLE OF s_itm.
    LOOP AT DATA_PACKAGE.
            SELECT material
                          docnum
            FROM /bic/aDSO_itm
       APPENDING TABLE t_itm
       WHERE docnum = <comm_structure>-docnum.
    endloop.
    IF NOT t_itm[] IS INITIAL.
          SORT t_itm ASCENDING BY docnum.
         DELETE ADJACENT DUPLICATES FROM t_itm      COMPARING docnum.
         ENDIF.
    Now write this below code in the update routine of 0material in the transformation from 2lis_2_HDR.
    CLEAR RESULT.
    READ TABLE T_itm INTO WA_Itm WITH KEY
          DOCNUM  = comm_structure-docnum.
    BINARY SEARCH.
    IF SY-SUBRC = 0.
      RESULT = WA_itm-material.
    ENDIF.

  • 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

  • Raising cx_rsrout_abort exception in Start Routine of Transformations

    Hello Abap OO Gurus:
    This is likely a very simple question but I'm brand new to Abap OO and despite reading and searching, I cannot convert some old abap code used in the start routine of business content in BW to be used in the Transformation start routine in SAP BI.
    My Start Routine inside a BI 7.0 transformation rule has a method declared like this:
    <b>METHODS
    start_routine
    IMPORTING
    request type rsrequest
    datapackid type rsdatapid
    EXPORTING
    monitor type rstr_ty_t_monitors
    CHANGING
    SOURCE_PACKAGE type tyt_SC_1
    RAISING
    cx_rsrout_abort.</b>
    The Exception "cx_rsrout_abort" has replaced what used to be a simple ABORT data field. The <u>old code I want to replace was just "abort = 1'.</u>
    But now it seems like I have to use TRY... ENDTRY statement to raise Exception "cx_rsrout_abort". I am inside the abap code of the Method "start routine"
    METHOD start_routine.
    *=== Segments ===
    Could some kind soul educate me as to how to raise the Exception "cx_rsrout_abort" inside the Method start routine?
    thanks in advance, David

    Tx HDev:
    we are almost there...  I have that PDF but never got thru to the rest of the Appendix B as my project is just too crazy...
    When try what Appenix B suggest..
    <u>"raise exception type CX_RSROUT_SKIP_RECORD."</u>
    I get the following Warning msg which makes sense...
    <b>"W:The exception CX_RSROUT_SKIP_RECORD is neither caught nor is it
    declared in the RAISING clause of "START_ROUTINE".</b>
    The METHOD statement in the start routine never declares another exception other than cx_rsrout_abort as seen below:
        METHODS
          start_routine
            IMPORTING
              request                  type rsrequest
              datapackid               type rsdatapid
            EXPORTING
              monitor                  type rstr_ty_t_monitors
            CHANGING
              SOURCE_PACKAGE              type tyt_SC_1
            RAISING
              cx_rsrout_abort.
    Maybe NW2004s has a bug here... I'm hoping that a SAP Developer reads this posting and can enlighten us all... otherwise I'll have to post a OSS msg
    So the mystery is still how to do
    "raise exception type CX_RSROUT_ABORT" and make this equal to ABORT = 1
    which makes the start routine skip a record
    tx again,  David

  • Start routine in DSO Self transformations

    Hi SCN,
    I need to write start routine to fill one of my target feild.
    Here my info object is ZCust and attribute zpur_grp
    My DSO have 0customer and zpur_grp.
    Am creating self transformations for my dso and need to fill zpur_grp from zcust if dso-zpur_grp is blank.
    condition is dso-0customer = info object-customer.
    Am new to abap code part and confused about specifying fields and tables(/bic/).
    Need suggestions to write sample format code.
    Thanks in advance.
    Chandra

    Hi Chandra,
    U need to write look-up code.
    Below s sample code. it might be help you.
    Declare Internal Table Like follow:
    TYPES: BEGIN OF TY_CUST,
                      ZCust TYPE /BIC/ ZCust ,
                      zpur_grp TYPE /BIC/ zpur_grp
                   END OF TY_CUST.
    select value for internal table.
    SELECT /BIC/ ZCust /BIC/zpur_grp
           FROM /BIC/PZCust
           INTO TABLE IT_CUST
           FOR ALL ENTRIES IN SOURCE_PACKAGE
           WHERE /BIC/ZCust = SOURCE_PACKAGE-/BIC/0customer
           AND OBJVERS = 'A'.
    Then write Lookup code in start routine.
    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
           clear : WA_CUST_DBDIV.
    * Read internal table for customer
           READ TABLE IT_CUST
           WITH KEY ZCust = <SOURCE_FIELDS>-/BIC/0custome
           INTO WA_CUST_DBDIV
           BINARY SEARCH.
    *Populate the corresponding Customer and DB Division in RESULT_PACKAGE
           IF SY-SUBRC = 0.
             <SOURCE_FIELDS>-/BIC/0custome = WA_CUST_DBDIV-ZCust.
             <SOURCE_FIELDS>-/BIC/zpur_grp = WA_CUST_DBDIV-zpur_grp.
    ENDLOOP.
    Hope it 'll help you.
    Regards,
    Mukesh

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

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

Maybe you are looking for

  • How can I watch MKVs on a DVD player and keep 5.1?

    Hi, I have several MKV files which I want to convert to play in a DVD player/Xbox 360. I want to keep the hi def and 5.1 sound in the newly encoded file. I have tried using Handbrake with some success. The video is outputted in hi def and it plays in

  • Multiple Digital Signatures (certificates) results in VERY slow PDF

    I created a form in Lifecycle that typically has 8 signatures.  As more signatures are added the form slows down significantly.  Our director, who ultimately signs off on the document, has informed us that it took him 35+ minutes to approve 3 documen

  • Photoshop CC Camera Raw Update to 8.3 not working?

    I run Photoshop CC which currently has camera raw 8.2 installed. If I run the update process from the help menu, it keeps telling me that PS CC is up to date and nothing to update although a check on the camera raw plug-in still reads out to version

  • CAN'T MOVE SONGS IN PLAYLIST

    I create a playlist with songs from my library and then try to drag the songs within the playlist to make a different order and they wont change position from how they were originally dragged in. is there a setting i need to check or uncheck to fix t

  • Traversing a tree

    Hello, How do I traverse a tree in such a manner that I visit all the nodes of the tree and at the sametime prepare a array/list containing all the nodes? An example will be highly appreciated. Thank you.