How to split dates on month wise...
i need output like this.
if i select fromdate as 15-SEP-10 and Todate as 25-NOV-10 in where condition then
output should be like this.
FROMDATE TODATE
*15-SEP-10* 30-SEP-10
01-OCT-10 31-OCT-10
01-NOV-10 *25-NOV-10*
How do i do it.
Hi,
Similar to Dombrooks' solution:
DEFINE start_date = "DATE '2010-09-15'"
DEFINE end_date = "DATE '2010-11-25'"
SELECT GREATEST (&start_date, ADD_MONTHS ( TRUNC (&start_date, 'MONTH')
, LEVEL - 1
) AS fromdate
, LEAST (&end_date, ADD_MONTHS ( TRUNC (&start_date, 'MONTH')
, LEVEL
) - 1
) AS todate
FROM dual
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN ( TRUNC (&end_date, 'MONTH')
, TRUNC (&start_date, 'MONTH')
;Simpler, but, depending on your requirements, less efficient:
SELECT MIN (&start_date + LEVEL - 1) AS fromdate
, MAX (&start_date + LEVEL - 1) AS todate
FROM dual
CONNECT BY LEVEL <= 1 + &end_date
- &start_date
GROUP BY TRUNC ( &start_date + LEVEL - 1
, 'MONTH'
ORDER BY fromdate
;
Similar Messages
-
How to split data from month to week 4/4/5?
Hello,
Is there any R/3 function based on 4/4/5 calendar that determines the number of weeks of the month?
At the end, I'd like to split monthly data into weekly basis.
ThanksHi Eric,
I don't have a system handy to check but there are two function for FIRST_DAY_OF_PERIOD and LAST_DAY_OF_PERIOD. Get those days and simply do ( DAYLAST - DAYFIRST ) / 7.
Regards,
Marc
SAP NetWeaver RIG -
Hi all,
I have my data in the table as date wise. I need to sum this data in month wise.
Can anyone tell me how to do it. Is their any fm to do it or any sample pgm of this kind.
For ex my output should be like this :
field1 field2 Month1 Month2 Month3 Month4 ..
Waiting for reply,
Regards,
Priyahi priya,
First of all sort the whole set of values as per date wise into an internal table.
Sort the table as per the date .
CONCATENATE PR_MONTH '01' INTO W_FIRST_DATE.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = W_FIRST_DATE
IMPORTING
LAST_DAY_OF_MONTH = W_LAST_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_DATE = W_FIRST_DATE.
With this try to determine the first and last days of the month
From where u want to start .
Capture the month field from date field into pr_month.
Set the first date of the month to 01 like 02/01/2006
Suppose u had 02/02/2006 as the first occurance of the date then
U r trying to determine the first date and last date of ur feb month for the year 2006 .
Now 02/01/2006 and 02/28/2006 are determined by this process .
Set date_low = 02/01/2006 .
Date_high = 02/28/2006.
Now into ur select statement capture the fields between 02/01/2006 and 02/28/2006 just like range .
U can use select between or range
,so this covers all the fields for feb ,
Use collect on ur final output table which will give u the final sum values.
Now next field is say 03/10/2006 , then use the same process to capture the values .
Itab say is containg date fields
Logic is
Loop at itab.
Month = itab-date+(x)
At new month.
Perform operation .
Endat.
Endloop. -
Stock report with value and qauntity for given date not month wise
Hi gems,
can any body give me the standard report for Stock value and qauntity for given date not month wise at storage location levelHi
check the report S_P00_07000139 with the option inventory and raw material report- detail and selection date (from, to date same). List will give opening & closing balances with goods movment and their values.
Thanks -
How to Convert Date to Month in Database which is pointing to EBS, Not DWH.
Hi Friends,
We are planning to create reports in OBIEE and the Source is EBS. That means, we don’t want to depends on Datawarehouse and Informatica and OBIApps. We just create some reports and they are pointing to EBS database.
For testing purpose, we have taken one HR Report and it containsthe below columns:
Month (Dim)
Revenue Per Employee Headcount (Fact)
Average Cost per Active Workforce Headcount (Fact)
In my little investigation, we found that Revenue column is coming from EBS: GL_BALANCES. And we configured W_Day_D base table in DAC as there is no Month column in EBS (Not sure).
*** Coming to my problem, how can I call Month column in my database pointed to EBS. How to convert Date to Month in my database.
I could be wrong but anyone please look into this issue.. How can I create columns for that exact OBI report in EBS database instead of DwH.
Thanks in Advance..
Raghu NagadasariHi Veeresh,
You are right. Here, no need of using W_DAY_D table, but, we need all the stuff from the table and to explain my problem i have taken that table as an example. Now, we ran scripts for W_MONTH_D and W_DAY_D tables with EBS columns. So, we are getting data for the tables. In the same manner we have to create scripts for the below tables.
W_GL_ACCOUNT_D
W_GL_OTHER_F
W_STATUS_D
W_MCAL_DAY_D
W_EMPLOYMENT_STAT_CAT_D
W_WRKFC_BAL_A
W_DAY_D (Completed)
W_MONTH_D (Completed)
But, we are not aware of EBS Tables and their columns much. So, we are back tracing from RpD --> DAC --> Info --> EBS for each and every column and its taking much time.
So, if anyone of you facing the same issue, please share the EBS tables for the corresponding OBI tables, which are mentioned above. -
How to add date with month after convert number to month?
How to add date with month after convert number to month?
Month Date Result
24 21/11/09 24*(21/11/09)
I want to add both the column and result should be 21/11/11
Thanks
NiharHmm,
Because, you are using YYYY for '09'.
SQL> ed
Wrote file afiedt.buf
1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(TO
10/01/2009
SQL> ed
Wrote file afiedt.buf
1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(TO
10/01/0009Or with Add_months
SQL> ed
Wrote file afiedt.buf
1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(AD
10/01/0012
SQL> ed
Wrote file afiedt.buf
1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(AD
10/01/2012-Arun -
How to SPLIT data from Uploaded :AZT file at ";"
Dear All Experts,
I need to upload an :AZT file and then SPLIT the data of .AZT fiel at ";" into various fields into an internal table "itab" and then I need to save/update these data of internal table "itab" to database table "ZLT_AZT" . But I am facing some problems in the output. So please follow the following to understand my problem and please suggest me as how to SPLIT the data correctly at each ";".
1) The code that I wrote in se38.
2) The attachement; Projekt ABAP AZT file upload doubt5.jpg; the screen shot of the output that i am getting in internal table "itab" during debugging after my code is executed in se38
PROBLEM: I am unable to SPLIT the data at ";".
3) The attachement; Projekt ABAP AZT fiel upload doubt4.jpg: the screen shot of the data populated in database table "ZLT_AZT" in se11.
PROBLEM: i) I am not able to see all the columns. I am only able to see the 8 if 9 columns. I did go to Sellting--> Format List-->Choose Fields and selected all the fields but it didn't worked. Also I went to Settings-->User Parameters-->Databrowser and here I tried to change the width of output list but still it didn't work.
1) So the code in se38 is:
DATA itab TYPE STANDARD TABLE OF zlt_azt.
DATA wa_tab TYPE zlt_azt.
DATA: file_str1 type string.
Parameters: p_file1 type localfile.
At selection-screen on value-request for p_file1.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
file_name = p_file1.
Start-of-Selection.
file_str1 = P_file1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_str1
tables
data_tab = itab
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT itab INTO wa_tab.
SPLIT wa_tab AT ';' INTO wa_tab-M2 wa_tab-k2 wa_tab-A2 wa_tab-P2 wa_tab-S2 wa_tab- D1 wa_tab-STD wa_tab-BES.
Write: sy-uline(120),
/ sy-vline,
2 wa_tab-M2,
11 sy-vline,
13 wa_tab-k2,
25 sy-vline,
27 wa_tab-A2,
32 sy-vline,
34 wa_tab-P2,
39 sy-vline,
41 wa_tab-S2,
46 sy-vline,
48 wa_tab-D1,
60 sy-vline,
62 wa_tab-STD,
72 sy-vline,
74 wa_tab-BES,
120 sy-vline.
ENDLOOP.
MODIFY zlt_azt FROM TABLE itab.
Looking forward to your valuable feedback to my new problems.
Best regards
Chandan KumarHi Chandan,
I am sorry for typing wrong at a place - Now try the corrected one
data it_string type stringtab.
data lv_string type string.
DATA itab TYPE STANDARD TABLE OF zlt_azt.
DATA wa_tab TYPE zlt_azt.
DATA: file_str1 type string.
Parameters: p_file1 type localfile.
At selection-screen on value-request for p_file1.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
file_name = p_file1.
Start-of-Selection.
file_str1 = P_file1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_str1
tables
data_tab = it_string
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_string INTO lv_string. " <<<<< previously I wrote loop at itab>>>
clear wa_tab.
SPLIT lv_string AT ';' INTO wa_tab-M2 wa_tab-k2 wa_tab-A2 wa_tab-P2 wa_tab-S2 wa_tab- D1 wa_tab-STD wa_tab-BES.
append wa_tab to itab.
Write: sy-uline(120),
/ sy-vline,
2 wa_tab-M2,
11 sy-vline,
13 wa_tab-k2,
25 sy-vline,
27 wa_tab-A2,
32 sy-vline,
34 wa_tab-P2,
39 sy-vline,
41 wa_tab-S2,
46 sy-vline,
48 wa_tab-D1,
60 sy-vline,
62 wa_tab-STD,
72 sy-vline,
74 wa_tab-BES,
120 sy-vline.
ENDLOOP.
MODIFY zlt_azt FROM TABLE itab.
Regards,
Rachna -
Select-options split date into month and assign to low and high
Hi,
In my select-options i am giving BEDAT (01.04.2004 TO 30.10.2005).I need to split month and
year in separate fields.that is
select-option_low-month in one field
select-option_high-month in second field
select-option_low-year in third field
select-option_high-year in fourth field.
Finally i need to move these four fields to it_final.
select * from mbewh into corresponding fields of table it_mbewh
for all entries in it_final where matnr = it_final-matnr and
bwkey = it_final-werks and lpmon = ? and lfgja = ?
and bklas <> ' '.
what input i have to give in lpmon and lfgja in select query to get for lfmon (04 to 10)
and lfgja (2004 to 2005).
suggest some ideas.Hi ,
Can you please check the following code.
Hi ,
data : l_low_yr(4),
l_high_yr(4),
l_low_mon(2),
l_high_mon(2).
Splitting the select option date to month and year into low and higher values
l_low_yr = s_date-low+00(04). " Year low value from the date range
l_low_mon = s_date-low+04(02). " Month low value from the date range
l_high_yr = s_date-high+00(04)." Year high value from the date range
l_high_mon = s_date-high+04(02)." Month high value from the date range
selecting the data from the table mbewh based on some conditions.
select * from mbewh into corresponding fields of table it_mbewh
for all entries in it_final where matnr = it_final-matnr and
bwkey = it_final-werks and lfmon BETWEEN l_low_mon and l_high_mon
and lfgja BETWEEN l_low_yr and l_high_yr and bklas EQ ' '.
This select will retrive the desired data records from the table MBEWH.
Please let me know if this works according to your requirement.
Thanks and Regards
Saritha -
How to split data into tables based on the entries in a column?
My problem is very similar to this thread: how to link data from one numbers sheet to another sheet, however I could get it to work the way described there. I have one big table for entering data (the first one). I would like to have a few other tables populated automatically based on the entries in one of the columns of the first table. In my example below I put everything in one sheet for clarity. The selection to the other tables is to be done on the column "fruit" in the first table. (second one is "oranges", then "apples" and then "pears" -- had to cut the width of my screenshot due to the limitations of Apple's forums).
Here is what it would look like, just cannot figure out how to make it happen automatically.
Tried also importing similar Excel example to Numbers, but the import did not work correctly.
Any help will be appreciated.
LDLarry,
Here's an approach that I've used...
In the Purchases table, Aux column, the expression is:
=COUNTIF($A$1:A2, A) & "-"&A
Fill Down
This expression builds a string that identifies the item and the ocurrance of that item.
The Date column of the Summary tables, cell a3, contains:
=IF(ROW()-3<COUNTIF(Purchases :: $A,$A$1), LOOKUP(ROW()-2&"-"&$A$1, Purchases :: $F, Purchases :: B), "")
Fill Across, then fill down.
Regards,
Jerry -
How to get database growth month wise
Hi All,
Can any one help me getting the growth of production database month wise for the current year.
I mean I need a script which will display the growth of my database month wise for the year 2010.
Regards,hi,
try something along the lines of this
--Run the following create table to create segment info.
create table stats$segment_info as
select
sysdate snap_time,owner, segment_name,segment_type , tablespace_name,sum(bytes) bytes from dba_segments group by owner,segment_type, segment_name,tablespace_name /
-- Run the following once a calendar month via dba_jobs.
insert into stats$segment_info
select
sysdate snap_time,owner, segment_name,segment_type , tablespace_name,sum(bytes) bytes from dba_segments group by owner,segment_type, segment_name,tablespace_name / commit;
-- run the following report to get tablesapace growth
column this_mon new_value this_mon
column last_mon new_value last_mon
column prev_mon new_value prev_mon
select to_char(sysdate,'MON YYYY') This_mon
, To_char(add_months(sysdate,-1),'MON YYYY') Last_mon
, to_char(add_months(sysdate,-2),'MON YYYY') prev_mon from dual;
column mins format 99999
column size_mb heading '&&this_mon' format 99999 column size_mb2 heading '&&prev_mon' format 99999 column size_mb1 heading '&&last_mon' format 99999
column growth heading 'Growth(%)| in |last month' format 9999.99
select tablespace_name,
-- to_char(snap_time,'MON YYYY') Month
max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-2),'MON'),size_m,0)) size_mb2
,max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,0)) size_mb1
,max(decode(trunc(snap_time,'MON'),trunc(sysdate,'MON'),size_m,0)) size_mb
,100*(max(decode(trunc(snap_time,'MON'),trunc(sysdate,'MON'),size_m,0))
- max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,0)))
/max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,1)) growth from (select tablespace_name, snap_time
,sum(bytes)/1024/1024 size_M
from stats$segment_info
where snap_time > trunc(add_months(sysdate,-2),'MON')-2
group by tablespace_name,snap_time) a
group by tablespace_name
order by tablespace_name
/as far as I am aware this is database independent.
regards
Alan -
How to get the count monthly wise
Hi All
I have lot of order dispatched in a year 2010, how to get the moth wise total.
For example jan 1000 orders ,feb 2500 orders.
Thanks & Regards
Srikkanth.MPleiadian wrote:
Maybe even
b.schedule_ship_date between to_date('2010','YYYY') and to_date('2011','YYYY');)But this could return schedule ship dates that are 01-Jan-2011 00:00:00. I don't think this is wanted since it was not specified in the original requirement. I'm not even sure if to_date('2010','YYYY') returns 01. Feb.2010 in a few days (when we will have february).
Just checking the docs....
found it: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#SQLRF51062
from the docs:
If you specify a date value without a time component, then the default time is midnight (00:00:00 or 12:00:00 for 24-hour and 12-hour clock time, respectively). If you specify a date value without a date, then the default date is the first day of the current month.Just to be on the safe side always give the complete format mask!
b.schedule_ship_date >= to_date('01012010','DDMMYYYY')
and b.schedule_ship_date < to_date('01012011','DDMMYYYY')Edited by: Sven W. on Jan 17, 2011 5:14 PM -
How to extract data from monthly tables for annual balance chart?
Hello Again!
I am wanting to decide whether to enter all of my transactions into one table for the whole year or separate tables for each month. If I was to use one table for the whole year it would probably have in the region of 1000 entries, and as I understand it, Numbers doesn't work so well with such large tables. Also, as I will be mostly using Numbers on my iPad, where it runs slower, this may well slow things down considerably. Another reason for using Monthly Tables is that it would be easier to search.
Having said this, I am using the following method to construct balance charts for my accounts which seems to depend on having just one table for all transactions for the year. Here is a sample of the transactions table:
which updates the balance for each account after each new transaction is entered.
Then I use the following table for creating the balance charts:
It uses the following formula to return the balance at the end of each week for each account (this is the formula for Account 1) which then is displayed in the chart.
=LOOKUP(A2,$Week Number,All Transactions :: Account 1)
If I was to use the Monthly Tables method it is not obvious to me how I would create the Weekly Balance Table, given that I would need to draw data from 12 different tables, and that some of these Tables would contain the same Week Number (for weeks that overlap months).
I would be grateful for any advice on achieving the result I am looking for by the most efficient method.
Thanks
Nick
P.S. Hopefully this is the last question for a while!I wasn't urging you to keep an annual table but to spit it on an easier to rule basis.
Split it in chuncks of exactly 35 days starting from the first one of the 'year' in operation
Doing that everything will be easier
the index of a day will be calculated by
=DATEDIF(B,D,"D")+1
The index of the 'custom_week' will be calculated by :
=1INT((DATEDIF(B,D,"D")1)/7)
So, it would be easy to gather datas from a given 'custom_week'.
Yvan KOENIG (VALLAURIS, France) jeudi 5 août 2010 10:22:25 -
How to split data using delimiters
HI, is there a way or a function that will split/separate data based on the delimiters? example: if i have a variable x = 5.4 , I want to separate them using the period(.) . So that i can separate 5 from 4. Thanks.
MScallion I'm like your SQL but i'm don't know how it does.
Pls, you explain your select statement.
1. regexp_replace
I'm run select statement in sql*plus ( Oracle9i Enterprise Edition Release 9.2.0.2.1 )
ORA-00904: "REGEXP_REPLACE": invalid identifier
2. Why you used ^ , $ and ^ is .... ? $ is ..... ?
Thank you -
How can split data into multiple sheets using an excel template
Hi all,
I'm using BIP 10.1.3.4.1 upgrated with the latest rollup patch, 9546699.
I followed the example inside the article "Real Excel Templates 1.5" (on the Tim Dexter's blog)
http://blogs.oracle.com/xmlpublisher/2010/05/real_excel_templates_i.html
and I built my report directly from an excel template containing only one sheet (plus the XDO_METADATA sheet), and for one sheet it worked fine !!!
Now I need to add more sheets to the template.... and I have two big questions:
1. if I need to create a second sheet which contains almost the same data (with a different layout), I saw that it is not possible to map a value to more than 1 cell....so if I map a value in the first sheet, I can't map it in the second sheet (because it's already used in the first one).
How can I map same values into two or different execll
2. if I need to create a second sheet which contains another dataset (completely different from the dataset in the first sheet), I can I do, considering that every BIP report is based on ONLY a data source.
Tim wrote: The most impressive, for me at least, is the sheet 'bursting'. You can split your hierarchical data across multiple sheets and dynamically name those sheets
but I didn't yet understand how this bursting it's possible.....considering what I said above.....
Surely I've a lack of knowledge.....but anybody can help me to understanding the "multiple excel sheets" black hole ?
I'll appreciate any kind of help
Thanks in advance
AlexYou can find working solution here http://xlspe.com
-
Split Data from Month to Days in the Bex Report
Hi Gurus,
I have a Actual and Plan data. Actual data is on daily basis and Plan data is in monthly basis.....
Requirement is : User will be entered Calendar Day ( any day of the month for example : 06/18/2010) to bring Month to date on both Actual and Plan data. Like for example if user enters the date 18th June 2010. Then I need to pull from the beginning of the month to date up to that selection day( in our case 18 days).
Actual : I don't have issue getting the Month to date and Year to date because I have data on daily basis.
Plan : As I said data is on monthly basis. I want to break this data up to the day selected ( from 1st of the June month to 18th as given in example) by user. Like if you have amount is $5000 then my logic will be
CKF = (5000 * 18) / total number days in the month
Please provide help on this how to bring the data for Plan...
Thanks
Ganesh Reddy.ganesh,
in your data model convert date field to calander period and calander year .
once that is done
create restricted key figures
1) month to date
2) year to date
month to date - key figure is restricted to custom variable ( which populates calander period based on the date user enter)
year to date - key figure is restricted to custom variable (which populates calander year based on the date user enter )
hope you got it .
Thanks,
pk.
Maybe you are looking for
-
XMLP Bursting program - Update status after bursting
Hi, I have a xmlp bursting report. The requirement is to email POs. Once emailed, I need to update the status back, so that duplicate emails arent sent. So the logic incorporated is: 1. Generate xml data 2. call bursting program 3. wait for step2 to
-
Scan additional pages into a PDF document
I have a PDF document which I created by scanning pages into it. I have re-opened the document and want to scan additional pages. Is there any way I can do this that does not involved scanning into a new document and either dragging the pages into my
-
HT5621 I have two apple ids showing up on apps and I want to delete one. How?
How do I delete an apple I'd I don't use anymore?
-
When i go to access iphone 6 camera it is very dark
-
I would outsource this section of a Flash site to someone who understands actionscript and xml. The section that needs to be created is a project title directory. The project title list or directory: 1. needs to be created from an existing XML file.