Help with writing a function

Hello there
I got a table with data like this:
http://www.geocities.com/crisrobin100/ex_input.gif
This table give me the amount of hours (value) starting in a date I can query from another table according to the owner_id and the amount of consecutive days(Repeats_count) this amount of hours refer to.
I need to select this table and get something more friendlily so I can sum the hour for each month.
The result need to look something like this:
http://www.geocities.com/crisrobin100/ex_output.gif
How can I do it?
Chris

SQL> create table mytable
  2  as
  3  select 30020 owner_id
  4       , 'FORECAST' owner_type
  5       , 0 compressed_entry_seq
  6       , 4 repeats_count
  7       , 8 value
  8    from dual union all
  9  select 30020, 'FORECAST', 1, 2, 0 from dual union all
10  select 30020, 'FORECAST', 2, 5, 8 from dual union all
11  select 30020, 'FORECAST', 3, 2, 0 from dual union all
12  select 30020, 'FORECAST', 4, 5, 8 from dual union all
13  select 30020, 'FORECAST', 5, 2, 0 from dual union all
14  select 30020, 'FORECAST', 6, 5, 8 from dual union all
15  select 30020, 'FORECAST', 7, 3, 0 from dual union all
16  select 30020, 'FORECAST', 8, 3, 8 from dual
17  /
Tabel is aangemaakt.
SQL> var P_STARTDATE varchar2(8)
SQL> exec :P_STARTDATE := '01052007'
PL/SQL-procedure is geslaagd.
SQL> select owner_id
  2       , owner_type
  3       , d
  4       , value
  5    from mytable t
  6   model
  7         partition by (owner_id,owner_type,compressed_entry_seq)
  8         dimension by (0 i)
  9         measures ( to_date(:P_STARTDATE,'ddmmyyyy')
10                    + sum(repeats_count) over (partition by owner_id,owner_type order by compressed_entry_seq)
11                    - repeats_count d
12                  , repeats_count rc
13                  , value
14                  )
15         rules
16         ( d[for i from 1 to rc[0]-1 increment 1] = d[0] + cv(i)
17         , value[i<>0] = value[0]
18         )
19   order by owner_id
20       , owner_type
21       , d
22  /
  OWNER_ID OWNER_TY D                        VALUE
     30020 FORECAST 01-05-2007 00:00:00          8
     30020 FORECAST 02-05-2007 00:00:00          8
     30020 FORECAST 03-05-2007 00:00:00          8
     30020 FORECAST 04-05-2007 00:00:00          8
     30020 FORECAST 05-05-2007 00:00:00          0
     30020 FORECAST 06-05-2007 00:00:00          0
     30020 FORECAST 07-05-2007 00:00:00          8
     30020 FORECAST 08-05-2007 00:00:00          8
     30020 FORECAST 09-05-2007 00:00:00          8
     30020 FORECAST 10-05-2007 00:00:00          8
     30020 FORECAST 11-05-2007 00:00:00          8
     30020 FORECAST 12-05-2007 00:00:00          0
     30020 FORECAST 13-05-2007 00:00:00          0
     30020 FORECAST 14-05-2007 00:00:00          8
     30020 FORECAST 15-05-2007 00:00:00          8
     30020 FORECAST 16-05-2007 00:00:00          8
     30020 FORECAST 17-05-2007 00:00:00          8
     30020 FORECAST 18-05-2007 00:00:00          8
     30020 FORECAST 19-05-2007 00:00:00          0
     30020 FORECAST 20-05-2007 00:00:00          0
     30020 FORECAST 21-05-2007 00:00:00          8
     30020 FORECAST 22-05-2007 00:00:00          8
     30020 FORECAST 23-05-2007 00:00:00          8
     30020 FORECAST 24-05-2007 00:00:00          8
     30020 FORECAST 25-05-2007 00:00:00          8
     30020 FORECAST 26-05-2007 00:00:00          0
     30020 FORECAST 27-05-2007 00:00:00          0
     30020 FORECAST 28-05-2007 00:00:00          0
     30020 FORECAST 29-05-2007 00:00:00          8
     30020 FORECAST 30-05-2007 00:00:00          8
     30020 FORECAST 31-05-2007 00:00:00          8
31 rijen zijn geselecteerd.Regards,
Rob.
Message was edited by:
Rob van Wijk
Added owner_type to the partition clause of the sum analytic function. Output wasn't affected.

Similar Messages

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • Help with writing a formula

    Hi all,
    I am creating a report, and need help with writing a formula...
    I am creating a report that shows how many visits/touches our reps have made to various grade accounts. It is broken down by calendar week, and I currently have a weekly "goal" number set that the reps have to meet. That "goal" number increases each week to keep a running total. (example: week 1: 7, week 2: 14, week 3: 21)
    I have created some different formulas and one is this:
    SUM("Activity Metrics"."# of Activities" BY Date."Calendar Week")
    What this shows me is how many "visits" there are per calendar week to customers, however it show me the total for all reps per week.
    What I need is that total to show, but totaled for each rep individually.
    What I was trying is this:
    SUM("Activity Metrics"."# of Activities" BY Date."Calendar Week") BY Employee."Employee Name"
    But...I keep getting an error.
    Any suggestions?
    I have the reporting book by Lairson, and have been referring to it...but my brain at this point is fried.
    Thanks in advance for any help...(please forgive...I am new to OnDemand, and I am sure this is easy)

    Thanks for helping!
    I created this formula as a column: SUM ("Activity Metrics"."# of Activities" BY Date."Calendar Week"), it is called "total number of visits per week" and it shows the totaled number of visits that all the reps have done per calendar week. For example: Week 1: 10 visits, Week 2: 37 visits, Week 3: 20 visits.
    What I would like to do is take that column and break it down further, to show instead how many visits per week by sales rep there have been
    So what I was trying was to take the "total number of visits per week" (SUM ("Activity Metrics"."# of Activities" BY Date."Calendar Week")) and use "Activity Owner" (Employee."Employee Name") to break it down further.
    What I need to use is the total number of visits each rep has per calendar week.
    I think I am getting the error because you can't use "BY" twice in a formula?

  • Help with writing .bashrc file

    I would like help with writing a .bashrc file.
    The only thing I want right now is colored output and slashes for directories like what "ls -GF" does -- for each new terminal window.
    Can you guys give me a hand?
    Running Mac OS 10.4.6. Bash is default shell.
    Thanks.

    Hi Paul,
       You can get Apple's "ls" command to always output color with the following in your .bashrc:
    export CLICOLOR=""
    You can have an effect on the colors used with settings like the following:
    export LSCOLORS="gxfxcxdxbxegedabafacad"
       I have a color prompt in my bash startup scripts, bashrc.tgz. If you unpack the tarball in the root of your home directory, the files will be put in a ~/Library/init/bash directory. The file named "prompt" sets the color prompt string.
    Gary
    ~~~~
       I know you think you thought you knew what you
       thought I said, but I'm not sure you understood what
       you thought I meant.

  • Need some help with a remove function

    Design and code a program that will maintain a list of product names. Use a String type to represent the product name and an array of strings to implement the list. Your program must implement the following methods:
    Add a product to the list
    Remove a product from the list
    Display then entire list
    Find out if a particular product is on the list.
    You need to create a command command loop with a menu() function. The program must continue asking for input until the user stops.
    This is the assignment and this is what I have so far. I need some help writing the remove function.
    Thanks
    * Title: SimpleSearchableList.java
    * Description: this example will show a reasonably efficient and
    * simple algorithm for rearranging the value in an array
    * in ascending order.
    public class SimpleSearchableList {
         private static String[] List = new String[25]; //These variables (field variables)
         private static int Size; //are common to the entire class, but unavailable
         //except to the methods of the class...
         public static void main(String[] args)
              String Cmd;
              for(;;) {
                   Menu();
                   System.out.print("Command: ");
                   Cmd = SimpleIO.inputString();
                   if(Cmd.equals("Quit"))
                        break;
                   else if(Cmd.equals("Fill"))
                        FillList();
                   else if(Cmd.equals("Search"))
                        SearchList();
                   else if(Cmd.equals("Show"))
                        ShowList();
                   else if(Cmd.equals("Remove"))
                        Remove();
         //Tells you what you can do...
         public static void Menu()
              System.out.println("Choices..................................");
              System.out.println("\tFill to Enter Product");
              System.out.println("\tShow to Show Products");
              System.out.println("\tSearch to Search for Product");
              System.out.println("\tRemove a Product");
              System.out.println("\tQuit");
              System.out.println(".........................................");
         //This method will allow the user to fill an array with values...
         public static void FillList()
              int Count;
              System.out.println("Type Stop to Stop");
              for(Count = 0 ; Count < List.length ; Count++)
                   System.out.print("Enter Product: ");
                   List[Count] = SimpleIO.inputString();
                   if(List[Count].equals("Stop"))
                        break;
              Size = Count;
         //This method will rearrange the values in the array so that
         // go from smallest to largest (ascending) order...
         public static void SearchList()
              String KeyValue;
              boolean NotFoundFlag;
              int Z;
              System.out.println("Enter Product Names Below, Stop To Quit");
              while(true)
                   System.out.print("Enter: ");
                   KeyValue = SimpleIO.inputString();
                   if(KeyValue.equals("Stop")) //Note the use of a method for testing
                        break; // for equality...
                   NotFoundFlag = true; //We'll assume the negative
                   for(Z = 0 ; Z < Size ; Z++)
                        if(List[Z].equals(KeyValue)) {
                             NotFoundFlag = false; //If we fine the name, we'll reset the flag
              System.out.println(List[Z] + " was found");
                   if(NotFoundFlag)
                        System.out.println(KeyValue + " was not found");     
         //This method will display the contents of the array...
         public static void ShowList()
              int Z;
              for(Z = 0 ; Z < Size ; Z++)
                   System.out.println("Product " + (Z+1) + " = " + List[Z]);
         public static void Remove()
    }

    I need help removing a product from the arrayYes. So what's your problem?
    "Doctor, I need help."
    "What's wrong?"
    "I need help!"
    Great.
    By the way, you can't remove anything from an array. You'll have to copy the remaining stuff into a new one, or maybe maintain a list of "empty" slots. Or null the slots and handle that. The first way will be the easiest though.

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Please help with writing a class

    i need help getting started with this assignment. i haven't done anything with writing classes, so i don't know where to start.
    i need to create a bank account class that will keep a name, balance, up to 50 deposits, and up to 50 withdrawls. i need to include 2 arrays for the deposits and withdrawls.
    Here's what i know:
    I need a constructor that takes zero arguments. This constructor would initialize the numeric value to zero.
    I need a 2nd constructor that takes one argument, a name as a String value. This constructor would initialize the numeric value to zero.
    I need a 3rd constructor that takes two arguments, a name as a String value and a starting "balance" as a double value

    Sorry, I was watching a movie with my wife ...imagine that. Study my examples here and try to understand what I have done. You will follow the same methodology for the rest of the program. Use main to test the methods in your program.
    public class mdlAccount {
      String name;
      double balance;
      int currentDeposit = 0;
      int currentWithdrawl = 0;
      double[] deposits = new double[50];
      double[] withdrawals = new double[50];
      public mdlAccount() {
        name = "";
        balance = 0.0;
      public mdlAccount(String name) {
        this.name = name;
        balance = 0.0;
      public mdlAccount(String name, double balance) {
        this.name = name;
        this.balance = balance;
      // When the instructor says: Have a method that does deposits...
      // You need to create a method, similar to the constructors,
      // but with a return value, even if it returns void (nothing).
      // Like this:
      public void deposit( double amount ) {
        // Do some error checking.
        if ( currentDeposit < 50 && amount > 0 ) { // > is a greater than sign
          // If all is ok, add to the balance...
          balance += amount;
          // and add the entry to the array of deposits
          deposits[currentDeposit] = amount;
          // Finally, add 1 to the currentDeposit variable.
          currentDeposit++;
      // We need the 'return the balance' method so we can see if
      // the program runs correctly. This time we return a double,
      // instead of void. (void means don't return anything at all).
      public double getBalance() {
        return balance;
    // Now you create the next method for withdrawals...
    //  if ( currentWithdrawl < 50 ) {
    //    deposits[currentWithdrawl] = amount;
    //    currentWithdrawl++;
      // You want a main method so this class can be executed.
      // You can remove it later if you want to use this class
      // from within another larger program.
      public static void main(String[] args) {
        mdlAccount acct = new mdlAccount( "GumB", 100.0 );
        System.out.println("Initial balance is " + acct.getBalance());
        acct.deposit( 50.0 );
        System.out.println("Current balance is " + acct.getBalance());

  • Need some help with a counting function

    Hello,
    I use a simple sheet to organize the timetable of my patients. Now I'd like to count how many different patients I attend, without counting a patient twice if I attend him twice a week for example. My sheet looks like this:
    Mon
    Tue
    Wed
    Thu
    John
    Steve
    John
    Wesley
    Mary
    Harry
    Deborah
    Peter
    Arnold
    Carol
    Chris
    Mary
    Sarah
    Karen
    Karen
    Carol
    Larry
    Peter
    So the answer would be 13, because I attend 13 different patients a week. Fields in blank should no be counted, the cell contend changes frequently.
    A friend of mine tried to help me with a countif function but it didn't work out for me, it would count the fields left blank too.
    Any idea?
    Thanks, gabriel

    Hi Gabriel,
    Here's another, more generalized, approach that doesn't need adjusting for maximum number of visits/week at the cost of just a few more formulas.  But only two tables!
    Formula in A2 and copied down:
      =ROUNDUP((ROW(cell)−1)÷$B$27,0)
    Formula in B2 and copied down:
      =IF(MOD(ROW(cell)−1,$B$27)=0,$B$27,MOD(ROW(cell)−1,$B$27))
    The formula in C2 and copied down:
      =OFFSET(Schedule::$A$1,0,B−1)
    The formula in D2 and copied down:
      =IFERROR(OFFSET(Schedule::$A$1,A2,B2−1,rows,columns),"")
    The formula in E2 and copied down:
      =IF(AND(D2≠0,LEN(D2)>0),COUNTIF($D$1:D2,D2),"")
    The formula in F2 and copied down:
      =IFERROR(IF(E=1,1,""),"")
    The formula in F27:  =SUM(F)
    The value in B27 is 4, the number of day columns in the Schedule table. You would change that if you increase or decrease the number of days on which you see patients.
    Column C is cosmetic, not needed in the calculation.
    The error triangle means all of the cells in the Schedule table are already accounted for in the rows above.
    Probably more compact ways to do this but it gets the job done.
    SG

  • Help with writing a batch file

    Hi :
    does anyone know anyplace online that I can get help in writing batch files?? I have never worked much with batch files before....
    any help is greatly appreciated
    thnx

    I suppose, since you're in a Java forum, you need batch files to load java applications.
    If you use windows :
    go to ms console (start/run/"cmd")
    type edit mybatch.bat
    write your command to load a java application, something like
    java myclass.class
    save and exit.
    Be sure the bat file and the class are in the same folder.
    And make certain you've set the classpath, and path variables correctly.
    If this was what you needed and you need more help just ask.
    (In this case it could be better to make executable jars)
    If you wanted to know about linux batches, it works pretty the same way.

  • Need help with writing a rule

    Need help with some rules. I want to book a number to a specific Entity at a Specific Custom 4 only. I don't want this formula to work at all C4 levels. How can this be done?
    for example if Entity is "XBM1123" and we use C4 for tracking and the tracking level I want to book it to is IMPORT, how can this be done for a specific account 4400221
    I have my formula as
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
    If HS.Entity.Member = "XBM1123" or HS.Custom4.Member = "IMPORT" then
    HS.EXP "A#4400221= A#4521111 + A#3526644 + A#635210"
    End If
    End if
    this did not work. I got hte following error
    Calculate started.<BR>Error executing VBScript Microsoft VBScript runtime
    error, Line 259:Object doesn't support this property or method:
    'HS.Custom4.Member'.<BR>Calculate finished.<BR>Error executing
    VBScript %0.
    I then changed it to the below and it still did not work
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
    If HS.Entity.Member = "XBM1123" then
    HS.EXP "A#4400221.C4#IMPORT= A#4521111 + A#3526644 + A#635210"
    End If
    End if
    error
    Invalid Custom1 member
    specified for this function.
    Invalid Destination specified for this function:
    A#4400221.C4#IMPORT.

    You are close.
    Try:
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
        If HS.Entity.Member = "XBM1123" then
           HS.EXP "A#4400221.C4#IMPORT= A#4521111.C4#IMPORT + A#3526644.C4#IMPORT + A#635210.C4#IMPORT"
        End If
    End if
    or replace IMPORT with with Top_C4 or what ever member you need to copy to C4#IMPORT.
    Rule of thumb, to be on the safe side and for most simple calcs, is if you mention a dimension on the left side, you need to define it on the right side as well.

  • Help with writing, reading a file...

    I'm writing a program that writes a number to a file and then reads it again each time it is loaded. It's like a counter, the number starts out being 0, then when the program is run again the number will be two, and so on and so on. I've never been good with writing incrementer type things and files, so could you help me out? Remember, the program writes a single number to the file, and then adds one to that number each time the program is run, so it starts at zero and goes up by one each time it is run.
    -Thanks... I just came back from vacation and my Java skills are somewhat lacking :P

    open old file -> get the number -> create a new file -> write new number

  • Need help with user defined function

    Hello SDN,
    I need some help with a user-defined function. My source message contains multiple
    generic records (1000 char string), and my target message is 1 header record,
    then multiple generic records.  See description of source and target messages below:
    Source:
      GenericRecordTable 1..unbounded
        Row (1000 char string)
    Target:
      Field1 (char5)
      Field2 (char5)
      Field3 (char5)
      IT_Data
        GenericRecordTable 1..unbounded
          Row (1000 char string)
    Basically, what I need to do in my user defined funtion is to map the first record
    in my source record to the 3 header fields, then map all of the rest of the records
    (starting from line 2) into the GenericRecordTable.
    Can someone please help me with the code for the user defined function(s) for this
    mapping?
    Thank you.

    hi,
    Activities
    1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This
    graphic is explained in the accompanying text), which is located on the lower left-hand side of the
    screen. In the menu, choose Simple Function or Advanced Function.
    2. In the window that appears, specify the attributes of the new function:
    Name
    Technical name of the function. The name is displayed in the function chooser and on the data-flow
    object.
    Description
    Description of how the function is used.
    Cache
    Function type (see above)
    Argument Count
    In this table, you specify the number of input values the function can process, and name them. All
    functions are of type String.
    3. In the window that appears, you can create Java source code:
    a. You can import Java packages to your methods from the Imports input field, by specifying them
    separated by a comma or semi-colon:
    You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since
    all message mappings require these packages and therefore import them. You should be able to
    access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the
    package under Import. In other words, you do not have to import it as an archive into the Integration
    Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the
    SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
    In addition to the standard packages, you can also specify Java packages that you have imported as
    archives and that are located in the same, or in an underlying software component version as the
    message mapping.
    b. Create your Java source text in the editor window or copy source text from another editor.
    4. Confirm with Save and Close.
    5. User-defined functions are limited to the message mapping in which you created the function. To
    save the new function, save the message mapping.
    6. To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category,
    a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the
    function to the data-flow editor, choose the arrow next to the button and select from the list box
    displayed.
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
    http://java.sun.com/j2se/1.5.0/docs/api/
    /people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
    /people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    UDF -
    http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
    Regards

  • Help with SMTP class function with authentication

    My server is no longer supporting the php mail() functionality.  I need to use SMTP class function with authentication in my php code and they suggested this to replace it: http://www.yrhostsupport.com/index.php?/Knowledgebase/Article/View/101/2/smtp-class-functi on-with-authentication-in-php-code
    So I tried it, but can't get it to work. This is my test form:
    <form method="post" action="forms/sendmail-test2.php" onsubmit="return checkEmail(this);">
    <script type="text/javascript" language="JavaScript">
    </script>
    <fieldset><legend>Info</legend>
    <label> Name </label>
      <input type="text"
      name="name" size="30" maxlength="40"/><br />
    <label> <span class="redText">*</span> Email </label>
        <input name="email" type="text" size="30" maxlength="40"/>
        <br />
    <label><span class="redText">*</span> Message </label>
      <textarea cols="40" rows="5" name="message" type="text" /></textarea><br />
        </fieldset>
    <input type="reset" value="Reset" />
    <input type=submit value="Submit Form" />
    </fieldset>
    </form>
    This is sendmail-test2.php where the form goes. It won't send unless I comment out the first 10 lines.
    <?php
    include('Mail.php');
    //$to = "[email protected]";
    //$name = $_REQUEST['name'] ;
    //$email = $_REQUEST['email'] ;
    //$message = $_REQUEST['name'] ;
    //$headers = "From: $email";
    //$subject = " price quote";
    //$fields = array();
    //$fields{"name"} = "Name"; 
    //$fields{"email"} = "Email";
    //$fields{"message"} = "Message";
    $recipients = '[email protected]'; //CHANGE
    $headers['From']    = '[email protected]'; //CHANGE
    $headers['To']      = '[email protected]'; //CHANGE
    $headers['Subject'] = 'Test message';
    $body = 'Test message';
    // Define SMTP Parameters
    $params['host'] = 'levy.dnsbox25.com';
    $params['port'] = '25';
    $params['auth'] = 'PLAIN';
    $params['username'] = '[email protected]'; //CHANGE
    $params['password'] = 'xxxxxx'; //CHANGE
    /* The following option enables SMTP debugging and will print the SMTP
    conversation to the page, it will only help with authentication issues. */
    $params['debug'] = 'true';
    // Create the mail object using the Mail::factory method
    $mail_object =& Mail::factory('smtp', $params);
    // Print the parameters you are using to the page
    foreach ($params as $p){
          echo "$p<br />";
    // Send the message
    $mail_object->send($recipients, $headers, $body);
    ?>
    It used to work fine when I used
    $send = mail($to, $subject, $body, $headers);
    $send2 = mail($from, $subject2, $autoreply, $headers2);
    But they said I can't use it any more. I'm good with HTML and CSS but I don't know much about php. Thanks for any help integrating a from into this new code!

    Thanks, bregent. I changed it to this and it sends, but nothing shows up in the body except "Test message". How would I "insert the form fields' 'email' and 'name' and 'message' in the body"?
    <?php
    include('Mail.php');
    $to = "[email protected]";
    $name = $_REQUEST['name'] ;
    $email = $_REQUEST['email'] ;
    $message = $_REQUEST['name'] ;
    //$headers = "From: $email";
    $subject = " price quote";
    $fields = array();
    $fields{"name"} = "Name"; 
    $fields{"email"} = "Email";
    $fields{"message"} = "Message";
    $recipients = '[email protected]'; //CHANGE
    $headers['From']    = '[email protected]'; //CHANGE
    $headers['To']      = '[email protected]'; //CHANGE
    $headers['Subject'] = 'Test message';
    $body = 'Test message';
    $fields = array();
    $fields{"name"} = "Name"; 
    $fields{"email"} = "Email";
    $fields{"message"} = "Message";
    // Define SMTP Parameters
    $params['host'] = 'levy.dnsbox25.com';
    $params['port'] = '25';
    $params['auth'] = 'PLAIN';
    $params['username'] = '[email protected]'; //CHANGE
    $params['password'] = xxx'; //CHANGE
    /* The following option enables SMTP debugging and will print the SMTP
    conversation to the page, it will only help with authentication issues. */
    $params['debug'] = 'true';
    // Create the mail object using the Mail::factory method
    $mail_object =& Mail::factory('smtp', $params);
    // Print the parameters you are using to the page
    foreach ($params as $p){
          echo "$p<br />";
    // Send the message
    $mail_object->send($recipients, $headers, $body);
    ?>

  • Help with a PLSQL Function

    I am having problems with a SQL Function:
    CREATE OR REPLACE FUNCTION GDRREPORTS.MONTHTOTALS
    (BDate IN DATE)
    RETURN INTEGER
    AS
    ShakeCount INTEGER
    BEGIN
    ShakeCount=(Select count (distinct b.patid),
    to_char(gdrreports.To_Date_w_error (t.data), 'MON') BDay_month,
    to_char(gdrreports.To_Date_w_error (t.data), 'YYYY') BDay_year
    FROM CCI.a_patientlist p
    Inner Join CCI.PATIENTEDUCATIONNOTE_SCN_216IL b on
    b.patid=p.patid and b.tag=1789
    Inner join CCI.BIRTHDATE_519 t on
    t.patid=p.patid
    where p.unit != 'TRAIN' and p.admtime>='01JAN2011'
    and b.Data ='X'
    and to_char(gdrreports.To_Date_w_error (t.data), 'YYYY')=to_char(Bdate, 'YYYY')
    and to_char(gdrreports.To_Date_w_error (t.data), 'MON')=to_char(Bdate, 'MON'))
    RETURN ShakeCount ;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN NULL;
    END MONTHTOTALS;
    Not exactly sure what's wrong with it.
    Thank you.

    871359 wrote:
    I am having problems with a SQL Function:
    CREATE OR REPLACE FUNCTION GDRREPORTS.MONTHTOTALS
    (BDate IN DATE)
    RETURN INTEGER
    AS
    ShakeCount INTEGER
    BEGIN
    ShakeCount=(Select count (distinct b.patid),
    to_char(gdrreports.To_Date_w_error (t.data), 'MON') BDay_month,
    to_char(gdrreports.To_Date_w_error (t.data), 'YYYY') BDay_year
    FROM CCI.a_patientlist p
    Inner Join CCI.PATIENTEDUCATIONNOTE_SCN_216IL b on
    b.patid=p.patid and b.tag=1789
    Inner join CCI.BIRTHDATE_519 t on
    t.patid=p.patid
    where p.unit != 'TRAIN' and p.admtime>='01JAN2011'
    and b.Data ='X'
    and to_char(gdrreports.To_Date_w_error (t.data), 'YYYY')=to_char(Bdate, 'YYYY')
    and to_char(gdrreports.To_Date_w_error (t.data), 'MON')=to_char(Bdate, 'MON'))
    RETURN ShakeCount ;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN NULL;
    END MONTHTOTALS;
    Not exactly sure what's wrong with it.Without additional clues, we can't guess.
    It would help if you used COPY & PASTE so we can see this reported problem too.

  • Help with a ROUND function

    Hi everyone, can someone please help me with a function to use here please. I have a nine digit number e,g (000046650 and 024063870). I would like to convert this to 4 digits before the comma and 5 digits after the comma. So it must be something like this (0000,46650 and 0240,63870). I thought I could easily do this with a ROUND function, but it doesn't work. Could somebody please help by telling me what I'm missing?
    Thank you all for your help.

    Hi,
    I must be missing something, but why don't you just divide by 10000 ?Scott@my11g SQL>with d as (
      2  select 000046650 n from dual
      3  union all
      4  select 024063870 from dual
      5  )
      6  select n/10000 from d ;
       N/10000
         4.665
      2406.387You can then use a to_char with fmt to format it with zero padding :Scott@my11g SQL>with d as (
      2  select 000046650 n from dual
      3  union all
      4  select 024063870 from dual
      5  )
      6  select to_char(n/10000,'0000.00000') nn from d ;
    NN
    0004.66500
    2406.38700

Maybe you are looking for