Function, Bapi, or something to calculate the WT

Hi Gurus,
I need to create a report with the amount of withholding that would generate if it run the program payments.
Anyone know any function, BAPI or something so you can calculate it?
Thanks

Hi Leonardo, tks for you answer.
But, the issue is that I need to know is on bills not paid. That is, what would be the retention on payment today. I think the report you gave me just take the amount already paid.
This is what I need specifically
thanks
Best Regards

Similar Messages

  • Please tell me what is the FM used to calculate the taxes in FI/CO?

    Hi,
    Iam working on a FI/CO report, could anyone help me out in telling which function module is used to calculate the taxes related to the material cost for Purchase Orders, as I need this tax to add up to the material cost & unplanned cost of the invoice line amt.
    Please try to help me out with the names of FM used in calculating the taxes.
    Thanks in Advance.
    Regards,
    Sanjay Mankar.

    Hello Sanjay,
    good to hear that your problem is solved:-)
    I know the pointing system was down the last days.
    Could you please mark the question as solved if possible now.
    Thanks for that and Regards.
    Frank

  • Field which calculates the Quarter

    Hi,
    Currently the reports use the date on each opportunity product to calculate the quarter, and the close dates on the opportunity products are not updated if you change the overall opportunity close date. I need to either be able to automatically update all the opportunity product close dates to match the opportunity close date OR (which i think will be easier) I was going to insert a field which will calculate the quarter based on the opportunity close date and add that as a column in the report.
    What I need to know, is what function do i use to calculate the quarter based on the opportunity close date and what is the syntax?
    Thank you.

    Go to that concerned document and on top Enviornment changes

  • Unable to calculate the price using the bapi  BAPI_SALESDOCU_CREATEFROMDATA

    hi guys,
    i am   able to create  a  sales order using the bapi BAPI_SALESDOCU_CREATEFROMDATA1' .
    the problem is that we are unable to calculate the price the amount column in the sales order is showing 00000 even though the condition has been taken from condition master.
    thanks.
    Edited by: nishant patel on Jul 21, 2008 9:59 AM
    Edited by: nishant patel on Jul 21, 2008 10:00 AM

    Hi,
    You need not pass the condition records for filling the pricing records in the sales order. The functional consultant will maintain all the necessary pricing procedure and the condition records and it will flow from there.
    May the pricing procedure is not correctly defined for that particular soldto party in the system, once that is maitained then everything will flow correctly.
    Thanks,
    Mahesh.

  • Function module which could calculate the previous month's start date.....

    hi,
    I want a function module which could calculate the previous month's start date and end date...
    Say todays date is  like 29.05.2007(start date) it should return
    01.04.2007 and 30.04.2007...
    IS there any FM for this ... or how to go about this scenario ???
    thanks in advance
    samm

    See the below Logic :
    DATA :g_date(2) TYPE n,           " Date
          g_month(2) TYPE n,          " Month
          g_year(4) TYPE n ,          " Year
          g_bill_low(10) TYPE n,       " From date
          g_bill_high(10) TYPE n,      " To date
          g_month1(2) TYPE n,         " Month
          g_year1(4) TYPE n,          " Year
          g_date1(2) TYPE n,          " Date
          g_year2(4) TYPE n,          " Year
          g_datum LIKE sy-datum.      " System date
    RANGES : r_bdate  FOR vbrk-fkdat.             " Billing date
      g_datum = p_date + 10.
      g_month = g_datum+4(2).
      g_year = g_datum+0(4).
      IF g_month = 1.
        g_year = g_year - 1.
        g_month = 12.
        g_date = 1.
      ELSE.
        g_month = g_month - 1.
        g_date = 1.
      ENDIF.
    Passing the date to billing date-low
      CONCATENATE  g_year g_month g_date  INTO g_bill_low.
      r_bdate-low = g_bill_low.
      r_bdate-sign = 'I'.
      r_bdate-option = 'BT'.
      g_month1 = g_datum+4(2).
      g_year1 = g_datum+0(4).
      IF g_month1 = 1.
        g_year1 = g_year1 - 1.
        g_month1 = 12.
      ELSE.
        g_month1 = g_month1 - 1.
      ENDIF.
      CASE g_month1.
        WHEN 1.g_date1 = '31'.
        WHEN 3.g_date1 = '31'.
        WHEN 4.g_date1 = '30'.
        WHEN 5.g_date1 =  '31'.
        WHEN 6.g_date1 = '30'.
        WHEN 7.g_date1 = '31'.
        WHEN 8.g_date1 = '31'.
        WHEN 9.g_date1 = '30'.
        WHEN 10.g_date1 = '31'.
        WHEN 11.g_date1 = '30'.
        WHEN 12.g_date1 = '31'.
      ENDCASE.
      g_year2 = g_year1.
      IF g_month1 = 2.
        g_year2 = g_year2 MOD 4 .
        IF g_year2 = 0.
          g_date1 = 29.
        ELSE.
          g_date1 = 28.
        ENDIF.
      ENDIF.
    Passing the date to billing date-high
      CONCATENATE  g_year1  g_month1  g_date1 INTO g_bill_high.
      r_bdate-high = g_bill_high.
      APPEND r_bdate.
    Reward Points if it is helpful
    Thanks
    Seshu

  • How to calculate the measure for the next month using the AGO Function

    Hi,
    I need to calculate the measure for the current month and the next month.
    Can anyone please let me know the syntax to use AGO function for the above requirement.
    Regards,
    Ambika Nanda.

    Hi.
    You can also use Oracle analytic functions LAG and LEAD inside the EVALUATE obiee function. The second one will give you the next measure.
    For example the report is:
    TIMES.CALENDAR_MONTH_DESC
    SALES.AMOUNT_SOLD
    LAG column: EVALUATE('LAG(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
    LEAD column: EVALUATE('LEAD(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
    And the result is:
    CALENDAR_MONTH_DESC--------AMOUNT_SOLD--------LAG--------------LEAD
    2000-01----------------------------------8025513.84---------------------------8474475.88
    2000-02----------------------------------8474475.88----- 8025513.84-----7439568.24
    2000-03----------------------------------7439568.24------8474475.88-----7062040.48
    2000-04----------------------------------7062040.48------7439568.24-----7497971.40
    Regards
    Goran
    http://108obiee.blogspot.com

  • Function, BAPI to get the children form a Network Activity in a Project (PS)

    Hi everyone,
    I have a Project in TCode CJ20N with PEPs, Networks and all the components that It has.
    I'm doing a program which input "Network Activity" and the result have to be all the children for this Network Activity (Material Components) including the information for each Material Component because What I'm looking for is to check if at list one of the children for a Network Aciviti have a Purchase Requisition linked to it as I show in the Attached File.
    To do this, I need to execute a function, BAPI, BADI or any code to get the children to look for a PR.
    Thanks a Lot.
    Regards
    Felipe Uribe

    Hi Arun...
    thanks a lot, I think it could work fine!!!.
    I'll try using this BAPI.
    Regards
    Felipe Uribe

  • Hi I'm new to Mac. I have a macbook air and for some reason the top keys, ec, f1 etc etc are not functioning and emitt the non function noise when pressed. Also the volume keys don't adjust the volume. Have I done something to disable them?

    Hi I'm new to Mac. I have a macbook air and for some reason the top keys, ec, f1 etc etc are not functioning and emitt the non function noise when pressed. Also the volume keys don't adjust the volume. Have I done something to disable them?

    I don't have the same version of OS X here but try System Preferences>Keyboard. Is there an option similar to "Use the F1, etc, keys as standard function keys"?
    If so, and it has a checkmark, uncheck it & see if that does the trick.
    ~Lyssa

  • How to lock transaction using function module or something like that

    Hi, all
    I'd like to know the way to lock transacitons using function module or something like that.
    I know this would be possible if calling transaciton SM01, but I want to know other ways like calling function module  (BAPI ) or method.
    Thank you for your cooperation In advance.
    Regards,
    Hideki Kozai

    Hi,
           Try the following FM
    BRF_NETWORK_GRAPHICS           BRF: Network Graphics for BRF Objects
    BRF_INITIALIZE_GRAPHICS_NGR    BRF: Initialize Network Graphics
    BRF_NETWORK_GRAPHICS_NGR       BRF: Network Graphics: Start
    BUSG                           SAP Business Graphics
    GRAPH_2D                       Calling up the 2D business graphics
    GRAPH_2D_MENUE                 DO NOT USE (use 'GRAPH_2D' and 'GRAPH_BUSG_MENU_SET')
    GRAPH_3D                       Calling up the 3D presentation graphics
    GRAPH_BUSG_COLOR_SET           Definition of color pallets for business graphics
    GRAPH_BUSG_MENU_SET            Pushbutton menu (tool bar) for all BUSG modules
    GRAPH_MATRIX                   Calling up SAP Business Graphics (2D, 3D and 4D)
    GRAPH_MATRIX_2D                Calling up the 2D graphics (user-friendly version)
    GRAPH_MATRIX_3D                Structure of 3D graphics (user-friendly version)
    GRAPH_MATRIX_4D                Calling up a 3D graphic (4th dimension stacked representation)
    Regards,

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • How to calculate the time duration on a datetime column?

    Hi guys,
    I've done some search on this forum and everywhere else but I can't seem to get this right, at the beggining it sounded like something very simple to accomplish, for the instance with Excel but I'm struggling to get it to work with Crystal Reports on Microsoft Visual Studio 2008.
    I have a datetime column (SQL Server 2000) that I wanted to calculate the the time duration on the report group footer, unfortunatelly the built-in SUM function cannot be applied and I've tried several formulas that I've found on the internet without any luck. I'm using a datetime column to store only the time because I'm stuck with SQL Server 2000 which doesn't have a time data type.
    Would you guys know how to do it by any chance?
    Some sample code I've tried: http://www.minisolve.com/TipsAddUpTime.htm
    Thanks a lot,
    Paul
    Edited by: Paul Doe on Dec 12, 2009 5:41 PM
    Some sample data:
    EMPLOYEE     WORK HOURS
    =========     =================
    JOHN DOE      1900-01-01 01:00:05
    JOHN DOE      1900-01-01 00:20:00
    JOHN DOE      1900-01-01 01:30:15
    =========     =================
    HOURS WORKED: 02:50:20
    Edited by: Paul Doe on Dec 12, 2009 5:42 PM
    Edited by: Paul Doe on Dec 12, 2009 5:45 PM

    Guess what, by further testing the code on the website mentioned above I got it working.
    Pus, I needed to change the grouping on the code, so I had to come up with a way to update the formulas based on the groupping field.
    Considering "call_date" is the field that you are groupping by on the designer use the following code to update the formula:
    CrystalReportObj = new ReportDocument();
    CrystalReportObj.Load("C:\\reportfile.rpt");
    FieldDefinition FieldDef;
    //Get formula
    FormulaFieldDefinition FormulaDef1;
    FormulaDef1 = CrystalReportObj.DataDefinition.FormulaFields["SubHours"];
    //Get formula
    FormulaFieldDefinition FormulaDef2;
    FormulaDef2 = CrystalReportObj.DataDefinition.FormulaFields["subMinSec"];
    //Update the formula to work with the new grouping field,
    //this must be called first else will throw an exception
    FormulaDef1.Text = FormulaDef1.Text.Replace("call_date", "call_extension");
    FormulaDef2.Text = FormulaDef2.Text.Replace("call_date", "call_extension");
    //Get the new field we are grouping by
    FieldDef = CrystalReportObj.Database.Tables[0].Fields["call_extension"];
    //Replace current grouping field with the new one,
    //considering there only one group in the report, index 0
    CrystalReportObj.DataDefinition.Groups[0].ConditionField = FieldDef;
    Have fun.
    Edited by: Paul Doe on Dec 12, 2009 8:43 PM
    Edited by: Paul Doe on Dec 12, 2009 8:53 PM

  • How do I have Adobe Acrobat 9.0 calculate the minimum of 10 fields BUT ignore empty fields?

    How do I have Adobe Acrobat 9.0 calculate the minimum of 10 fields BUT ignore the field if it is empty? Currently it counts blanks as 0 so when it comes up with the minimum it will always show 0 unless all 10 fields have values in them.

    You could loop through the fields and add the non-blank values to an array, and use the Math.min method to get the minimum. Here's an example custom Calculate script:
    // Custom calculate script
    (function () {
        // Array to hold non-blank field values
        var fa = [];
        // Loop through the fields...
        for (var i = 1; i < 11; i += 1) {
            // ...get the current field value, as string...
            var v = getField("text1." + i).valueAsString;
            // ...if not blank, add value to the array, as a number
            if (v) fa.push(+v);
        // Set this field's value to the minimum value in the array, otherwise blank
        event.value = fa.length > 0 ? Math.min.apply(null, fa) : "";
    This assumes the fields are named "text1.1", "text1.2", ..."text1.10" and that they're numeric. This type of field naming simplifies the code, so it would be good to use something similar and adjust the getField statement to match.

  • How to calculate the area of a large number of polygons in a single query

    Hi forum
    Is it possible to calculate the area of a large number of polygons in a single query using a combination of SDO_AGGR_UNION and SDO_AREA? So far, I have tried doing something similar to this:
    select sdo_geom.sdo_area((
    select sdo_aggr_union (   sdoaggrtype(mg.geoloc, 0.005))
    from mapv_gravsted_00182 mg 
    where mg.dblink = 521 or mg.dblink = 94 or mg.dblink = 38 <many many more....>),
    0.0005) calc_area from dualThe table MAPV_GRAVSTED_00182 contains 2 fields - geoloc (SDO_GEOMETRY) and dblink (Id field) needed for querying specific polygons.
    As far as I can see, I need to first somehow get a single SDO_GEOMETRY object and use this as input for the SDO_AREA function. But I'm not 100% sure, that I'm doing this the right way. This query is very inefficient, and sometimes fails with strange errors like "No more data to read from socket" when executed from SQL Developer. I even tried with the latest JDBC driver from Oracle without much difference.
    Would a better approach be to write some kind of stored procedure, that adds up all the single geometries by adding each call to SDO_AREA on each single geometry object - or what is the best approach?
    Any advice would be appreciated.
    Thanks in advance,
    Jacob

    Hi
    I am now trying to update all my spatial table with SRID's. To do this, I try to drop the spatial index first to recreate it after the update. But for a lot of tables I can't drop the spatial index. Whenever I try to DROP INDEX <spatial index name>, I get this error - anyone know what this means?
    Thanks,
    Jacob
    Error starting at line 2 in command:
    drop index BSSYS.STIER_00182_SX
    Error report:
    SQL Error: ORA-29856: error occurred in the execution of ODCIINDEXDROP routine
    ORA-13249: Error in Spatial index: cannot drop sequence BSSYS.MDRS_1424B$
    ORA-13249: Stmt-Execute Failure: DROP SEQUENCE BSSYS.MDRS_1424B$
    ORA-29400: data cartridge error
    ORA-02289: sequence does not exist
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 27
    29856. 00000 - "error occurred in the execution of ODCIINDEXDROP routine"
    *Cause:    Failed to successfully execute the ODCIIndexDrop routine.
    *Action:   Check to see if the routine has been coded correctly.
    Edit - just found the answer for this in MetaLink note 241003.1. Apparently there is some internal problem when dropping spatial indexes, some objects gets dropped that shouldn't be. Solution is to manually create the sequence it complains it can't drop, then it works... Weird error.

  • How can I calculate the slope of an isometric torque curve with a trigger and time increments of 0-30ms, 0-50ms, 0-100ms etc....

    I am analyzing isometric muscle contractions of the quadriceps and want to calculate the rate of force development (not just peak torque) for the torque-time curve.  I want to set a trigger so that the slope of the torque curve is calculated when 7 newton-meters is reached.  From there I'm trying to calculate the slope in time increments of 0-30ms, 0-50ms, 0-100ms, etc....My data is sampled at 2000 Hz and written in text files.  Below is a copy of the VI I have developed so far.  I am very new to programming with LabVIEW but can definitely see its potential!  Any advice would be greatly appreciated. 
    Attachments:
    Dissertation Isometric RFD.vi ‏14 KB

    Fiddler918,
    When trying to implement something like this in LabVIEW, it is often helpful to think about how you would program this function in a traditional text-based language.  Try and break the problem down.  You need to locate the data point in your array that is 7 Nm or greater.  At this point, you will need to grab the data points that are 60 indices (for the 30ms gap, assuming your points are equally spaced 0.5 ms apart), 100 indices (for the 50 ms gap), and 200 indices (for the 100ms gap) ahead of this point in your data file, and calculate the slope using pairs of data points.  
    Here is a general description of a possible implementation of this code:
    You can wire the appropriate column of the data array into a For Loop on the block diagram and have it auto index through the points.  If you right click on the Use the Greater or Equal? function to generate a Boolean that will be true when you want to exit the For Loop.  Right-click on the border of the For Loop and select Conditional Terminal.  This will cause a small stop sign to appear.  If you wire the Boolean to the conditional terminal, the loop will stop at the value that is greater than or equal to 7 Nm.  If you wire the Loop Iteration terminal out of the For Loop to the right, this will give you the index of the value in the column that you’re interested in.  Having this value, you can then use the Array functions to grab the specific data points you need, and numeric functions to perform the necessary math.
    If any of this didn't make sense, the LabVIEW help files are a great resource to use.
    Here is a link to some video tutorials of the LabVIEW programming environment.  They may help you in the development of your code.
    http://www.ni.com/academic/students/learnlabview/
    Regards,
    Jared R.
    Precision DC Product Support Engineer
    National Instruments

  • How can I calculate the interest percentage dynamically?

    Hi All,
    Please look at these tables (Customer and Rates), having some sample data. I've created a function for returning the interest percentage for a particular customer based upon his/her investment start date and end date. I'm getting the desired result but I'm wondering if I need calculate the composite interest here...then how can I do that? Suppose a customer has invested some amount for 45 days, then I need to calculate the interest for initial 30 days as 5% and additional 15 days as 6% and I need to give the final amount. In this case how can I pull this task off? Please give me some ideas and correct me if I'm wrong. I just want to know how can we do this interest calculation by an Oracle program?
    Regards
    BS2012
    Customer Table
    CUSTOMER_ID     AMOUNT     START_DATE     END_DATE
    1000             40000     15-JAN-13     15-FEB-13
    1001             34000     15-DEC-12     15-FEB-13
    1002             35678     15-NOV-12     15-FEB-13
    Rates Table
    RATE_PCT     LOW_TENURE     HIGH_TENURE
    5                    0     30
    6                    0     60
    7                    0     90
    CREATE OR REPLACE FUNCTION
    F_INTEREST_PCT (V_CUSTOMER_ID IN CUSTOMER.CUSTOMER_ID%TYPE)
      RETURN NUMBER AS V_RATE_PCT NUMBER;
      BEGIN
        SELECT A.RATE_PCT INTO V_RATE_PCT
        FROM RATES A, CUSTOMER B WHERE (B.END_DATE - B.START_DATE) BETWEEN A.LOW_TENURE AND A.HIGH_TENURE
                                   AND B.CUSTOMER_ID = V_CUSTOMER_ID;
        RETURN V_RATE_PCT;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
        ROLLBACK;
        DBMS_OUTPUT.PUT_LINE(SQLERRM);
        WHEN OTHERS THEN
        ROLLBACK;
        DBMS_OUTPUT.PUT_LINE(SQLERRM); 
      END F_INTEREST_PCT;

    BS2012 wrote:
    Hi All,
    Please look at these tables (Customer and Rates), having some sample data. I've created a function for returning the interest percentage for a particular customer based upon his/her investment start date and end date. I'm getting the desired result but I'm wondering if I need calculate the composite interest here...then how can I do that? Suppose a customer has invested some amount for 45 days, then I need to calculate the interest for initial 30 days as 5% and additional 15 days as 6% and I need to give the final amount. In this case how can I pull this task off? Please give me some ideas and correct me if I'm wrong. I just want to know how can we do this interest calculation by an Oracle program?
    Regards
    BS2012
    Customer Table
    CUSTOMER_ID     AMOUNT     START_DATE     END_DATE
    1000             40000     15-JAN-13     15-FEB-13
    1001             34000     15-DEC-12     15-FEB-13
    1002             35678     15-NOV-12     15-FEB-13
    Rates Table
    RATE_PCT     LOW_TENURE     HIGH_TENURE
    5                    0     30
    6                    0     60
    7                    0     90
    CREATE OR REPLACE FUNCTION
    F_INTEREST_PCT (V_CUSTOMER_ID IN CUSTOMER.CUSTOMER_ID%TYPE)
    RETURN NUMBER AS V_RATE_PCT NUMBER;
    BEGIN
    SELECT A.RATE_PCT INTO V_RATE_PCT
    FROM RATES A, CUSTOMER B WHERE (B.END_DATE - B.START_DATE) BETWEEN A.LOW_TENURE AND A.HIGH_TENURE
    AND B.CUSTOMER_ID = V_CUSTOMER_ID;
    RETURN V_RATE_PCT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    WHEN OTHERS THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE(SQLERRM); 
    END F_INTEREST_PCT;
    You will need to work out a formula or process to get the results you want, then write the code to do what you devise. When I have to do something hard it helps to write out what I want to do in psuedocode that I alter translate to real code. Let's say I want to do a factorial (1 * 2 * 3 * 4 ...) could be something like
    get limit value
    set factorial to 1
    foreach loop value from 1 to limit
      multiply factorial by loop index
      v_factorial_n := 1; --set factorial to 1
      for i in 1..p_limit_n loop --p_limit_n defined elsewhere
        v_factorial_n := v_factorial_n * i;
      end loop; --loop to compute factorial
    . . .

Maybe you are looking for

  • Can't update or download apps iOS 8.1.2

    I've been trying to update and download apps for a while now and it simply can't. I've tried to stop the download and start it again but it cannot download. The only thing that happens is that the app become unavailable and it either waits (the blue

  • Two Column Text Flow Problem

    Aside from Pages not importing Word (from a Mac) properly when there's columns involved I have another column problem. I'd like to find a way to make a document that has two equal side-by-side columns, lets call them Column A on the left and Column B

  • Finding caller program in a RFC call

    Hi experts, We are having lots of CALL_FUNCTION_NOT_FOUND short dumps in one of our systems. The errors are caused because other systems call a function that does not exist, so the dumps are created. What we would like to know is what program is doin

  • Lost emails in inbox

    i keep loosing my emails in the inbox and i dont know how to retrieve them

  • How to implement "Undo" option using acrobat SDK

    Hello,      I want to implement "Undo" option in my application which will restore last modified data.      I am reffering to acrobat 7.0 SDK. I am trying with AVUndo functions from SDK.      I am not getting basic thing to start the implementation.