Help Need Transformation Routine

Hi ALL,
    I want to write a routine in transformation which generates sequence number(Surrogate key) whenever i load the data in cube/ODS  ,since i don't any idea on ABAP Coding i can't proceed further. Can anybody help me in writing ABAP code generate sequence number in object based on the number of records.
Please can anyone help me on this.
Thanks & Regards
Sameer Khan

Hi Sameer
Please let me know whether my understanding is correct or not
You need to create a sequence number for each record of the cube
In that case you can write a simple routine to generate a number and assign it to any infoobejct. After the last record of the data package just store the last value of sequence into a temp memoey location.
and at the start of the routine just retrive the value of that memory loacation.
Thanks & Regards
Rohit

Similar Messages

  • Help with Transformation routine

    Hi,
    I have a transformation routine from a DSO to a cube. The DSO contains two infoobjects ( Form, Brand ) which are mapped to infoobject Material in the cube. My requirement is that i need to populate the material number based on the brand and form available in the DSO. Can you please help me with the routine to be written for material ?
    Regards
    Snehith.

    Hi,
    perform below steps in start routine .
    create one internal  as t_material having 3 fields
    and then write select query as :
    SELECT material
               brand
              form
         FROM /BIC/PGPUMATL
         INTO TABLE t_material
          FOR ALL ENTRIES IN SOURCE_PACKAGE
        WHERE brand EQ SOURCE_PACKAGE-brand
      form EQ SOURCE_PACKAGE-  form
    In transformation routine of material:
    write below logic :
    FIELD-SYMBOLS  :<fs_ t_material >    TYPE y_ t_material .
    *" Get material class value from table /bic/agpud009900
        READ TABLE  t_material
          ASSIGNING <fs_ t_material >
          WITH KEY brand = SOURCE_FIELDS-brand
                             form = SOURCE_FIELDS- form
        IF  sy-subrc EQ 0
        AND <fs_ t_material >  IS ASSIGNED.
          MOVE <fs_ t_material >material  TO RESULT.
        ENDIF.
    Hope this helps you
    Thanks .

  • Help in transformation routine

    I have to put an indicator for delivery block in transformation routine.
    Logic: if headed delivery block 'LIFSK' is not blank, result is 'X'.
    Here is my code which is not working:
    IF SOURCE_FIELDS-LIFSK NE ''.
          RESULT = 'X'.
        ENDIF.
    But this code is not doing anything. I tired using 'test' function in transformation, it gives abap dump.
    What is the problem. Code is in right place in transformation routine.
    A similar code for item level block is working:
    More details:
    $$ begin of routine - insert your code only below this line        -
        ... "insert your code here
    *--  fill table "MONITOR" with values of structure "MONITOR_REC"
    *-   to make monitor entries
        ... "to cancel the update process
       raise exception type CX_RSROUT_ABORT.
        ... "to skip a record
       raise exception type CX_RSROUT_SKIP_RECORD.
        ... "to clear target fields
       raise exception type CX_RSROUT_SKIP_VAL.
        IF SOURCE_FIELDS-ZZ_LIFSP ne ''.
          RESULT = 'X'.
        endif.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_ZDELIBLK
    Thanks
    Jeff
    Edited by: Jeff Edwards on Aug 17, 2008 10:34 PM

    No luck.
    Error analysis
        The following checkpoint group was used: "No checkpoint group specified"
        If in the ASSERT statement the addition FIELDS was used, you can find
        the content of the first 8 specified fields in the following overview:
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
    ST22 / ABAP Editor :
    *-- Get field name from source field with extern posit.
      READ TABLE i_t_seg_source ASSIGNING <ls_s_seg_source>
        WITH KEY segid = i_segid.
      ASSERT sy-subrc = 0.
      IF sy-subrc = 0.
        READ TABLE <ls_s_seg_source>-t_field ASSIGNING <ls_s_field>
          WITH KEY position = l_posit_source_ex.
    > ASSERT sy-subrc = 0.
      ENDIF.
    *--  r_s_parameter-param_id has to be set out side due to type inheritance of RuleStepMapping
      CONCATENATE '<' <ls_s_seg>-y__nm '>' INTO
      c_s_connector-s__nm.
      c_s_connector-f__nm = <ls_s_field>-fieldname.
    ENDMETHOD.

  • Help needed in routine

    Hi,
    I had written transfer routine to get the crediotr and debtor fields from FIAP And FIAR DSO respectively inot zbcs cube.
    The logic is when GL account is loading into Zbcs cube it goes into Ap dso and if both GL acounts are same then it fetches Creditor or it goes inot AR dso and fetches debtor . if Gl account is not there in both result is 0.
    Problem is 1 gl account is tied to more than 1 creditor and debtor's.
    so when the code is executed its picking the first credior or debtor but not pulling all the crediotrs or debitors tied to the gl account.
    we dont have any unique key combinations from both dso to the zcube.Except company code and fiscal year period. But even company code is tied to lot of gl accounts even its not unique.
    please help me to get all the vedors or creditors for the Gl accounts.
    Thanks

    Hi RR,
    transfer routines are the place whr u change the values of data in records before they are loaded into the target, be it Info object, cube or ODS.
    U can write routines to filter records based on some value, or even change the value of a field and also u can fill up value for a field in rotine itself.
    for more info, go thru below link.
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/b9/2d9778476b11d4b2b40050da4c74dc/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/b9/2d9778476b11d4b2b40050da4c74dc/frameset.htm</a>
    hope dis helps.
    Regards,
    Purvang

  • Transformation Routine Help

    Hello Guys,
    I need your help in transformation routine.
    I have  source fields like 0DOC_NO(Sales Document no), 0CREATEDON(Created on), 0DLV_STS (Delivery status), 0DLVQLESC (Delivery Date Acc to scheduline date). i have 4 keyfigures like Late Incomplete (ZLI), Late Complete (ZLC), Ontime Complete (ZOC), Ontime In Complete (ZOI). i want to count no of sales order as ZLI, ZLC, ZOC, ZOI.
    I  have four conditions which i have to write for each keyfigures with above source fields in transformation routine.
    1) For Late Incomplete : -  if (0DLV_STS nt Eq C) and (0DLVQLSEC >0) then add1
    2) For Late Complete  : -  if (0DLV_STS  Eq C) and (0DLVQLSEC >0) then add1
    3) For On-Time Complete :- if (0DLV_STS  Eq C) and (0DLVQLSEC =0) then add1
    4) For On-TIme Incomplete :- if (0DLV_STS nt Eq C) and (0DLVQLSEC >0) then add1
    Can anyone tell me how to write it ?
    Thanks in advance
    Regards,
    Komik Shah
    Edited by: komik shah on Nov 14, 2009 1:24 AM

    Hi,
    Try this code...
    For Late Incomplete
    IF ( SOURCEFIELD-0DLV_STS NE 'C' ) AND ( SOURCEFIELD-0DLVQLSEC GE '0' ).
    IF ( SOURCEPACKAGE IS INITAL ).
    RESULT = 1.
    ELSE.
    RESULT = RESULT + 1.
    ENDIF.
    For Late Complete
    IF ( SOURCEFIELD-0DLV_STS EQ 'C' ) AND ( SOURCEFIELD-0DLVQLSEC GE '0' ).
    IF ( SOURCEPACKAGE IS INITAL ).
    RESULT = 1.
    ELSE.
    RESULT = RESULT + 1.
    ENDIF.
    For On-Time Complete
    IF ( SOURCEFIELD-0DLV_STS EQ 'C' ) AND ( SOURCEFIELD-0DLVQLSEC EQ '0' ).
    IF ( SOURCEPACKAGE IS INITAL ).
    RESULT = 1.
    ELSE.
    RESULT = RESULT + 1.
    ENDIF.
    For On-TIme Incomplete
    IF ( SOURCEFIELD-0DLV_STS NE 'C' ) AND ( SOURCEFIELD-0DLVQLSEC GE '0' ).
    IF ( SOURCEPACKAGE IS INITAL ).
    RESULT = 1.
    ELSE.
    RESULT = RESULT + 1.
    ENDIF.

  • Need help in transformation

    Hi All,
        I need a help in transformation.  There are 5 Key figures : KF1, KF2,KF3, KF4 , KF5 in my target.
    Requirement is  KF3 should be KF1 * KF2
    and if KF4 >0 ,  KF5 = KF4.
      else
            KF5 = KF3.
    I am not able to see these key figures when im trying in  formula or routine.
    How can I do these in transformations ???
    Thanks in advance..

    Hi All,
      Thanks for your inputs .
    I have used end routine for this requirement as the field level transformation will become complex as the (already present KFs in target are derived from the routines)..
    So  I have used end routine,
    Data: lwa_result_package like line of result_package.
    loop at result_package into lwa_result_package.
    lwa_result_package-/BIC/zval_chng = lwa_result_package-/BIC/zpri_new * lwa_result_package-/BIC/z_qty_new -
                                   lwa_result_package-/BIC/zpri_old * lwa_result_package-/BIC/z_qty_old.
    if lwa_result_package-/BIC/zval_chng is not initial.
    lwa_result_package-/BIC/ztot_amnt = lwa_result_package-/BIC/zval_chng.
    else.
    lwa_result_package-/BIC/ztot_amnt = lwa_result_package-/BIC/znetprice.
    endif.
    MODIFY result_package from lwa_result_package.
    endloop.
    Thanks again for your posts..

  • Help need in osb transformation

    HI guys,
    I have a requirement wheree i want to transform the data from source tot target using xquery transformation.
    The requirement is i get the source value from consumer for one of the element in source node is asset_id (0001-12345678-000), so i need to break this value and map to three elements in target .
    Can you please me out how do i do it using xquery.
    iam trying it do using if-then-else but not working.
    So please help in transforming this.
    Thanks in advance.
    Regards,
    Shaik

    I think what Eric means is that BUKRS, ANLN1, ANLAN2 are not sequences, these are elements, from the way you explained your issue eric provided the solution to split the string based on the '-'. it sounded like you wanted to post into something like
    <mytest>0001</mytest>
    <mytest>12345678</mytest>
    <mytest>000</mytest>
    sorry I don't have access to eclipse workbook to help but you can get your expressions using commands such as lenght, and substring, etc.
    the best way to do this is in eclipse create a new xquery. Added the schemas you want to map to. In the first instance ID to ANLN1, ANLN2, and BUKRS so it will look like this.
    <ID>
    <ANLN1>0001-12345678-000</ANLN1>
    <ANLN2>0001-12345678-000</ANLN2>
    <BUKRS>0001-12345678-000</BUKRS>
    </ID>
    This will provide the structure of the xquery code, now what you need to do is modify it so it only maps what you need.
    Here is some psudo code that will need to be tested my may give to a start.
    ANLN1
    fn:substring(data($ID),1,4)
    ANLN2
    fn:substring(data($ID),6,8)
    BUKRS
    fn:substring(data($ID),15,3)
    cheers
    James

  • Table Declaration in Transformation Routine

    Hi all,
    I have declared a table in transformation routine as follows :
    DATA : BEGIN OF VACATIONS OCCURS 0,
           DATE TYPE D,
           END OF VACATIONS.
    System is giving following error on this :
    ' E:Tables with headers are no longer supported in the OO context.'
    What should I do now?
    Regards,
    Aisha Ishrat
    ICI Pakistan Ltd.

    Hi Al,
       Let me explain here ... because you are doing what is being told to do without actually understanding your purpose. Let me take a scenario. You want to read a database table for sales orders populate it into the internal table. Then you wnat to loop at the internal table you populated and print the output. For this what you need is an internal table where your data will be stored - simply put its a 2 dimentional array. so your data once put into the internal table would look like:
    Sales_Order  Sold_To_Party
    1                        1
    2                        3
    3                        5
    4                        1
    Now what you do is read it - which means you are going to read one line at a time, which means a structure not an internal table, which was the purpose of the header line. but since header lines are not supported you need a different work area (structure). So that when you read the first line your structure contains as follows:
    1                       1
    When you read the second line your structure or work area contains the second line:
    2                        3
    so on.....
    From the explaination above you must be clear that you need an internal table to store data temporarily and a structure to manipulate a single record. Now the cod would look like:
    DATA: it_vbak type table of VBAK.
    DATA: wa_vbak type vbak.
    Notice above that one is using a "table" while declaring and the other is not.
    Select * from VBAK into table it_vbak.
    loop at it_vbak into wa_vbak.
    note above that you are looping at the internal table and populating one record
    into the work area.
       write:/ wa_vbak-vbeln.
    endloop.
    Hope this helps. Ask if you have any more concerns.
    Best regards,
    Kazmi

  • CX_SY_NO_HANDLER triggered when call FM in Transformation Routine in BI

    Hi,
    Currently we are encountering an error whereby the Exception 'CX_SY_NO_HANDLER' will be triggered whenever we call a Function Module inside a Transformation Routine in BI.
    Previously, this FM was a Custom FM, but even after changing to a standard FM this error still happens.
    The process does not even enter into the FM, but immediately jumps to a 'Try - Catch' block of standard SAP, with the message "an exception (CX_SY_NO_HANDLER) occured".
    Hence, we need to confirm:
    does SAP/BI allow calling an FM inside a Transformation Routine?
    if yes to above, how do we avoid encountering this error when calling a FM inside a Transformation Routine.
    Your help is very much appreciated.
    Thanks you.

    Yes, you can call a FM from function module.
    Make sure your import and export parameters are of same type as defined in FM when passing values to FM from transformation.
    For example:
    in function module
    xyz type i.
    transformation
    abc type char.
    CALL FUNCTION 'dsjfh'
    EXPORT
    xyz = abc.
    Regards,
    San!

  • How to know infopackage request ID in transformation routine ?

    Hi All,
    I'm looking for the ABAP code to know the infopackage request ID in transformation start or end routine
    I can see this ID when I clic on "manage" on a PSA (looks like for instance REQU_D706H24SFFUIGNKMQMPPAIJLM)
    I need it in transformation routine
    Thanks for your help
    Sebastien Lepeltier

    Sorry Sat but again with the code :
    field-symbols: <l_requnr> type any.
    data: l_requnr_fieldnm type string value 'l_requnr'.
    assign (l_requnr_fieldnm) to <l_requnr>.
    I have this error message in debug mode : Field symbol <L_REQUNR> is not yet assigned
    Thanks Joe for the answer but in
    IMPORTING
    request TYPE rsrequest
    datapackid TYPE rsdatapid
    request and datapackid are filled with information of the current DTP not infopackage source
    Sebastien

  • Transformation Routine for checking condition only once

    Hello,
    I would like to perform he calculations based on certain criteria which goes like this...
          LOOP AT ITab WHERE EMPno  = ITAB Empno AND
                            ATYPE = ITAB-stype .
            IF ITAB-LTYP = '1000'.
              CHECK ITab-ABEGIN GE YR_BEGDT AND ITab-ABEGIN LE YR_ENDDT.
              CHECK FLAG_ST <> 1.
              ITAB-PENDING_ST = ITAB-PENDING_ST + ( ( ITab-BAL / 825 ) * 100 ).
            ELSEIF ITAB-STPE = '2000'.
              CHECK FLAG_SL <> 1.
              ITAB-PENDING_SL = ITAB-PENDING_ST + ( ( ITab-BAL  / 825 ) * 100 ).
              ENDLOOP.
          IF ITAB-stype  = '1000'.
            FLAG_ST = 1.
          ENDIF.
          IF ITAB-stype  = '2000'.
            FLAG_SL = 1.
          ENDIF.
          MODIFY ITAB.
    How to implement this logic in Transformation roles ... as this flag checks only once.... to perform the calculation.
    Thanks
        ENDLOOP.

    Hi there,
    You must be aware of start and end routine in a transformation.
    Assumin that you would like to modify the code before sending it to individual( field wise transormation) transformation , you can write your code in start routine tab of the transformations.
    Code written in Start routine in a transformation can manipulate the data data package wise..
    say for eg if u need to fill the values in indivual routine  then u can save all  the values in an internal table ( say for eg ur itab) in the start routine and this data is available for u in the transformation routines.. so anything written in start rotuine shall work as global modification for the transformation routines.
    Similarly code written in end rotuine shall work for chunk of data which is modified individually in transformation routine.
    you ca go thr this link for more clarification
    http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417700)ID2067718350DB10090875593766856688End?rid=/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e&overridelayout=true
    http://help.sap.com/saphelp_nw04/helpdata/en/4f/a9ea964a86b04dbe4df20af6e598cf/frameset.htm
    Regards,
    kk

  • Transformation Routine to convert single record into multiple

    All,
    I need your help with ABAP Syntax.  My requirement is to take a single record and convert it to multiple records into a DSO with a condition to not create a record if a KF value is 0.
    R/3 Data Record:
    Employee | Date | Char1 | KF1 | Char2 | KF2 | Char3 | KF3 | Char4 | KF4
    Conversion Result into DSO:
    Employee | Date | Char1 | KF1
    Employee | Date | Char2 | KF2
    Employee | Date | Char3 | KF3
    Employee | Date | Char4 | KF4 (This record will not be written if no value is in KF4)
    I have read about the result table in update rules, however within BI 7.0 Transformations I am unfamiliar as to where the RESULT_TABLE function applies.  Has this been replaced by the Expert Routine?
    Could any ABAP expert provide sample code as to how I would perform this conversion in a Transformation Routine?
    Thanks,
    David

    Thanks Alex for your response.
    I did find a solution to this as it turns out to be fairly simple, however I executed the routine as an Expert Routine instead of a Start Routine.  I was advised to do the transformation here.
    The basic concept is defined below:
    Loop at source_package assigning -kf2.
              Append result_fields to result_package.
           Endif.
    -- Kf3u2026  and so on
    Endloop.
    Basically the APPEND statement is used to create the additional records.

  • Transformation routine used for GR as at posting date (0GR_VAL_PD KF)

    HI all,
              I have problem in 2lis_02_scl transformation Routine where i am not getting corect data for GR as at posting date (0GR_Val_pd) KF.
    Can anyone tell me what routine shall i try to use.
    Thanks n Regards,
    Gaurav Sekhri

    HI Gaurav,
    The code which you have given does not specify the desired result which you want. Also one more thing you have written a code as follows:
    IF ( SOURCE_FIELDS-PROCESSKEY = '002' or  "WE-Wert
    SOURCE_FIELDS-PROCESSKEY = '012' or
    SOURCE_FIELDS-PROCESSKEY = '022' )
    AND SOURCE_FIELDS-BWAPPLNM EQ 'MM'.
    RESULT = SOURCE_FIELDS-CPPVLC.
    endif.
    What is the above condition does not satisfy. you need to specify a RESULT if the above condition is not met like.
    IF ( SOURCE_FIELDS-PROCESSKEY = '002' or "WE-Wert
    SOURCE_FIELDS-PROCESSKEY = '012' or
    SOURCE_FIELDS-PROCESSKEY = '022' )
    AND SOURCE_FIELDS-BWAPPLNM EQ 'MM'.
    RESULT = SOURCE_FIELDS-CPPVLC.
    ELSE.
    REULT  = " Your desired result if condition is not met".
    endif.
    Hope it helps.
    Regards,
    Satyam

  • Need a routine

    hi all
    technically this isnt a java question but as ur all great help when it comes to problem solving i thought id ask anyway.
    Basically i need a routine for automatically determining a battle outcome in a calculated combat arena for a game im making (www.3202ad.com)
    i need to know (just the pseudo code will be fine) the way to do the loop for the attack structure.
    ill explain what i want and ive even prepared a diargram of how i want it to go :)
    what i want is this. A number of players all enter an arena, then i need to loop through these players and in turn each player automatically attacks another player until there are no players left (i already have done the attack code so dont worry about that)
    basically lets say there are 4 players in the arena, my initial idea was to have
    loop until only 1 player is left
    player 1 attacks player 2, then p3, then p4.
    then player 2 attacks p3,p4,1
    p3 a p4, p1, p2
    p4 a p1, p2, p3
    if a player is killed in this attack then they are not attacked as they are no longer in the running. The loop goes again until there is only 1 player left.
    This isnt very fair though as if ur player 1 then u either kill everyone first go or u get wiped out straight away. what i want is a code structure for something like this
    p1 attacks p2, p2 attacks p3, p3 attacks p4, p4 attacks p1
    p1 a p3, p2 a p4, p3 a p1, p4 a p2
    p1 a p4, p2 a p1, p3 a p2, p4 a p3
    this then allows each player to get an attack in with each loop but i also need to take into consideration if the player is destroyed so if p1 is destroyed after the first wave then it would go like this maybe
    (second wave) p2 a p4, p3 a p2, p4 a p2. p2 gets attacked twice now though, hmm maybe thats just gonna be the way it has to be unless u can think of a solution.
    anyway here is my lovely diagram to show it :p
    <img src="http://www.sysdia.net/pattern.gif">
    if that doesnt work then goto
    http://www.sysdia.net/pattern.gif
    Ok so this is my pseudo code for my basic attack
    lovely eh ;)
    anyway so what i would just love is someone to help me in figuring out how to come up with the theory for it (im sure its easy, im thinking bubble sort methods for some reason, something i remember from a long time ago)
    so for my first idea the code would be
    while user count>1
    loop user array (stores all users)
    with user
    user is in arena
    get all users into new array (exclude current user from first array)
    other user is in arena
    attack (this user, other user)
    by the way when a user is killed (this is done in the attack bit, they will no longer be in the arena so they will be skipped).
    anyway thats for my original idea, any ideas for my more fairer way, or even a better way?
    oh and the game is done in php and mysql if thats any help but as i say pseudo code is fine :)

    Aaaand here it is in Java:class Player {
      int _id = -1;
      public Player(int id) {
        _id = id;
      public void attack(Player victim) {
        System.out.println(this +" vs. " + victim);
      public String toString() {
        return "p" + _id;
    public class AttackAlgorithm {
      public static void main(String[] args) {
        int numAttackers = 4;
        Player[] p = new Player[numAttackers];
        for (int j=0; j<numAttackers; j++) { p[j] = new Player(j+1); }
        int start = 1;
        int timesThruLoop = 0;
        while (timesThruLoop++ < numAttackers - 1) { // For 4 atks, loop 3 times
          for (int attacker = 0; attacker < numAttackers; attacker++) {
            p[attacker].attack(p[start++ % numAttackers]);
          start++; // move progression up by 1
    }It produces the following attack sequence:
    p1 vs. p2
    p2 vs. p3
    p3 vs. p4
    p4 vs. p1
    p1 vs. p3
    p2 vs. p4
    p3 vs. p1
    p4 vs. p2
    p1 vs. p4
    p2 vs. p1
    p3 vs. p2
    p4 vs. p3
    Does this answer your need?
    Grant

  • Urgent help needed on deployment facts

    Hi
    I had completed a Java Web based application using JApplet, which in turn uses Java Media Framework and Java Communications APIs. So when i deploy this application and let the clients use this application. I need to dump some jar files and properties files into the clients JRE so that all the APIs will work properly. Without any installations. I tried doing this manually by copying these files into client machines So is there a direct method for performing the task. Or i need to add some additional code to my applet so as to find the clients current JRE version and place the required files under using FTP? Can i write a setup routine or something which does all these operations once the client access the applet?
    Help needed in the above issues
    Thanks in advance
    Swaraj

    What you will want to do is look into JNLP and Java WebStart. They allow you to write a setup for your product that makes installation as easy as InstallShield&trade; does for the Windows&trade; platform (ie: it allows customers who cannot tell Java from Perl to install your product).

Maybe you are looking for