How to calculate number of data records in a XML output file
Hi,
After generating a XML output file from Oracle Reports, I want to calculate number of records in the XML file. Is it possible? Specifically, I want to calculate number of records for a group variable ( organization_id, which I use for bursting).
Thanks for the help.
Thanks BIPuser. It is useful for me.
I can use this xsl function within the template. However, I'm also looking to print this in the concurrent request log file. So, outside of rtf template, id there any PL/SQL based XML functions I can use to count the number of records.
Thanks.
Similar Messages
-
How to restrict number of Data Records from Source system?
Hi,
How can I restrict the number of Data records from R3 source system that are being loaded into BI. For example I have 1000 source data records, but only wish to transfer the first 100. How can I achieve this? Is there some option in the DataSource definition or InfoPackage definition?
Pls help,
SDHi SD,
You can surely restrict the number of records, best and simplest way is, check which characteristics are present in selection screen of InfoPackage and check in R3, which characteristics if given a secection could fetch you the desired number of records. Use it as selection in InfoPackage.
Regards,
Pankaj -
How to calculate number of sundays and saturdays between two Dates
friends i want to calculate how many Sundays come in two Dates
i have tried following code which is hard coded i have to impliment method which can give me number of Sundays between two Dates
please help me
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar ;
import java.util.GregorianCalendar;
public class DateDiffCalculator {
private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MMM-dd");
public DateDiffCalculator() {
public static Date getDate (String date) throws Exception {
//log.debug(" "+date);
return SDF.parse(date);
public static Date getDate (Date date) throws Exception {
// log.debug("date is "+date);
return getDate(SDF.format(date));
public static long getDiffInDays(Date d1,Date d2) {
boolean isdiffGreaterThanYear=false;
long diffInMilliSeconds=d1.getTime()-d2.getTime();
return diffInMilliSeconds/(1000*60*60*24);
public static int getYear(String date) {
//String[] day= {Sun,Mon,Tue,Wed,Thu,Fri,Sat};
Integer year=new Integer(date.substring(0,4));
return year.intValue();
public static int getMonth(String date) {
//String date.substring(5,7);
System.out.println(" "+date.substring(5,8));
String m= date.substring(5,8);
int month=0;
if(m.equalsIgnoreCase("Jan")) {
month=1;
if(m.equalsIgnoreCase("Feb")) {
month=2;
if(m.equalsIgnoreCase("Mar")) {
month=3;
if(m.equalsIgnoreCase("Apr")) {
month=4;
if(m.equalsIgnoreCase("May")) {
month=5;
if(m.equalsIgnoreCase("Jun")) {
month=6;
if(m.equalsIgnoreCase("Jul")) {
month=7;
if(m.equalsIgnoreCase("Aug")) {
month=8;
if(m.equalsIgnoreCase("Sep")) {
month=9;
if(m.equalsIgnoreCase("Oct")) {
month=10;
if(m.equalsIgnoreCase("Nov")) {
month=11;
if(m.equalsIgnoreCase("Dec")) {
month=12;
return month;
public static int getDay(String date) {
Integer day=new Integer(date.substring(9,11));
return day.intValue();
public static int getNumberofSundays(String d1,String d2) throws Exception {
//d1 is leave start date d2 is leave end date
// get object in Date form
Date date1=getDate(d1);
Date date2=getDate(d2);
// now get calender objects from it
GregorianCalendar c1= new GregorianCalendar(getYear(d1),getMonth(d1),getDay(d1));
GregorianCalendar c2= new GregorianCalendar(getYear(d2),getMonth(d2),getDay(d2));
// get period
long leavePeriod = getDiffInDays(date1,date2);
return 12; // it should return number of sundays but we type 12 to perform compilation
public static void main(String[] arg)throws Exception {
System.out.println(" "+getNumberofSundays("2005-Oct-07","2006-Mar-01"));
}thanks now i have modified the get Month Code
as follows
public static int getMonth(String date) {
//String date.substring(5,7);
System.out.println(" "+date.substring(5,8));
String m= date.substring(5,8);
int month=0;
if(m.equalsIgnoreCase("Jan")) {
month=0;
if(m.equalsIgnoreCase("Feb")) {
month=1;
if(m.equalsIgnoreCase("Mar")) {
month=2;
if(m.equalsIgnoreCase("Apr")) {
month=3;
if(m.equalsIgnoreCase("May")) {
month=4;
if(m.equalsIgnoreCase("Jun")) {
month=5;
if(m.equalsIgnoreCase("Jul")) {
month=6;
if(m.equalsIgnoreCase("Aug")) {
month=7;
if(m.equalsIgnoreCase("Sep")) {
month=8;
if(m.equalsIgnoreCase("Oct")) {
month=9;
if(m.equalsIgnoreCase("Nov")) {
month=10;
if(m.equalsIgnoreCase("Dec")) {
month=11;
return month;
but question remains same how to calculate number of Sundays Between 2 Dates -
How to calculate number of rows for perticular characterstic in SAP BI Bex
Hi experts,
Please let me know how to calculate ' number of rows ' for perticular characterstic in Bex query.
Thanks & Regards,
Babu..Hello,
You can try this
Create a CKF and assign the vale 1 to it. Open the query and select Character where you want to display ' number of rows ', go to properties windows, select 'display', in the results row drop down box, select 'always display'.
Thanks.
With regards,
Anand Kumar -
How to calculate any two date with diffence calculation by using obiee11g?
Hi,
i have a requirement like,
location wise current month and previous month with movement calculation,can to tell me how to calculate any two date with diffence calculation
by using obiee11g
Note,
I tried to implemented ago function as well as dynamic two dates calculation using $2-$1 methods..but i am getting the o/p it's self i am getiing some null value also that' why it's not tallying with our actual report.
i tired to used ifnull(mesaurecolumn,0) also case condition on the mesaure colution still it's not tallying.
THanks and Rds,
Devarasu.RHi,
for Date Difference........
TimestampDiff(interval, timestamp1, timestamp2)
ex:TimestampDiff(SQL_TSI_DAY, cast('1-apr-2011' as date), current_date)
Where:
interval
The specified interval. Valid values are: SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR.
Cheers,
Aravind -
How to calculate number of threads running on Windows 2000 terminal?
How to calculate number of threads running on Windows 2000 terminal for the oracle process?
I have installed Oracle 9i DataBase with 6 patch(9.2.0.6.0) on Windows 2000 Terminal.
But,after database is started up, when i check up the sessions in v$session view.
It is showing like for SYSTEM osuser alone, 10 ORACLE.EXE sessions running on this server machine in active state.
Why it is creating 10 ORACLE.EXE sessions for a single Oracle Server.
This is the output of v$session view.
SQL> select terminal,osuser,status,sid,serial#,program from v$session;
TERMINAL OSUSER STATUS SID SERIAL# PROGRAM
IMGDBSVR SYSTEM ACTIVE 1 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 2 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 3 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 4 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 5 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 6 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 7 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 8 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 9 1 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 10 1 ORACLE.EXE
SUGANTHI_DBA suganthi ACTIVE 11 91 sqlplusw.exe
11 rows selected.
SQL>This is how i have related these two views:
SQL> select s.terminal,s.osuser,s.status,s.paddr s_paddr,b.paddr p_paddr,s.program
2 from v$session s,gv$bgprocess b
3 where s.paddr=b.paddr;
TERMINAL OSUSER STATUS S_PADDR P_PADDR PROGRAM
IMGDBSVR SYSTEM ACTIVE 33AF2270 33AF2270 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2654 33AF2654 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2A38 33AF2A38 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF2E1C 33AF2E1C ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF3200 33AF3200 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF35E4 33AF35E4 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF39C8 33AF39C8 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF3DAC 33AF3DAC ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF4958 33AF4958 ORACLE.EXE
IMGDBSVR SYSTEM ACTIVE 33AF4D3C 33AF4D3C ORACLE.EXE
10 rows selected.
SQL>
Here, It shows 10 sessions are running.
Whether this means 10 threads are running on the particular server or not? -
How do you configure AME CS5.5 to overwrite existing output files?
How do you configure AME CS5.5 to overwrite existing output files? So far the only options I have found are to increment the output file name or fail. From the explaination of file increment I would have expected overwrite to be the alternative. We work daily with the same file(s) on an hourly basis and convert via watch folder to over a dozen file types and network mapped destinations. Re-using the same file name is critical to the final project (updating website content). Does anyone have any suggestions?
Has there been any updates on overwriting output files in CS6? This would be extremely helpful.
-
How to calculate number of days from a date field
Dear BW Experts.
I have a field 'Create Date' in the BEx query. Now we need to create a variable which should give the number of days from the date of running the query (sy-datum) to the Create Date.
This will help the users to get records which are say, 30 days old (Sy-datum - create date = 30) or 10 days old etc.
Could you suggest as to how to create this variable.
Thanks,
SaiHi,
Step 1: Create variable on "Create Date" with User entry processing type
Step 2: Create a restricted KF for Sales & restrict it on "Create Date" to get "Sales on day"
Step 3: Manipulate the values of "Create Date" on which you could restrict "Sales" again and again to get other values
Step 4: Create one variable (ZPUTMNTH) for u201CMonth to Dateu201D with processing by u201CCustomer Exitu201D. This variable was created on u201CDateu201D characteristics.
Step 5 : Goto C-mod t-code and use EXIT_SAPLRRS0_001
to calculate "month to date" user input is "Calday" Key Date
WHEN 'ZPUTMNTH'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZPDATE'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6). "low value, e.g.YYYYMM (200606) part of key date (20060625)
L_S_RANGE-LOW+6(2) = '01'. u201C low value e..g. YYYYMM01 (20060601)
L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW. "high value = input
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
Assign if helps.....
Regards,
Suman -
How to calculate Number of Hours between 2 dates
Hi,
I have a Column in a table of datatype DATE i.e. Update_Date. Now How do I calculate number of hours passed starting from this date entered in the Update_Date column to SYSDATE. e.g. if the date in column is 2-FEB-2009 and the sysdate is 2/2/2009 2:07:40 AM it should give me 24. How can I get this number of hours.
Update_Date - Sysdate = Number of Hours.
ThanksWhen you subtract two dates in Oracle, you get a difference in terms of days. Just multiply that by 24 to get hours.
SELECT (sysdate - update_date) days,
(sysdate - update_date) * 24 hours
FROM your_tableThat said, it is not obvious how your example works. You state
if the date in column is 2-FEB-2009 and the sysdate is 2/2/2009 2:07:40 AM it should give me 24Since both dates are on February 2, 2009, the only difference is in the time component. If we assume that the time component of the UPDATE_DATE value is midnight since it is not specified, there is a little more than 2 hours of difference between the two dates. How is it that you determine there are 24 hours of difference?
Justin
Edited by: Justin Cave on Feb 2, 2009 10:39 AM -
How to calculate number of days in hijri
Dear all,
I need to develop a custom report in which i required to calculate number of days in hijri month and also the first and last day of the hijri month. we normally use Last_date(sysdate) function to get the last date of the english calender. but how can we find same for month.
Looking after for your support.
Regards,
SaquibConvert to hirjih date using:
select
to_char(sysdate,'YYYY/MM/DD','NLS_CALENDAR=''English Hijrah''') hijrih_date
from dual;
You can replace sysdate with the date of your choice.
Also I wrote this for my last project:
/* get hirjih date */
FUNCTION get_hijrah_date(
p_date in date,
p_date_format in varchar2
) return varchar2
is
v_hijrah_date varchar2(500);
begin
select
to_char(p_date,p_date_format,'NLS_CALENDAR=''English Hijrah''')
into v_hijrah_date
from dual;
return v_hijrah_date;
end get_hijrah_date;
So you can have get_hijrah_date(sysdate,'DD-MON-YYYY') from dual;
(or any other date formate of your choice)
Edited by: igwe on Jan 30, 2013 8:07 AM -
How to calculate number of days in ABAP?
Hi,
I have a condition as below:
If (field1 - field2) > 12 Months
E.g field1 = 31.05.2011 & field2 = 10.11.2011
Can SAP actually minus dates and check if the difference is greater than 12 months?
How do I perform this calculation?
Pls advice.
Thanks!
Moderator message : Date FAQ, duplicate post. Thread locked.
Edited by: Vinod Kumar on Mar 2, 2012 1:50 PMHi,
If your calculating dates please do not manually calculate it like that.
You need to determine like week numbers, month and days.
The best way to do it is by using FM related to dates. Play around with these FMs in your program:
Function Modules related to Date and Time Calculations
CALCULATE_DATE - Calculates the future date based on the input .
DATE_TO_DAY - Returns the Day for the entered date.
DATE_COMPUTE_DAY - Returns weekday for a date
DATE_GET_WEEK - Returns week for a date
RP_CALC_DATE_IN_INTERVAL - Add days / months to a date
DAY_ATTRIBUTES_GET - Returns attributes for a range of dates specified
MONTHS_BETWEEN_TWO_DATES - To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 - Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES -Find the difference between two dates in years, months and days.
FIMA_DAYS_AND_MONTHS_AND_YEARS - Find the difference between two dates in years, months and days.
WEEK_GET_FIRST_DAY - Get the first day of the week
SD_CALC_DURATION_FROM_DATETIME - Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE - Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES - Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS - Returns the last day of the month
DATE_CHECK_PLAUSIBILITY - Check for the invalid date.
DATE_2D_TO_4D_CONVERSION - Year entry: 2-character to 4-character.
DAY_IN_WEEK - Input date and will give the name of the day 1-monday,2-Tuesday....
SD_DATETIME_DIFFERENCE - Give the difference in Days and Time for 2 dates -
Doubt in how to calculate net due date
Hi..
Experts i have doubt in my salesmen ageing report i have to display
netamout day wise in the range of 0-30 days , 30-60 days and > 60 days
how to calculate the date difference between to date one is invoice creation date and another one is system date.
Give me any function module available to count the date difference
and how i filter the amount date wise.
Thanks Regds
Prabir Kumar DandpatHi,
check fm;
SD_DATETIME_DIFFERENCE
regards,
Navneeth K.
Message was edited by:
Navneeth Bothra -
How to calculate Number of weeks in Year ?? urgent
hi gurus,
i have to calculate the number of weeks in year. could you please suggest me is there any function module for that or do we need to create variable to get the number of weeks?
regardsGet some pointers frm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/help-on-function-day_get_week-1067350
Re: printing calender
Calculating the number of days of a year including leap year
Re: How to calculate No.of Weeks? -
How to Calculate Duration from Date Columns
Hello,
I would like to calculate duration from date columns. Using the following query
SELECT DISTINCT
EVENT_ID,
To_Char(RU.START_TIME, 'HH24:MI') START_TIME,
To_Char(RU.END_TIME, 'HH24:MI') END_TIME
FROM ROOM_USAGE RU
What I need is to subtract START_TIME from END_TIME and result should be in minutes.
Many Thanks,But, i think you need to calculate the number of days if the days are not same -
satyaki>
satyaki>
satyaki>
satyaki>with ru
2 as
3 (
4 select '05-JAN-2007 15:10:20' start_time, '07-JAN-2007 19:20:20' end_time from dual
5 union all
6 select '08-JAN-2007 05:10:20' start_time, '07-JAN-2007 07:07:20' end_time from dual
7 )
8 select ru.start_time, ru.end_time, SUBSTR(numtodsinterval(to_date(RU.END_TIME,'DD-MON-YYYY HH24:MI:SS')-to_date(RU.START_TIME,'DD-MON-YYYY HH24:MI:SS'), 'DAY'), 12, 8) duration
9 from ru;
START_TIME END_TIME DURATION
05-JAN-2007 15:10:20 07-JAN-2007 19:20:20 04:09:59
08-JAN-2007 05:10:20 07-JAN-2007 07:07:20 22:03:00
satyaki>
Or, Am i missing anything?
Regards.
Satyaki De.
is it possible to to add the duration? making the total hours to 26:12 (twentysix hours and twelve minutes) -
How to calculate number of employees according to gender
Now our customer want to calculate number of employees(0HDCNT_LAST) according to gender, expecially for female employee. we know that SAP has gender infoobject(0GENDER), and male with 1 and female with 2.
1) how should we use infoobject 0GENDER with female information connect R/3 table, and calculate number of employees at the end of one periode or time point? Should we use infoobject 0GENDER in cube?
2) How to write ABAP code? And what should we do in BW side ? should we do some enhancement?Hi,
you can use 0GENDER in your Cube. If you want to count you can do this in query.
For counting you build your own calculated key figure (formula).
Create a calculated keyfigure on global, formula ' =1' . Then drag this newly created global KF to the report column, restrict it with 0GENDER wich is restricted to male or female .
This would provide a count based on 0GENDER
Regards
Andreas
Maybe you are looking for
-
Retrieve data from a report or database to an input schedule in BPC for exc
Hi, I am using BPC for excel ( v 5.1). I've created an Input Schedule(Input-1) using BPC for excel and sent data to the dB. I need this (Input-1) data to use it in a new Input Schedule(Input-2), for further manipulation. I need this data to be dumped
-
Can't transfer tv shows to iphone in itunes 9
I've just upgraded itunes to version 9, and updated my iphone to version 3.1. Also have snow leopard 10.6.1. I have itunes set to manually sync content. Before it was just a matter of dragging the selected tv shows over to the iphone icon when it was
-
Hi , Am new to macbook pro, sorry if this is a basic question. Am trying to see the mysql in my macbook pro. The version is 10.6.8. I don't see the mysql folder in /usr/local folder. Not sure what am i missing. -Satya
-
is it able to change the back cover glass in iphone4?, is it able to change
-
.MVX format not supported on import
I get this when trying to import .MVX assets into Encore: "The software thats used to decode the media is not available on this systems. Installing the correct decoders for the files you are working with may help to correct the problem." What exactly