Need help about roll ups for average that contains logic

--Hi everyone,
--I have posted this one on the forum before.
(how to do outer join select query for an APEX report )--I thought it works fine, but then yesterday, the tester check and said that the Average total is not correct
--the query is as below
DEFINE startmonth = "Aug 2012";
DEFINE endmonth   = "Oct 2012";
WITH  all_months  AS
   SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
   ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
   from all_objects
   where
   rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
SELECT     ph.phase_number 
      ,TO_CHAR (am.which_month, 'Mon YYYY')  AS month
     , NVL(sum ( (CASE
                 WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                 THEN last_day(am.which_month)
                 ELSE ph.date_finished
              END
             ) - ph.date_started + 1
           ) / count(def.def_id), 0) as avg_days
  FROM all_months am
       LEFT OUTER JOIN  a_phase_membership  ph  PARTITION BY (ph.phase_number)
          ON  am.which_month <= ph.date_started
          AND am.next_month  >  ph.date_started
          AND ph.date_started <= last_day(am.which_month)  -- May not be needed
          AND ph.active = 1
       LEFT OUTER JOIN  a_engagement  ce 
          ON  ph.mpm_eng_id = ce.engagement_id
          AND ce.court_name IS NOT NULL  -- or something involving LIKE
       LEFT OUTER join  a_defendant     def
          ON  ce.defendant_id = def.def_id
          AND def.active = 1
GROUP BY ROLLUP(phase_number,  am.which_month)
ORDER BY  ph.phase_number, am.which_month
--result is
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Aug 2012          0                     
PHASE ONE                                          Sep 2012          12                    
PHASE ONE                                          Oct 2012          8                     
PHASE ONE                                                            11                    
PHASE THREE                                        Aug 2012          0                     
PHASE THREE                                        Sep 2012          1                     
PHASE THREE                                        Oct 2012          0                     
PHASE THREE                                                          1                     
PHASE TWO                                          Aug 2012          0                     
PHASE TWO                                          Sep 2012          9                     
PHASE TWO                                          Oct 2012          14                    
PHASE TWO                                                            11.5                  
                                                                     9.71428571428571428571428571428571428571
--And the tester is right, AVG days for phase one should be (12+8) /3 = 6.67 not 11, the same with phase two and three.
-- I tried to put a union select below the above which wrap it and do the average, but found that this select is too long and cumbersome.
--I have to ask for the Forum expert again, is there any way to make it look like
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Aug 2012          0                     
PHASE ONE                                          Sep 2012          12                    
PHASE ONE                                          Oct 2012          8                     
PHASE ONE                                                            6.67                  
PHASE THREE                                        Aug 2012          0                     
PHASE THREE                                        Sep 2012          1                     
PHASE THREE                                        Oct 2012          0                     
PHASE THREE                                                          0.33                     
PHASE TWO                                          Aug 2012          0                     
PHASE TWO                                          Sep 2012          9                     
PHASE TWO                                          Oct 2012          14                    
PHASE TWO                                                            7.66                  
                                                                     4.896... (average of Phase one, phase two, and phase three)                                                                      --Here is the sample data structure (Database version is 11g)
CREATE TABLE "A_DEFENDANT"
    "DEF_ID"     NUMBER NOT NULL ENABLE,
    "FIRST_NAME" VARCHAR2(50 BYTE),
    "SURNAME"    VARCHAR2(20 BYTE) NOT NULL ENABLE,
    "DOB" DATE NOT NULL ENABLE,
    "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
    CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"));
Sample Data
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
CREATE TABLE "A_ENGAGEMENT"
    "ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
    "COURT_NAME"    VARCHAR2(50 BYTE) NOT NULL ENABLE,
    "DATE_REFERRED" DATE,
    "DETERMINATION_HEARING_DATE" DATE,
    "DATE_JOINED_COURT" DATE,
    "DATE_TREATMENT_STARTED" DATE,
    "DATE_TERMINATED" DATE,
    "TERMINATION_TYPE" VARCHAR2(50 BYTE),
    "ACTIVE"           NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
    "DEFENDANT_ID"     NUMBER,
    CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"));
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
CREATE TABLE "A_PHASE_MEMBERSHIP"
    "MPM_ID"       NUMBER NOT NULL ENABLE,
    "MPM_ENG_ID"   NUMBER NOT NULL ENABLE,
    "PHASE_NUMBER" VARCHAR2(50 BYTE),
    "DATE_STARTED" DATE NOT NULL ENABLE,
    "DATE_FINISHED" DATE,
    "NOTES"  VARCHAR2(2000 BYTE),
    "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
    CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"));
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);--Probably after this crazy  project (reason: BA cannot make up her minds, and keep changing requirements about the reports, and then business want it done asap),
-- I need to buy a book and spend a lot of time to learn more about Oracle SQL Analytical function and Aggregation.
--Thanks a lot again, guys.
Ann

--Thanks  Jeneesh
--However, this time I found another bug relating filter the figures by court_name
DEFINE startmonth = "Aug 2012";
DEFINE endmonth   = "Oct 2012";
WITH  all_months_pre  AS
   SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
   ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
   from all_objects
   where
   rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
all_months as
  select phase_number,which_month,next_month
  from all_months_pre,(select distinct phase_number from a_phase_membership)
total_data as
SELECT am.phase_number,
       TO_CHAR (am.which_month, 'Mon YYYY')  AS month,
       nvl((CASE
                 WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                 THEN last_day(am.which_month)
                 ELSE ph.date_finished
              END
             ) - ph.date_started + 1,0) days,def_id
  FROM all_months am
       LEFT OUTER JOIN  a_phase_membership  ph  --PARTITION BY (ph.phase_number)
          ON  am.phase_number = ph.phase_number
            --I have found out that the Requirement don't need these, so I comment it out
          --and am.which_month <= ph.date_started
          --AND am.next_month  >  ph.date_started
          AND ph.date_started <= last_day(am.which_month)
          AND ph.active = 1
       LEFT JOIN  a_engagement  ce 
          ON  ph.mpm_eng_id = ce.engagement_id
          AND ce.court_name LIKE 'BB' 
       LEFT OUTER join  a_defendant     def
          ON  ce.defendant_id = def.def_id
          AND def.active = 1
avg_data as
    select phase_number,month,avg(days) avg_days
    from total_data
    group by phase_number,month
select phase_number,month,round(avg(avg_days),2) avg_days
from avg_data
group by rollup(phase_number,month)
order by 1
;--I run the  select for
AND court_name like 'BB'
--then run for
AND court_name LIKE 'AA'
or court_name LIKE '%'--They all return the same result which is
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Aug 2012          0                     
PHASE ONE                                          Oct 2012          12.67                 
PHASE ONE                                          Sep 2012          7.2                   
PHASE ONE                                                            6.62                  
PHASE THREE                                        Aug 2012          0                     
PHASE THREE                                        Oct 2012          5.67                  
PHASE THREE                                        Sep 2012          0.33                  
PHASE THREE                                                          2                     
PHASE TWO                                          Aug 2012          0                     
PHASE TWO                                          Oct 2012          5.75                  
PHASE TWO                                          Sep 2012          3                     
PHASE TWO                                                            2.92                  
                                                                     3.85                  
13 rows selected --If I adjust the statement to
WITH  all_months_pre  AS
   SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
   ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
   from all_objects
   where
   rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
all_months as
  select phase_number,which_month,next_month
  from all_months_pre,(select distinct phase_number from a_phase_membership)
total_data as
SELECT am.phase_number,
       TO_CHAR (am.which_month, 'Mon YYYY')  AS month,
       nvl((CASE
                 WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                 THEN last_day(am.which_month)
                 ELSE ph.date_finished
              END
             ) - ph.date_started + 1,0) days,def_id
  FROM all_months am
       LEFT OUTER JOIN  a_phase_membership  ph  --PARTITION BY (ph.phase_number)
          ON  am.phase_number = ph.phase_number
          AND ph.date_started <= last_day(am.which_month)
          AND ph.active = 1
       INNER JOIN  a_engagement  ce 
          ON  ph.mpm_eng_id = ce.engagement_id
          AND ce.court_name LIKE 'BB' 
       LEFT OUTER join  a_defendant     def
          ON  ce.defendant_id = def.def_id
          AND def.active = 1
avg_data as
    select phase_number,month,avg(days) avg_days
    from total_data
    group by phase_number,month
select phase_number,month,round(avg(avg_days),2) avg_days
from avg_data
group by rollup(phase_number,month)
order by 1;--The result will be
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Oct 2012          29                    
PHASE ONE                                          Sep 2012          19                    
PHASE ONE                                                            24                    
                                                                     24     --AND IF COURT_NAME = 'AA'
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Oct 2012          9                     
PHASE ONE                                          Sep 2012          8.5                   
PHASE ONE                                                            8.75                  
PHASE THREE                                        Oct 2012          17                    
PHASE THREE                                        Sep 2012          1                     
PHASE THREE                                                          9                     
PHASE TWO                                          Oct 2012          11.5                  
PHASE TWO                                          Sep 2012          9                     
PHASE TWO                                                            10.25                 
                                                                     9.33   --It seems to me the figures now is correct. But then when there is no figures for the Phase, it will not display the phase.
-- is there any way to adjust the select statement so the result for ce.court_name LIKE 'BB' looks like
PHASE_NUMBER                                       MONTH             AVG_DAYS              
PHASE ONE                                          Oct 2012          29                    
PHASE ONE                                          Sep 2012          19                    
PHASE ONE                                                            24                                       
PHASE TWO                                          Oct 2012          0                  
PHASE TWO                                          Sep 2012          0                     
PHASE TWO                                                            0     
PHASE THREE                                        Oct 2012          0                   
PHASE THREE                                        Sep 2012          0                     
PHASE THREE                                                          0              
                                                                     8      The reason why I need it, because this is just one column that will be included in a union combined in the report that will looks like
PHASE_NUMBER                                       MONTH             SUM(AVG_IN_PHASE_ALL)  SUM(NUM_IN_PHASE_CURR)
Phase 1                                            Aug 2012          0                      0                     
                                                   Sep 2012          14.25                  0                     
                                                   Oct 2012          11.14                  1                     
                                                                     8.46                   1                     
Phase 2                                            Aug 2012          0                      0                     
                                                   Sep 2012          18                     0                     
                                                   Oct 2012          20.33                  2                     
                                                                     12.78                  2                     
Phase 3                                            Aug 2012          0                      0                     
                                                   Sep 2012          10                     0                     
                                                   Oct 2012          12                     0                     
                                                                     7.33                   0                     
                                                                     9.53                   3                     
13 rows selected And to put thing in big picture, this is the requirement from the Business Analyst
The requirements are:
The user must be able to request the extract for one or more calendar months, e.g.
May 2013
May 2013 – Sep 2013.
The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
The file must also include a row of totals.
The user must be able to request the extract for either AA or BB or Consolidated (both courts’ statistics accumulated).
Then the part that I am working on is
For each monitoring phase:
Phase name (e.g. “Phase One”)
Avg_time_in_phase_all_particip
for each phase name,
Add up days in each “phase name” Monitoring Phase, calculated as:
If Monitoring Phase.Date Finished is NULL or > month end date,
(*Month end date* Minus Monitoring Phase.Date Started Plus 1)
Otherwise (phase is complete)
(Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)
Divide by the numbers of all participants who have engaged in “phase name”.Thanks again for reading and spending time to help,
Ann
Edited by: Ann586341 on Nov 13, 2012 4:31 PM

Similar Messages

  • Need Help about 3D and revolving in illustrator

    I really need help about 3D, Please tell me that How i create 3D in illustrator
    i want to revolve text or shape around any object like this, any plugin? or other software required for this?
    if somebody know this it will be really help full
       http://rcgrafix.fizwig.com/1452732-large.jpg    
       http://rcgrafix.fizwig.com/1384370-large.jpg
       http://rcgrafix.fizwig.com/1062180-large.jpg
    Thanks
    Arsi

    if links are not working try Copy and paste it in to your browser address bar
    thank you

  • Hi, i need help, okay..my issues is that since the lastest update for the ipod touch, my music lihow can i get the itunes main music playlist to appear the same on my ipod touch?

    Hi, i need help, okay..my issue is that since the lastest update for the ipod touch, my music list is all over the place....my question is how can i get the itunes main music playlist to appear the same on my ipod touch?

    Hi Lawrence,
    Thanks for your prompt response, however I have first seen it now. I have placed an active SIM card in the iPhone turned it off and on. It now says SIM locked, please write access code. The problem is I don't remember the password. When I connect it to iTunes it tell me that I have to write the password before it can be used with iTunes...... Do you have any good ideas? I see you are from the NYC area.... used to work there back in the early 90´   Those were good days..... What a City

  • I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

  • Need help about Hidden Markov Model model

    I want to make classification for EEG signal using Hidden Markov Model
    algorithm based on neural network.
    plz need help about how to implement this algorithm using LABVIEW.
    if not I want another thing to make classification.
    any one know information about this topic, send me a reply
    thanks

    Have you derrived the HMM that you want to implement?
    If so, post the algorithm and we can provide comments on how to implement it using LabVIEW.
    Message Edited by Ray.R on 04-12-2010 12:54 PM

  • Need help about 1015

    need help about 1015 it says connect iphone to itunes on screen i did it but it doesnt work and says unexpected 1015

    Try restoring it: Make sure you are following the instructions in this procedure to the letter.  Here they are, with emphasis on some easily overlooked requirements:
    Disconnect the USB cable from the iPhone, but leave the other end of the cable connected to your computer's USB port.
    Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.If you cannot turn off the device using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the device turns off, release only the Sleep/Wake button.
    Continue pressing and holding the Home button while you reconnect the USB cable to the device. The device should turn on.
    Note: If you see the "low battery" screen, let the device charge for at least ten minutes to ensure that the battery has some charge, and then start with step 2 again.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears (iTunes icon and USB connector) release the Home button.
    If necessary, open iTunes. You should see the "recovery mode" alert ("iTunes has detected a phone in recovery mode").
    Use iTunes to restore the device.
    If you do not see the "Connect to iTunes" screen, try these steps again.
    If you see the "Connect to iTunes" screen but the device does not appear in iTunes, see this article and its related links.
    If you have backed up the iPhone in the past, select the device in iTunes and choose "restore from backup".

  • Need help about ref cursor using like table

    Hi Guys...
    I am devloping package function And i need help about cursor
    One of my function return sys_refcursor. And the return cursor need to be
    join another table in database . I don't have to fetch all rows in cursor
    All i need to join ref cursor and another table in sql clause
    like below
    select a.aa , b.cc form ( ref_cursor ) A, table B
    where A.dd = B.dd
    I appeciate it in advance

    My understanding is that you have a function that returns a refcursor and is called by a java app.
    Because this is a commonly used bit of code, you also want to reuse this cursor in other bits of sql and so you want to include it like table in a bit of sql and join that refcursor to other tables.
    It's not as easy as you might hope but you can probably achieve this with pipelined functions.
    Is it a direction that code should be going down? yes, eventually. I like the idea of pulling commonly used bits of code into a SQL statement especially into the WITH section, provided it could be used efficiently by the CBO.
    Is it worth the effort given what you have to do currently to implement it? possibly not.
    what else could you do? construct the sql statement independently of the thing that used it and reuse that sql statement rather than the refcursor it returns?
    Message was edited by:
    dombrooks

  • Need help about boot SUNFIRE V120

    Hi all....
    I need help about how to change boot from boot net to boot disk....
    after i installed sun solaris 10 at my sunfire v120, then reboot the machine ... this sunfire still boot from net not from disk...
    can i change it?
    please i really need help ....
    thanks

    If its booted, try "eeprom boot-device=disk"
    If your at the OBP, "setenv boot-device disk".
    If that doesnt work check the value of "diag-switch?".
    It could be booting off the the diag-device instead

  • Need help about the SHA Message Digest ? & what is use of Message Diagest ?

    need help about the SHA Message Digest ? & what is use of Message Diagest ?
    1>i have one program of making message digest
    2>which requires two files name
    3>one for input like txt
    4> second is out put file of message digest
    can any one tell what is the use of second generated file .

    MessageDigest md = MessageDigest.getInstance("SHA");
    FileInputStream fis = new FileInputStream(args[0]);
    byte[] b = new byte[1024];
    int readed = -1;
    while((readed = fis.read(b)) > 0)
         md.update(b, 0, readed);
    fis.close();
    FileOutputStream fos = new FileOutputStream(args[1]);
    byte[] d = md.digest();
    StringBuffer sb = new StringBuffer();
    for(int i = 0; i < d.length; i++) {
         String str = Integer.toHexString(d[i] & 0xff);
         sb.append(str.length() < 2 ? "0" + str : str);
    fos.write(sb.toString().getBytes());
    fos.close();

  • Need help in developing BADI for IT0001

    Hi All,
    I need help in developing BADI for IT0001.
    On IT0001 create or change, there is need to update IT0017 with following data from IT0001
    -Company Code
    -Cost center
    -Business Area
    -Begin and End Date.
    Other fields from IT0017 need to be derived from Position and update in IT0017.
    Please guide me how I can address this. I do not want to go for dynamic action, as it is not getting evoked during background jobs.
    I am new to BADI development and will appreciate step by step instructions.
    Thanks

    Hi,
         follow the below steps to achive
    Steps:
    1.     Execute Business Add-In(BADI) transaction SE18
    2.     Enter BADI name i.e. HRPAD00INFTY and press the display
            button
    3.     Select menu option Implementation->Create
    4.     Give implementation a name such as Z_HRPAD00INFTY
    5.      You can now make any changes you require to the BADI within this
            implementation, for example choose the Interface tab there are 3 methods avialble
    6.     Double click on the method you want to change, you can now enter
            any code you require.
    7.      Please note to find out what import and export parameters a
            method has got return the original BADI definition
            (i.e. HRPAD00INFTY) and double click on the method name
            for example within HRPAD00INFTY contract is a method
    8.      When changes have been made activate the implementation
    <b>Reward points</b>
    Regards

  • I need help opening up the pdf doc that i just saved. i need to open it up with excel?

    I need help opening up the pdf doc that i just saved. i need to open it up with excel?

    Yes, I need help configuring the settings.
       Re: I need help opening up the pdf doc that i just saved. i need to
    open it up with excel?  created by David Kastendick<http://forums.adobe.com/people/dave_m_k>in
    Adobe ExportPDF - View the full discussion<http://forums.adobe.com/message/4711293#4711293

  • Hi, Need help about ios7 upgrade, after this upgrade I cannot watch youtube or any video with my Ipad,

    Hi, Need help about ios7 upgrade, after this upgrade I cannot watch youtube or any video with Ipad, and Iphone as well
    I think my wireless rooter's setting has some problem but cannot found anything to solve,
    I can watch if there is another wireless network , I tried this option in another place who has wireless network and I can watch.
    Do you have any idea to do these setting , I dont have any problem when Ipad has 6.1.3 IOS,
    need help
    thanks

    Thanks
    I will and share the result.

  • HT4061 i cant activate my iphone 5c because it has been locked with a different apple id. i dont know the original owner so i need help. its a second-hand phone that i bought some months back

    i cant activate my iphone 5c because it has been locked with a different apple id. i dont know the original owner so i need help. its a second-hand phone that i bought some months back

    Unfortunately, there is pretty much nothing you can do. Only the owner of the account used to lock it can remove the lock. If you can't contact whoever you purchased it from, or if they can't or won't remove the lock, then it's a brick. There is a very real chance that it's stolen.

  • How do I get my previous contacts from mobileme now to the icloud? I need help figuring out how to make that transition?

    How do I get my previous contacts from mobileme now to the icloud? I need help figuring out how to make that transition?

    Try using the app My Contacts Backup, which will back up your contacts as an attachment to an email.  Send this email to yourself, open it on your Mac and double-click the attachment to import them to Address Book (or Contacts if you have Mountain Lion).

  • Apple deleted my account when I made a complaint about being charged for apps that I did not purchase! The said it was for security reasons as my account must have been compromised but only Apple have mu information.I am convinced the operator delete

    Apple deleted my account when I made a complaint about being charged for apps that I did not order. They said that my account had been compromised and it was in my best interests to delete it for security reasons! I am convinced the operator deleted my account out of sheer malice because I complained - can anyone advise?

    No. It would have been done for security reasons. You notified them that money was being unknowingly taken from your account, so they froze it.
    Change your Apple ID here
    And also check for unusual activity on your credit card with your bank. Change all your security password while you are at it.
    Pete

Maybe you are looking for

  • Acrobat 4.0 Error

    A user here has Acrobat 4.0 installed. When he opens Outlook (2002), he gets an error message stating that the Acrobat PDF Maker add-in he's using is known to cause instabilities in Word 2002. It suggests getting an update. Is there an update that fi

  • Webcam continuous capture and save to avi

    Hello, I want to make an acquisition video to an .avi file from my webcam wirh labview and I used the program which is given below, but an error comes up and I could not find a solution (see the attached files). Attachments: Grab and Save to AVI.vi ‏

  • Lock front panel until the event case for this event completes

    A Dynamic Event is a filtered event? Is this why "Lock front panel until the event case for this event completes" is not shown on Edit Event window dialog? I use Dynamic Event so I can subvi the event structure. I need stop my app from locking the FP

  • Apple (command) + tab crashes Safari

    Recently, while tabbing through forms in Safari, pressing the key combination 'command' ⌘+ 'tab' to go backward in a form has caused Safari to crash. It actually just gets the spinning beach ball of death and become completely unresponsive. I have to

  • Administrator PLEASE !

    Hi anyone knowing what's up with the Forum looks loke this: hard to understand the Q:s So I tried the Lounge - With this sad notice. Anyone that can explain ? Yours Bengt W