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

Similar Messages

  • How to make for loop pass only once in a next() method

    Good Day!
    Can anyone help me or suggest any idea to resolve my problem with the below code, wherein it will only pass the for loop only once. I already tried inserting the for loop in side the if (sqlset4.isFirst()) condition but the problem is it only retrieved the first row of the resultset.
    Cheers!
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 for (int i = 1; i <= numberOfColumns; i++) {
                                     if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                         writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) + ")";
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();I am using Netbean IDE 6.8
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi

    Hi everyone!
    What I actually trying to do is that I have a multiple tables and from these tables I'm going to write each of it into a flatfile that is a pipe delimeted that is why I have to make a loop to know how many fields I am going to write. The code that was attached are actually working, my only concern is that it will take a longer time of processing cause every record of a table it will pass to the for loop(checking how many column) wherein number of column/ were already known on the first loop.
    Hi kajbj,
    I think what your trying to explain is almost the same with below code which i had already tried. The problem with this is that the every loop of the outer loop data retrieve is only the data of the first record.
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 if (sqlset4.isFirst()) {
                                    for (int i = 1; i <= numberOfColumns; i++) {
                                        if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                            writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) ;
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();

  • Need to populate value for a KF only once for a combination of characterist

    Hello All,
    We had a requirement for a report. wherein we need to consolidate the data of the 0FI_GL_4 datasource and a custom table.
    both these sources have only 4 fields in common i.e Fiscal Year/Period; Company Code and Pool
    in the custom table, for each fiscal yr/period & Pool combination, there is a unique Plan value available.
    To consolidate the data, I wrote a routine in the transformation to extract data from the custom table based n the combination of Fisc yr Period, Comp Code & Pool.
    However, since 0FI_GL_4 has more than 1 entry for the above mentioned combination  that is GL_accounts, document number, etc; during extraction, my plan value is being extracted multiple times to the cube and hence for a fiscal yr/period, cube shows a summation value.
    I want the plan value to be picked only once.. please advice

    Hi Sneha,
    As I understand in your infocube along with the primary key of custom table one more field exists e.g. Document number and due to which the value is getting repeated over multiple lines.
    Though all these records are valid but when you are running report on this cube without document number all the plan values are getting aggregated, again this behaviour is also correct.
    For your reporting purpost I feel that you need to extract data from the custom table in other data target and then do the reporting on that, wherein the plan value will not be repeated.
    Regards,
    Durgesh.

  • Need clarification to write transformation routine for my requirement

    Hi all,
    I have a requirement as mentioned below...
    I have a keyfigure amount which will hold the amount value..now i have been asked to add amount_2000 key figure...it has been done..
    But the real problem is that
    They will give a filter value in DTP selection for the field "area".
    now if they give area as 1000 then the amount field should populat with the respective amount value
    but whereas amount_2000 should populate with only the amount of the area 2000 irrespective of the filter condition given...
    i need to write the routine in the transformation...But the problem is that when we give the filter value in DTP i coudnt get value for amount_2000 as only it gets the value for 1000.
    I hope the requirement is clear...
    can any one help me in this.
    Thanks & Regards,
    Hari.

    Write a routine for the InfoObject amount_2000.
    Use amount and area as source fields.
    Now the coding should look like:
    IF source_fields-area = '2000'.
      RESULT = source_fields-amount.
    ELSE.
      RESULT = 0.
    ENDIF.
    This is independent of the filter values in the DTP.
    Best regards
    Dirk

  • BADI/User Exit for Checking Conditions in TRM Transactions

    Hi  All,
    I have to check some conditions before saving the transaction FTR_CREATE. So that based on that condition it will be known that whether that transaction will save or not.  I found some BADIs, but those are particularly working for Money market and derivatives. For my Req, I need a BADI which will check conditions for both Money market and Securities.
    Exact req is, Based on Portfolio and PaymentAmount i have to restrict the transaction. Those will found in 2 tables VTBFHA and VTBFHAPO. But many BADIs doesnt contain VTBFHAPO.
    If any one working on TRM can u help me out ?

    >
    priya tavanam wrote:
    > Hi Frds,
    >
    > I am using the FTR_TR_GENERIC Badi.  In that one method is : EVT_TRANSACTION_SAVE_CHECK. In that one parameter is PI_PROXY_TRANSACTION. I want to get the attributes of Method A_TAB_CASHFLOW . That is  : A_TAB_CASHFLOW~BZBETR.
    -->whats ur code to read those values , it should be
    lt_cashflow[] = PI_PROXY_TRANSACTION->a_A_TAB_CASHFLOW [ ] ' .
    But i am unable to access this value in BADI. how access this. Can any one help me on this.

  • Transformation routine for Infoobject lookup

    Hey guys,
    I am aware of Update rule routines but never done Transformation routine before. I didnt get any related post for my req.
    My requirement is on WBS element I have some attributes which is coming from std WBS Attr extractor but I have one custom attribute infooject which I want to populate through an Infoobject which is also a master data Infoprovider. For this I have to write a Tranfer rule routine.
    Please note these are transfer rules in BW 3.5 not BI 7. Please provide exact code. Appreciate your help.
    Thanks.
    BMW M///

    Declaration of Types table for your master data object in the declaration area....
    Replace your attributes in place of plant, GSRCSYS and CALMONTH
        TYPES: BEGIN OF TY_WBS,
                     /BIC/GPLANT TYPE /BIC/OIGPLANT,
                     /BIC/GSRCSYS TYPE /BIC/OIGSRCSYS,
                     CALMONTH TYPE /BI0/OICALMONTH,
               END OF TY_WBS.
        DATA: IT_WBS TYPE TABLE OF TY_WBS,
                    WA_WBS TYPE TY_WBS.
    /BIC/AWBS = your master data table name
    SELECT * FROM /BIC/AWBS INTO WA_WBS
        WHERE OBJVERS = 'A'.
    THen in the transformation Routine on field level use the below code to populate the value
    "  /BIC/GPLANT = L_SOURCE_PACKAGE-/BIC/GPLANT.
       substitute your objects here to query the master data object to get values.
    READ TABLE IT_WBS INTO WA_WBS WITH KEY
          /BIC/GPLANT = L_SOURCE_PACKAGE-/BIC/GPLANT.
    RESULT = WA_WBS-Your object name.
    Hope this will help you...

  • Any routines for excise conditions?

    Hi,
    Iam using the excise conditions in my pricing procedure TAXINN. shall we use any standard routined for the excise condition types (Alt cal .type)?
    regards,
    jyothi.

    Hi,
    There is a user exit for this.
    J_1I7_USEREXIT_CALC_EXC_BASE.
    Also you can refer to SAP Notes 952289 and 1002634.  This should definitely help.
    Thanks.
    Krishna.

  • Transformation routine for record manipulation DSO to cube

    Hi Experts
    My scenario is this
    1 row going into the transformation will be transformed into 1 or more rows out of the transformation. Same consept as return table in v3.5.
    Does any one have a sample code for this?
    I am thinking this should be put into the start routine and include a loop and manipulation of the the source_package.
    I just can't figure out the syntax. Perhaps this is not even the right way to go. Any suggestions?
    Help will be rewarded with points.
    best regards,
    Nina

    Hi Shambhu ,
    thanks for reply...
    My DSO  key fileds are PR No and PR Line item No
    Data field is Indicator ( R/D ) for every line item .
    per example One PR No contains 3  line ietms and indicators are D / R
            PR No -
    Item No -
    Indicator
             1000            10              D
             1000            20              D
             1000           30              R
    next day i will recieve delta -
    1000 , 30 , D   ---then my data will be in DSO
              PR No -
    Item No -
    Indicator
                1000            10              D
                1000            20              D
                1000           30               D
    i want to report ,  how many PR No are deleted or released  in Calander day ?
    Report conditions :
    if at least one line item indiactor has 'R' then that PR No is called as Released PR.
    if all line item indicator has 'D' then the PR No is called as Deleted PR.
    Plz tell me , how can i write routine ...and where can write ?
    i assign points...
    Regards,
    PSR

  • InfoPackage ABAP Routine for Date Range - Only Start Date Extracted

    I am using an ABAP Routine in an InfoPackage to select data for a 2 year period.  The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period.  The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
    The Source and Target are both Basic Infocubes.
    The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period.  Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded.  I’m guessing that the extract was only performed with the From value, even though a To value was also provided.
    I created a simple Infopackage and manually input the selection parameter values just to be sure I wasn’t overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
    I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
    Has anybody ever experienced this before ?  Any ideas would be greatly appreciated ?
    Thanks,
    Lyle

    We can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
       l_s_range-sign    = 'I'.
       l_s_range-option  = 'BT'.
       l_s_range-low     = lowvalue.
       l_s_range-high    = highvalue.
      MODIFY l_t_range FROM l_s_range INDEX l_idx.
    As you can see the key is passing the "BT" information for capturing range.
    Hope it helps..
    thanks
    Kumar

  • Best SD userexit to use for checking 'material pricing conditions' (KOMV-KSCHL)?

    Hiya,
    When creating a sales document I'd like to check the material pricing conditions (KOMV-KSCHL), specifically for rate(KBETR), when a material is entered into an order.
    If the Rate value is not as expected then I'd like to raise a pop-up to inform the user.
    I was searching for a userexit to use and I can't find anything that fits my requirement...
    I was therefore thinking of using USEREXIT_PRICING_PREPARE_TKOMP or USEREXIT_PRICING_PREPARE_TKOMK.
    But I thought I'd just check with you experts first.
    Would anyone have any suggestions?
    Thanks in advance!

    Hello Robert,
    I would suggest using 'USEREXIT_PRICING_PREPARE_TKOMP' which is for Item level fields. However, why would the rate be not as expected, is there a limit that you want to set ?
    Also its worth noting that these user-exits get triggered 3-4 times every change is made. You may want to restrict that.
    Another option is to set a flag in a requirement routine for the condition type and use it to send a pop up in User-Exit.
    Rgds,
    Vijay.

  • Start routine: only once per teh load but not once per data packet

    Hi,
    I would like to execute some code in start routine (in update rules) only once per the load but not once per the data packet.
    How can I implement this.
    Regards,

    I once had that same requirement, but in a datasource in R3. I'm not sure if the same solution would work in BW, though. I used a memory id to keep the variable value between packets:
    DATA: ... n_globalvar TYPE n ...
    then I added...
    IMPORT n_globalvar FROM MEMORY ID 'ZMEMID01'.
    ...at the start of the routine to retrieve to the variable the value from the memory id.
    At the end of the code, I exported the variable back to the same memory id...
    EXPORT n_globalvar to MEMORY ID 'ZMEMID01'.

  • REGEX statement not working in transformation routine?

    hi,
    I need to include the REGEX ABAP key word in transformation routine for one of the fields--
    FIND all OCCURRENCEs OF REGEX
    But when i include this statement it says:
    E: statement "REGEX" is not defined.check your spelling--
    but same statement when i copy in SE38 ABAP editor it works very fine--
    May i know what is the reason?
    i had tried with all possible single quotes before posting here

    Is that the entire statement?  It looks like it is interpeting REGEX as a variable.  It should look something like this:
    FIND all OCCURRENCEs OF REGEX '(\b\S+\b)(-?)' IN g_result

  • Target value in transformation routine

    Hi
    How can I get the value of target field, which is already present, in the transformation routine?
    For Example, I have a transformation between ODS DS1 and ODS DS2. DS1 has fields DS1_F1, DS1_F2 and DS2 has fields DS2_F1, DS2_F2. Now I have written a transformation routine for target field DS2_F1 with input DS1_F1. In this routine, I want to get the value of DS2_F1, which is already present, before the result is being updated. How can I get it?
    Thanks & Regards
    Tejo

    Hi,
    Use end routine concept here .
    Regards,
    Anil Kumar Sharma .P

  • Need to run start routine only once

    I understand that for every data package from ODS to Cube, the start routine is run.  But I need to run it only once.  Is there anyway to achieve this?  As the programming logic doesn't really do anything to the data package, I don't need it to be in the start routine.  But as I populate a database table using that routine, which in turn is used in update routines, I need to kick it off before the load from ODS to cube happens.  I think an ABAP routine variant can be kicked off in process chains.  Did anyone use the variant and know how to kick off the routine?  Do I have to write this logic in a function module and then kick it off using ABAP variant in Process chains? 
    I would prefer a way to limit my start routine to run once for every data load rather than kicking it off through process chain.  Can someone discuss which is a good approach and how I go about it?  Thanks for your inputs.
    Sam

    Hi Sameer,
    Let me recap you req. You want to populate a database table in your start routine and need to do it once for a load.
    There is no possible way to limit the no. of times a Start routine is run, but you can find some worksaround.
    Is there anyway you can identify that your DB table is updated with new records, i.e.
    1> You delete and refill table every time
    2> You have some kind of time stamps.
    If one of the above case is true, then you can use that as a check in the Start routine to limit the no. of times the DB table is being populated.
    Regards,
    Sree

  • [EVL] Execute constraint check only once (per model)

    Hi All,
    I have been working with Epsilon for a few days now and I love the tool so far
    I am currently working on a model validation but I cannot find an elegant way to perform a certain check only once for the entire model. The casus/Meta-Model is very simple. I have a Node that has 0..* references to itself. The idea is to have a very simple tree where nodes have a reference to their parent.
    What I want to check is that there is one and only one root node, so only one node without a reference. This results in the following check: AT!ATNode.allInstances.select(n|n.Parents.size() == 0).size() = 1
    I do not know where to perform this check however. If I perform it in the context of the node, it (correctly) returns an error, but does this for every node.
    I also tried to have the entire model as 'context' or to apply the check in a pre-condition, but could not get any of these approaches to work. I also could not find a suitable guard to put on the constraint.
    Can you help me find a more elegant solution?
    Greetings,
    David

    Hi David,
    Quote:an elegant way to perform a certain check only once for the entire model
    May be you could model the "entire model" ... I mean, it's a kind of a good practice to create a ModelRoot class containing all your nodes. [A better name could be "Tree" or another appropriate name according to your domain]
    Then your validation wizard, with the exactly same expression, could be set on this class, a.ka. the "entire model" ?
    Furthermore, you could also ensure the root unicity by setting proper cardinalities in the metamodel, and avoid writing a check.
    I even met a special case where I had to model explicitely the RootNode as a class => A tree contains one root node which itself contains nodes ...
    Cheers,
    --Eric

Maybe you are looking for

  • ASA 5505 VPN Ping Problems

    Hello everyone, First off, I apologize if this is something that I can google. My knowledge of network administration is all self-taught so if there is a guide to follow that I've missed please point me in the right direction, its often hard to Googl

  • Using JAZN in forms 9i

    Is it possible to do basic authentication using JAZN LDAP on forms application? I have modified the application.xml to include the following: <jazn provider="LDAP" default-realm="coname.com" location="ldap://localhost:389" /> <security-role-mapping n

  • Submitting forms by email

    I'm new to designing forms, but have a request from a client to make a simple PDF form that can be filled out and returned by email.  The client would like to have the person click a submit button in the form and have it emailed (the straight PDF) ba

  • ITunes and sync

    How can I sync my playlists fromy PC to my apple devices. I have updated software on all of my devices.

  • Moving in and out points of layers into a new comp

    I'm in a bind. I'm creating a complex moving split screen scene. First I chose in and out points for all my video clips (about thirty of them) in Premiere Pro, and made a rough plan of what it should look like. Then I Dynamic-Linked it to After Effec