Problem using SUM standard function  during Field Mapping

Hi Experts ,
I am trying to sum all LIFMG 's in in the lineitems of a particular
header and map this result to Lifmg of the header.(Idoc with multiple headers and line item).I am using SUM standard function.
Rough Source structure.
Header1
      vbeln
....Lineitem1
      vbeln
      posnr
......LIFMG
....Lineitem2
        vbeln
        posnr
......LIFMG
Header2
     vbeln
....Lineitem1
        vbeln
       posnr
......LIFMG
....Lineitem2
        vbeln
       posnr
......LIFMG
I am able to find the SUM ...but in the target structure's Header field  I am getting
repeated value of the corresponding sum in each header ...i.e.
Header1
LFIMG-- 100
LFIMG    100
Header2
LFIMG-- 102
LFIMG    102
How to get a single value for each .
Regards,
Deepak

Solved Myself ...
Placed  sum after  if without else ...
placing it before was causing ...those values to be replicated.

Similar Messages

  • ABAP code which will use function module during field mapping in LSMW

    Hi,
    During field mapping in LSMW, for one of the field called field, I want to use a function module 'QF05_RANDOM_INTEGER', which will generate random numbers and map that random number to that field.
    How do I write ABAP code which uses function module, during filed mapping for a particluar field in LSMW ?
    Please help...
    Regards,
    Tushar.

    Hi Tushar,
    You can write in FORM ROUTINE and LSMW.
    I hope you know how to write ABAP code at field level.
    If not ...
    Come to change mode->select the field->Rule->ABAP Code
    write a perform statement in ABAP code at field level.
    <b>PERFORM test</b> using val
                 changing valu.
    Go to Utilities(at menu)->switch layout-> extras ->select Layout->check Form routine-> it will display a FORM Routine... at bottom
    this is the place where you can write some code for
    <b> FORM test</b> using value
              changing value1
      FM call....
    .ENDFORM  
    Get the value1 returned and use for the Field population.
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • Is it necessary to use the standard function modules always?

    Hi All,
       Suppose i can retrieve the BUSINEES PARTNER ID from the table BUT000 with the help of 'BP_GUID' field through a select query statement. 
    Now is it necessary to use a standard function module to retrieve the same data. what about the performance? which is the better solution. to implement our own code or to use the function module available.
    Please someone clarify me about this issue.
    Regards,
    Sharry.

    If you'd ask the question in general it's obvious that there is no good answer as it always would depend on the circumstance. However, as you've posted your question in the performance tuning forum, let's look at your question in this context first. I think it's fairly safe to say, that in almost 100% of the cases a standard function module will not be as fast as any well implemented and custom tailored code. If in doubt, just try reading the code of the function module you want to read; most likely you will find lots of unnecessary fluff in there, often they read data that you don't even need.
    And as far as buffering is concerned, that can also be an issue. E.g. let's say you do a massive read of distinct business partners and you only need the data once for each partner. Obviously buffering is silly in this case and it might even slow down your program, because the implemented buffering is not necessarily well implemented. I've come across a few cases, where the buffer tables where standard tables with no efficient read access (so no sorted table or hash table) and once tons of data were buffered, it actually took a moment to look up if the record already was buffered (just to find it wasn't there yet).
    Now most of the times this slowdown is not an issue as the lookup is still fast compared to the (usually) prevalent database accesses with their slower IO timing. But another factor to consider is memory consumption and why buffer data in memory (and waste it), if you can't use the buffer anyway? So when I do use standard function modules, I usually try to see what they retain in global memory, to better understand if I need to call some initialization/clearing/refresh function...
    Note also that often you need to process lots of data, but don't find a standard function module for "mass access", so you need to read your object one by one. Obviously that's another good candidate for implementing your own queries, where you can process the data in packages.
    So what might be the reason to use a standard function module? Well, often it's required because the logic is so complex that it would take you too much time to implement it (not to mention that we often simply don't know all the logic that's coded in there). Another advantage is that you might get independent of the data model. E.g. for IDoc interfaces SAP switched in some release the tables where the data is stored. So if you had coded your own queries to get IDoc data, they wouldn't have worked after this particular release upgrade. The standard function on the other hand, checks both the old and new tables, so by using it you would have been fine.
    The one major caveat I'd give though is to always check whether the function module is released or at least documented to some degree. I.e. if it's not released, SAP won't support it and does not guarantee that the interface or logic stays the same. In my experience lots of functions I do want to use are not released (or documented), but I will still use them because they seem to be the best alternative in certain scenarios.
    Cheers, harald

  • How to use  Advance java function in graphical mapping in XI 2.0?

    Hi,
    currently I am using a simple java function to make an RFC call to R3 system.
    I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
    please suggest a solution.
    I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
    thaks in advance.

    Hi!!!
    I'm not sure if I understood you well.
    Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
    In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
    If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
    Regards,
    Andrzej Filusz

  • SQL query problem using analytical/report function

    Hello there,
    I am having some problem writing my query. I have this table below:
                  create table t (priority number,
                                  plannedamount number,
                                  availablepieces number,
                                  material_id varchar2(20))
    insert into t values (1, 15, 30, 'A');
    insert into t values (2, 20, 30, 'A');
    insert into t values (3, 5, 30, 'A');
    insert into t values (4, 8, 30, 'A');
    insert into t values (5, 4, 30, 'A');
    insert into t values (1, 2, 10, 'B');     PRIORITY|     PLANNED AMOUNT|AVAILABLE PIECES |     MATERIAL_ID
         1      15     30 A     
         2      20     30 A
         3      5     30 A
         4      8 30 A
         5      4     30 A
         1      2     30 B .
    Each line is a customer order ordering a material. I am grouping by material and ordering it by priority. I want to display a new column called pieces not reserved yet. This column will show that if the order can be fully reserved for that current order ordering by priority.
    If the row can be reserved it will substract and bring it to the next row. If it cannot the pieces not reserved will remain the same.
    I've tried using sum(), lead(), first(), lag(), etc but I still cannot get the correct result.
         PRIORITY|     PLANNED AMOUNT|PIECES NOT RESERVED YET |     MATERIAL_ID
         1      15     30 A     
         2      20     15 A
         3      5     15 A
         4      8     10 A
         5      4     2 A
         1      2     30 B
    Can anyone elaborate or have any hints on what method to use to create this column?
    Thanks. .
    Edited by: 998373 on Apr 5, 2013 11:42 AM
    Edited by: 998373 on Apr 5, 2013 11:43 AM

    From 10.x on
    with t(PRIORITY, PLANNED_AMOUNT,AVAILABLE_PIECES , MATERIAL_ID) as
    select      1, 15, 30, 'A' from dual union all
    select 2, 20, 30, 'A' from dual union all
    select 3, 5, 30, 'A' from dual union all
    select 4, 8, 30, 'A' from dual union all
    select 5, 4, 30, 'A' from dual union all
    select 1, 2, 30, 'B'  from dual
    select
      MATERIAL_ID
    , PRIORITY
    , PLANNED_AMOUNT
    , AVAILABLE_PIECES PIECES_NOT_RESERVED_YET
    from t
    model
    partition by (material_id)
    dimension by (PRIORITY)
    measures (
      PLANNED_AMOUNT
    , AVAILABLE_PIECES
    rules (
    AVAILABLE_PIECES[priority>1] order by priority=
      case when PLANNED_AMOUNT[cv()-1] <= AVAILABLE_PIECES[cv()-1]
           then AVAILABLE_PIECES[cv()-1] - PLANNED_AMOUNT[cv()-1]
           else AVAILABLE_PIECES[cv()-1]
      end
    MATERIAL_ID     PRIORITY     PLANNED_AMOUNT     PIECES_NOT_RESERVED_YET
    A     1     15     30
    A     2     20     15
    A     3     5     15
    A     4     8     10
    A     5     4     2
    B     1     2     30

  • Some problems using some Matlab functions

    Hello,
    I have some trouble with MathScript when i want to use some MATLAB functions in it such as unique or histc. (i'm using windows 7 and LV2010 SP1)
    These functions are theoretically supported by MathScript insofar as they exist in MathScript Documentation but they return an error. This error explains that my matrix sizes are invalid but when we are doing exactly the same process with the same matrix in MATLAB, it ends well.
    So I checked the two MATLAB and MathScript documentations in order to see if there is a difference between the same functions. It is proving to be the same functionning in MathScript and in MATLAB so I am a little lost.
    In order to show you a concrete example :
    If we have a X matrix equals to (77 77; 88 96) and we are doing unique(X). The result is supposed to be (77 88 96) but mathscript returns an error.
    On the other hand, if X is not a matrix but a vector, unique ends well but i'm not interested in using some vectors (because it is exactly the same kind of problem with some others functions using only matrix).
    I could use a matlab node script but in this project, we would to avoid the use of a Matlab Licence.
    Do you have some idea in order to fix this kind of problem
    Thanks a lot

    Hi,
    Currently, the unique(X) in MathScript can accept vector input only. It reports error when X is a matrix. As a workaround, you can use
    unique(X(:))
    instead.

  • Problem using SUM BY

    I need to count the number of jobs by year and nature of the job.
    I need to calculate also the number only by year (to calculate, later, the percentage). To do this, I tried to use the SUM BY statement:
    SUM("- Misure"."Numero Lavori" by "- Inizio Lavoro"."Anno Inizio Lavoro")
    Note that the number of jobs is calculated with the COUNT DISTINCT aggregation rule.
    Here's the query generated by BI:
    WITH
    SAWITH0 AS (select count(distinct T6686.CD_LAVORO) as c1,
    T6906.ANNO as c2,
    T6842.CD_RITORNO_LAVORO as c3
    from
    L_RITORNO_LAVORO T6842,
    L_DATA T6906 /* L_DATA_INIZIO_LAVORO */ ,
    F_LAVORO T6686
    where ( T6686.ID_RITORNO_LAVORO = T6842.ID_RITORNO_LAVORO and T6686.ID_DT_INIZIO_LAVORO = T6906.ID_DATA )
    group by T6842.CD_RITORNO_LAVORO, T6906.ANNO),
    SAWITH1 AS (select sum(SAWITH0.c1) as c1,
    SAWITH0.c2 as c2,
    SAWITH0.c3 as c3,
    SAWITH0.c1 as c4
    from
    SAWITH0
    group by SAWITH0.c1, SAWITH0.c2, SAWITH0.c3)
    select distinct SAWITH1.c2 as c1,
    SAWITH1.c3 as c2,
    SAWITH1.c4 as c3,
    SAWITH1.c1 as c4
    from
    SAWITH1
    I suspect the part painted in bold shouldn't be there. Anyone can help me?

    hi,,,,,,
    When processing an internal table in a block starting with LOOP and concluded by ENDLOOP , SUM calculates the control totals of all fields of type I , F and P (see also ABAP/4 number types ) and places them in the LOOP output area (header line of the internal table or an explicitly specified work area).
    You can use the SUM statement both at the end and the beginning of a control group (see also AT FIRST/LAST ).
    Example
    Display the table T with sub-totals:
    DATA: BEGIN OF T OCCURS 100,
    CODE(4),
    SALES TYPE P,
    DISCOUNT TYPE P,
    END OF T.
    LOOP AT T.
    AT FIRST.
    SUM.
    WRITE: /4 'Grand Total:',
    20 T-SALES, 40 T-DISCOUNT.
    ULINE. SKIP.
    ENDAT.
    WRITE: / T-CODE,
    20 T-SALES, 40 T-DISCOUNT.
    AT END OF CODE.
    SUM.
    WRITE: / T-CODE, 10 'Total:',
    20 T-SALES, 40 T-DISCOUNT.
    SKIP.
    ENDAT.
    ENDLOOP.
    Notes
    When you use SUM in a LOOP with an explicitly specified output area, this output area must be compatible with the line type of the internal table.
    When using LOOP to process a sorted extract (see SORT ), the control total of f at the end of the group appears in the field SUM(f) - - if f is type I , F or P .
    Thanks
    Saurabh

  • Some problem using in this function!!!

    Is it valid to write a function like this??
    CREATE OR REPLACE FUNCTION
    dept_dtls(DEPT_ID IN VARCHAR2)
    RETURN record is
    DEPT EMPLOYEE.DEPT_ID%TYPE;
    STATUS RECORD;
    BEGIN
    Select COUNT(DESIGNATION),
    into STATUS
    from EMPLOYEE
    where DEPT=DEPT_ID
    GROUP BY DESIGNATION;
    RETURN STATUS;
    END dept_dtls;

    There are many things that I don't understand here or probably Oracle even can't understand.
    RETURN record
    What is record? WHen yu are taking count(something), it would be a number so, status variable should hold number and so should be of number datatype. By the way, if you had used GROUP BY function, then there is every possibility that this select results in one or more number of records which fails the function with TOO_MANY_RECORDS exception.
    Cheers
    Sarma.

  • Memory problem using visa serial functions in my vi

    The last few days i created an application that reads data from one of
    serial ports (contactless card reader). Today i noticed that my
    application had crashed and Windows had displayed a message that my
    system was low on virtual memory. I reset the system and i re-run the
    application, having the task manager opened. I noticed that the memory
    usage of my exe was taking more and more memory (starting from
    21.520KB) as the seconds went by. In 5 minutes my app was using
    25Mbytes! What i do in my application exactly, is opening the serial
    port  then i enter the main while-loop, then every 2 seconds i read
    from the  serial and write them to a tag.
    I have used standard visa serial functions of Labview. When I trace my
    application and simultaneously run TASKManager of windows to see the
    memory, I saw that after running every Visa function memory usage goes
    up!!!
    what must I do? Please help me to overcome this problem.
    Thanks,
    M.Naghipourfar

    Trust me, people use serial communication with LV all the time without losing memory. I can't check the example at the moment, but If it had a problem someone would have caught on to it by now. In any case, even if using the serial VIs causes the memory usage to go up, it shouldn't be dramatic, definitely not enough to crash the application and consume all memory.
    Like I said, post your code (there is an attachment field when you write your message and you can save all your files into a single file by opening the main VI and selecting File>>Save with Options>>Development Distribution) and we will probably be able to find your problem.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Having a problem using Workflow to update a field based on ZIP code

    I created a Workflow to update a Yes/No picklist called eligibility based on a Text (Short) field called Applicant ZIP code.
    It's set to update on the Opportunity page:
    Before modified record saved
    And the value function is:
    IIf(InStr("60601_60602",[&lt;stApplicant_Zip_Code_ITAG&gt;|http://forums.oracle.com/forums/]+)&gt;0,"Yes","No")+
    That was a guess of how to try it while relying on my limited MS SQL & Access knowledge.
    It does work correctly using what I did. The problem I have is that I actually need to choose from over 600 ZIP codes. The function window only allows for 256 characters. (And I suspect my way is fairly inelegant for search a multi-thousand character string.)
    Any suggestions?

    I created a Workflow to update a Yes/No picklist called eligibility based on a Text (Short) field called Applicant ZIP code.
    It's set to update on the Opportunity page:
    Before modified record saved
    And the value function is:
    IIf(InStr("60601_60602",[&lt;stApplicant_Zip_Code_ITAG&gt;|http://forums.oracle.com/forums/]+)&gt;0,"Yes","No")+
    That was a guess of how to try it while relying on my limited MS SQL & Access knowledge.
    It does work correctly using what I did. The problem I have is that I actually need to choose from over 600 ZIP codes. The function window only allows for 256 characters. (And I suspect my way is fairly inelegant for search a multi-thousand character string.)
    Any suggestions?

  • Problems using window.close() and setting fields

    Hi,
    I have two problems:
    First one is:
    I created a simple JSP with 'Save' and 'Exit' Buttons. In the Exit button on click event I invoked a function closeWindow, which calls teh window.close(). But on clicking Exit, the window does not close. Can anyone please tell me why.
    Second one is:
    The JSP also needs to get loaded with some values in the Textfields. Theses values are extracted from a text field using a Java class. I am able to see that these values are extracted from the text file and are loaded into Java vars, but when I am trying to set this value into a text field, it is NOT getting set.
    (filePathDetails is the instance of the class that extracts the text values)
    The entire code is posted below:
    <%@ page language="java" import="ftpScheduler.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <% FolderPathInfo filePathDetails = new FolderPathInfo(); %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>PATH DETAILS</title>
        <SCRIPT type="text/javascript">
         function setPaths(){
              with(document.pathDetails){
                   textAncPath1.value = <%=filePathDetails.localDirPath1 %>;
                   textAncPath2.value = <%=filePathDetails.localDirPath2 %>;
                   textArchivePath.value = <%=filePathDetails.archiveDirPath %>;
                   textLogPath.value = <%=filePathDetails.logFilePath %>;
         function closeWindow(){
              window.closeWindow();
        </SCRIPT>
    </head>
    <body bgcolor="#c0c0c0" onload="setPaths()">
         <FORM name="pathDetails" method="get" action="DetailsServlet.java">
         <FONT face="Arial" size="3"><STRONG>Directory Paths:</STRONG></FONT>
           <BR><BR>
           <TABLE border="0" cellspacing="" height="60" width="450"
                                                        style="FONT-SIZE: 10pt; FONT-FAMILY: Arial" align="center">
           <COLGROUP>
           <COL width="45%">
           <COL width="55%">
           </COLGROUP>
           <TR>
           <TD><LABEL>Ancillary Transmit Path1 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath1" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Ancillary Transmit Path2 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath2" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Archive Path :</LABEL></TD>
           <TD><INPUT type="text" name="textArchivePath" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Log File Path :</LABEL></TD>
           <TD><INPUT type="text" name="textLogPath" width="290" maxlength="350"/></TD>
           </TR>
           </TABLE>
           <P align="center">
              <INPUT type="submit" name="buttonSave" value="Save">
              <INPUT type="button" name="buttonExit" value=" Exit " onclick="closeWindow()">
              <BR>
           </P>
           </FORM>
    </body>
    </html>Please help me.
    Thanks in advance.

    Try the following..
    For problem 1:
    Use window.close() instead of window.closeWindow().
    For the second problem
    don't call the function setPaths() at onload. Rather
    call the function after the page is loaded. You can
    try like this.
    If it doesn't work then check whether the browser is
    giving any JavaScript error message.
    <SCRIPT type="text/javascript">
    setPaths() ;
         function setPaths(){
         alert(document.pathDetails.element[0].value);
    document.pathDetails.element[0].value =
    = <%=filePathDetails.localDirPath1 %>;
              alert(document.pathDetails.element[0].value);
              with(document.pathDetails){
    textAncPath1.value =
    e = <%=filePathDetails.localDirPath1 %>;
    textAncPath2.value =
    e = <%=filePathDetails.localDirPath2 %>;
    textArchivePath.value =
    e = <%=filePathDetails.archiveDirPath %>;
    textLogPath.value = <%=filePathDetails.logFilePath
    ath %>;
         function closeWindow(){
              window.closeWindow();
    </SCRIPT>Hi,
    Actually I did try window.close(), but I still am not able to close the current window.
    And as for the problem of setting up the field values, sorry the given solution doesnt seem to work. :-(..
    I have pasted the entire code, I dont know where teh flaw is. Please review the same and let me know.
    Your help is very much appreciated.
    <%@ page language="java" import="ftpScheduler.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <% FolderPathInfo filePathDetails = new FolderPathInfo();%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>PATH DETAILS</title>
         <SCRIPT type="text/javascript">
         function setPaths(){
              document.pathDetails.textAncPath1.value = "Anything";
              with(document.pathDetails){
                   textAncPath1.value = <%=filePathDetails.localDirPath1%>;
                   textAncPath2.value = <%=filePathDetails.localDirPath2%>;
                   textArchivePath.value = <%=filePathDetails.archiveDirPath%>;
                   textLogPath.value = <%=filePathDetails.logFilePath%>;
         function exitWindow(){
              window.close();
        </SCRIPT>
    </head>
    <body bgcolor="#c0c0c0">
         <FORM name="pathDetails" method="get" action="/FTPSchedulerApp/ftpScheduler/DetailsServlet.java">
         <FONT face="Arial" size="3"><STRONG>Directory Paths:</STRONG></FONT>
           <BR><BR>
           <TABLE name="tempTable" border="0" cellspacing="" height="60" width="450" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial" align="center">
           <COLGROUP>
           <COL width="45%">
           <COL width="55%">
           </COLGROUP>
           <TR>
           <TD><LABEL>Ancillary Transmit Path1 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath1" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Ancillary Transmit Path2 :</LABEL></TD>
           <TD><INPUT type="text" name="textAncPath2" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Archive Path :</LABEL></TD>
           <TD><INPUT type="text" name="textArchivePath" width="290" maxlength="350"/></TD>
           </TR>
           <TR>
           <TD><LABEL>Log File Path :</LABEL></TD>
           <TD><INPUT type="text" name="textLogPath" width="290" maxlength="350"/></TD>
           </TR>
           </TABLE>
           <div align="center">
              <INPUT type="submit" name="buttonSave" value="Save"/>
              <input type="reset" name="buttonReset" value="Reset" onclick="setPaths()"/>
              <button name="buttonExit" onclick="exitWindow()"> Exit </button>
              <BR>
           </div>
           </FORM>
    </body>
    </html>

  • Problem with SUM () analytic function

    Dear all,
    Please have a look at my problem.
    SELECT CURR, DT, AMT, RATE,
    SUM(AMT) OVER (PARTITION BY CURR ORDER BY DT) SUMOVER,
    sum( amt * rate) over (PARTITION BY CURR ORDER BY DT) / SUM(AMT) OVER (PARTITION BY CURR ORDER BY DT) avgrt
    FROM
    select 'CHF' CURR, ADD_MONTHS(TO_DATE('01-DEC-07'), LEVEL -1) DT, 100 * LEVEL AMT, 1 +  ( 5* LEVEL/100) RATE
    FROM DUAL CONNECT BY LEVEL < 10
    SQL> /
    CUR DT               AMT       RATE    SUMOVER      AVGRT
    CHF 01-DEC-07        100       1.05        100       1.05
    CHF 01-JAN-08        200        1.1        300 1.08333333
    CHF 01-FEB-08        300       1.15        600 1.11666667
    CHF 01-MAR-08        400        1.2       1000       1.15
    CHF 01-APR-08        500       1.25       1500 1.18333333
    CHF 01-MAY-08        600        1.3       2100 1.21666667
    CHF 01-JUN-08        700       1.35       2800       1.25
    CHF 01-JUL-08        800        1.4       3600 1.28333333
    CHF 01-AUG-08        900       1.45       4500 1.31666667
    Table Revaluation
    select 'CHF' CURR1, '31-DEC-07' DT , 1.08 RATE FROM DUAL UNION ALL
    select 'CHF' CURR1, '31-MAR-08' DT , 1.22 RATE FROM DUAL UNION ALL
    select 'CHF' CURR1, '30-JUN-08' DT , 1.38 RATE FROM DUAL
    CUR DT              RATE
    CHF 31-DEC-07       1.08
    CHF 31-MAR-08       1.22
    CHF 30-JUN-08       1.38.
    Problem is with the calculation of average rate.
    I want to consider the data in the revaluation table to be used in the calculation of
    average rate.
    So average rate for Jan-08 will be
    (100 * 1.08(dec revaluation rate) + 200 * 1.1 ) / (300) = 1.093333333
    for Feb-08
    (100 * 1.08(dec revaluation rate) + 200 * 1.1 + 300 * 1.15) / (600) = 1.121666667
    for mar-08
    (100 * 1.08(dec revaluation rate) + 200 * 1.1 + 300 * 1.15 + 400 * 1.2) / (1000) = 1.153
    for Apr-08
    (1000 * 1.22(Apr revaluation rate) + 500 * 1.25) /1500 = 1.23
    for May-08
    (1000 * 1.22(Apr revaluation rate) + 500 * 1.25 + 600 * 1.30 ) /2100 = 1.25
    and so on..
    Kindly advice

    Hi,
    The main thing in this problem is that for every dt you want to compute the cumulative total from previous rows using the formula
    SUM (amt * rate)
    But rate can be either the rate from the revaluation table or the rate from the main table. For evaluating prior dates, you wnat to use the most recent rate.
    I'm not sure if you can do this using analytic functions. Like Damorgan said, you should use a self-join.
    The query below gives you the results you requested:
    WITH
    revaluation     AS
         SELECT 'CHF' curr1, TO_DATE ('31-DEC-07', 'DD-MON-RR') dt, 1.08 rate     FROM dual     UNION ALL
         SELECT 'CHF' curr1, TO_DATE ('31-MAR-08', 'DD-MON-RR') dt, 1.22 rate     FROM dual     UNION ALL
         SELECT 'CHF' curr1, TO_DATE ('30-JUN-08', 'DD-MON-RR') dt, 1.38 rate     FROM dual
    original_data     AS
         select     'CHF'                              curr
         ,     ADD_MONTHS(TO_DATE('01-DEC-07'), LEVEL -1)     dt
         ,     100 * LEVEL                         amt
         ,     1 + ( 5* LEVEL/100)                    rate
         FROM     dual
         CONNECT BY     LEVEL < 10
    two_rates     AS
         SELECT     od.*
              SELECT     MAX (dt)
              FROM     revaluation
              WHERE     curr1     = od.curr
              AND     dt     <= od.dt
              )          AS r_dt
              SELECT     AVG (rate) KEEP (DENSE_RANK LAST ORDER BY dt)
              FROM     revaluation
              WHERE     curr1     = od.curr
              AND     dt     <= od.dt
              )          AS r_rate
         FROM     original_data     od
    SELECT     c.curr
    ,     c.dt
    ,     c.amt
    ,     c.rate
    ,     SUM (p.amt)          AS sumover
    ,     SUM     ( p.amt
              * CASE
                   WHEN     p.dt <= c.r_dt
                   THEN     c.r_rate
                   ELSE     p.rate
                END
         / SUM (p.amt)          AS avgrt
    FROM     two_rates     c
    JOIN     original_data     p     ON     c.curr     = p.curr
                        AND     c.dt     >= p.dt
    GROUP BY     c.curr,     c.dt,     c.amt,     c.rate
    ORDER BY     c.curr,     c.dt
    ;

  • Problems using very large XSD in Message Mapping - POSLog

    Hi,
    I am trying to build a message mapping based on an external definition (.xsd) downloaded from the ARTS webpage (Association for Retail Technology Standards). In PI (7.0) I am able to succesfully create an External Definition based on the downloaded XSD. The resulting external definition syntax checks ok and contains the message type POSLog.
    Next I try to create a message mapping using the external definition as the source message type. This is where it all starts to wrong. When I select the external definition as the source message type PI seems unable to complete the task, I get an hour glass. No matter how long I leave it in this state, it never comes back.
    I'm thinking because the xsd is so large PI is having problems trying to render the mapping. I am working over a VPN but cannot see any network traffic. Windows task manager shows that process javaws is taking up the majority of the processing. My laptop slows to a crawl until I kill the repository. Though my laptop only has 504Mb of RAM we have another with 1Gb which has the same problem.
    Any ideas? The exact same xsd can be downloaded from...
    http://www.nrf-arts.org/
    ARTS Standards -> ARTS XML
    All public shemas -> download
    download the POSLog schema (which is free) not the documentation.
    Any help appreciated.

    Thanks Patrick,
    That did the trick and I like the idea of changing a local copy of the jnlp file. Finally had to run the task on a laptop with 2Gb of RAM with heap-size = 1536m and sap.theme = Tradeshow (not sure if this helps).
    It is still very slow moving around the graphical mapping so I have placed an order for more RAM (upto 4Gb). I think Win32 can use upto 3.5 Gb so i'm hoping for a further improvement.
    It is a ludicrously large xsd.
    Thanks Again
    Surbjeet

  • How to use sum analytic function in adf

    Hi
    jdev 11.1.1.5
    oracle 11g r2
    I want to use analytic function (sum,count,avg and ...) .
    I see [url http://andrejusb.blogspot.co.uk/2013/02/oracle-analytic-functions-for-total-and.html]Oracle Analytic Functions for Total and Average Calculation in ADF BC
    and use it in my vo and jsf page,my vo have too much record and I want to have sum in table footer on demand (because of performance) and if user do not want to see the sum in footer of table it do not calculate sum,
    what is your idea?

    Before I read that blog I use another vo for sum but after that blog decide to use analytic fuction becuase we have some page that have to many dvt graph and table and know we use seperate vo for them and it has not good performance and too many query must run in database ,I want to have 1 vo with some analytic function for graph and tables

  • CSS 11501 ftp server setup problem using non-standard port

    Dear Expert,
    we would like to setup FTP server over CSS where our member sever use non-std-port to open both control/data channel (i.e. 6370 as ctrl and 6369 as data this case.) but seems we only get Passive mode FTP mode work only but not for Active mode FTP case for data channel establishement for server back to client...is there any professional advise can help on this case...? here is our setup info FYI
    #  sh ver
    Version:               sg0820501 (08.20.5.01)
    Flash (Locked):        08.10.1.06
    Flash (Operational):   08.20.5.01
    Type:                  PRIMARY
    Licensed Cmd Set(s):   Standard Feature Set
                           Secure Management
    CVDM Version:          cvdm-css-1.0_K9
    !*************** Global
    ftp data-channel-timeout 10
      ftp non-standard-ports
    !************************** SERVICE **************************
    service ftp_ftpgtw
      keepalive maxfailure 2
      keepalive frequency 15
      keepalive retryperiod 2
      keepalive type tcp
      ip address 192.168.52.170
      protocol tcp
      keepalive port 6370
      port 6370
      active
    # sh run group drfusegtwftp_grp 
    !*************************** GROUP ***************************
    group gtwftp_grp
      vip address 192.168.52.28
      add service ftp_ftpgtw
      active
      content ftp_gtwpkg-ftpgtw
        add service ftp_ftpgtw
        vip address 192.168.52.28
        port 21
        protocol tcp
        application ftp-control
        active

    Thanks for your confirmation on no prob found in config level 1st..:P..as to save us a lot of time in isolating problem at this level.
    What we can notice is seems the data port connection is fail to open  for server back to client....for our general sense..... the flow expected should be:
    TCP session A -- Client:1234 --> VIP:21 --> member svr:6370
    TCP session B -- Client: 5678 <--> VIP:20 <--> member Svr: 6379 [on demand generated between server/client]
    but we can only see session B fail  to setup when client side access VIP site on CSS..even we try to put the most standard case as below
    TCP session A -- Client:1234 --> VIP:21 --> member svr:21
    TCP session B -- Client: 5678 <--> VIP:20 <--> member Svr: 20
    we still unable to make the Active mode FTP access work either...hence we got no idea on how CSS handle FTP access when it involve services over multiple tcp ports..
    and from CSS xlate view...the problem is we can only see what NAT IP that used in CSS connect to client...but no way to confirm for which port for VIP using outgoing to client. neither it is dropped by CSS..nor it is never setup from VIP to Client side.

Maybe you are looking for

  • Can't scan with Epson Stylus DX4450

    Hi everybody. I'm trying to configure my Epson Stylus DX4450. Printing works like a charm, but scanner is not. I tried to configure it as it was suggested on various websites. I've installed sane, xsane, iscan (from http://repo.archlinux.fr/i686) als

  • Touch no longer works after replacing screen for Yoga 2 Pro

    Screen was cracked so I replaced the screen.  Now touch doesn't work. There is no "Pen and Touch" and "Tablet PC Settings" in Control Panel.  In PC info it says, "No pen or touch input is available for this display." Touch DOES work on LENOX as I ran

  • Firewire ports conflict with sound settings.

    Hi, Peculiar problem. My sound suddenly switched to being internal speaker only, even though I have decklink HD Extreme card and was using it as my audio output the night before. Narrowed the problem down to anything being plugged in to the firewire

  • I cant operate my new ipod nano(the screen is locked)

    I juz got a new ipod nano as a present. But there is one thing keeps bothering me up2 now. I cant use my new ipod, cuz whatever i did to push the menu or center panel, the screen doesnt work at all!! I reset and update my ipod accroding to what the w

  • Lost Essbase Filters in Essbase 11.1.2.1

    Hi, Recently i was having trouble with an application/database that had Essbase filters setup. I had to delete the app/db and in the process deleted the essbase filters. After re-creating the app/db i wanted to restore the essbase filters instead of