Chart: amount (count) of records per month (and year). How?
I need to create a chart eventually. Can't get what formula to use. The data is:
1 | 15 Jan
2 | 20 Jan
25 | 14 Mar
26 | 16 Mar
28 | 20 Mar
The chart should show amount(count) of records per month(and year). So in this example:
Jan: 2
Mar: 3
Hm... totally lost. Any tips?
To do this it would be best to add a column in which you isolate the month from the rest of the date information. Here's an example:
You may hide the Month-Isolated column if it impacts your presentation.
The Month-Isolated formula is: =IF(ISBLANK(B), "", (MONTH(B)))
The formula for the count in the Summary table is: =COUNTIF(Data Table :: $C, COLUMN())
Hope this gets you on your way.
Regards,
Jerry
Similar Messages
-
How to save and month and year wise values
Hi friends,
in my ztable i have to enter values manually for month and year wise..
so i have to create parameter for month and year how to create it.
in my parameter month and year fields..
once he given month and year then he should enter values for fields..
i have doubt how to give parameter for this...table..
example: month: 1
year : 2007
after that user enter values for following fields.
kunnr
name
core values
noncorevalues
above fields user will enter values month wise ..
once he enter the values for january it should save ...
next he enter values for february and it will save..
when ever he want to see the january month data how can he see..
is there any logic for the above problem...Hai venkat,
I am not totally clear with your question some how i understood. I give my opinion may be it ll help ful to you.
In your ztable you want to enter the values for the fields kunnr, name, core values ,noncorevalues as per month.
As i say in your ztable add another field as month with other 4 fields. Provide the table maintenance for your table or else in se11 -> table display ->utilities -> table contents -> create entries is one way.
If you proivided maintenance for your table go to SM30. where you can manually enter values .
<b>reward if useful</b>
Regards,
sunil kairam. -
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Selecting records based on month and year parameters
Hi. I have a sql 2008 r2 stored procedure which needs modifying to return the data based on a start / end month and year.
It's a large SP so I'll summarise - It accepts four parameters:
@StartMonth NVARCHAR(10)
@StartYear NVARCHAR(4)
@EndMonth NVARCHAR(10)
@EndYear NVARCHAR(4)
The current WHERE clause is:
WHERE ta.TimeByDay BETWEEN '01' + '-' + ltrim(LEFT(@StartMonth, 3)) + '-' + @StartYear
AND convert(nvarchar,datediff(day, ta.TimeByDay, dateadd(month, 1, ta.TimeByDay))) + '-' + ltrim(LEFT(@EndMonth, 3)) + '-' + @EndYear
Example of input parameters:
@StartMonth = N'January',
@StartYear = N'2014',
@EndMonth = N'February',
@EndYear = N'2014',
Result:
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
(1 row(s) affected)
However it executes correctly if we do either of the following:
1) Run the SQL direct in QA and type in January and February rather than passing in the Start/End Month parameters
2) As you can see we use the following datediff call to get the number of days per month. IF I replace this with '28', or '31' for example the query also runs (oddly number 1 above then also runs by executing the SP):
convert(nvarchar,datediff(day, ta.TimeByDay, dateadd(month, 1, ta.TimeByDay)))
How do I update the WHERE clause to return records between a start/end month and year?
I'm a day on this so any help appreciated.
Thankscreate function NthDayOfMonth (@year int, @month smallint, @weekday varchar(15), @nth smallint)
returns datetime
as
begin
declare @the_date datetime, @c_date datetime, @cth smallint
set @cth = 0
set @c_date = convert(varchar,@year)+'-'+convert(varchar,@month)+'-01'
while month(@c_date) = @month
begin
if datename(weekday,@c_date) = @weekday set @cth = @cth + 1
if @cth = @nth and datename(weekday,@c_date) = @weekday set @the_date = @c_date
set @c_date = dateadd(day,1,@c_date)
end
return @the_date
end
go
create function Dates(@date datetime)
returns @table table
now datetime,
today datetime,
Month_start datetime,
Month_end datetime,
Prev_Month_Start datetime,
Prev_Month_End datetime,
Week_Start datetime,
Week_End datetime,
Prev_Week_Start datetime,
Prev_Week_End datetime,
Quarter_Start datetime,
Quarter_End datetime,
Prev_Quarter_Start datetime,
Prev_Quarter_End datetime,
Year_Start datetime,
Year_End datetime,
Prev_Year_Start datetime,
Prev_Year_End datetime,
Month_End_TS datetime,
Prev_Month_End_TS datetime,
Week_End_TS datetime,
Prev_Week_End_TS datetime,
Quarter_End_TS datetime,
Prev_Quarter_End_TS datetime,
Year_End_TS datetime,
Prev_Year_End_TS datetime,
Year smallint,
Month smallint,
Day smallint,
Month_Name varchar(15),
Day_Name varchar(15),
WD smallint
as
begin
if @date IS NULL set @date = getdate()
insert into @table
select
@date as now,
convert(datetime,convert(varchar,@date,101)) as today,
dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101))) as Month_Start,
dateadd(day,-1,dateadd(month,1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101))))) as Month_end,
dateadd(month,-1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101)))) as Prev_Month_start,
dateadd(day,-1-day(@date)+1,convert(datetime,convert(varchar,@date,101))) as Prev_Month_End,
dateadd(day,1-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Week_Start,
dateadd(day,7-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Week_End,
dateadd(day,-6-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Prev_Week_Start,
dateadd(day,0-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Prev_Week_End,
convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01') as quarter_start,
dateadd(day,-1,dateadd(quarter,1,convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01'))) as quarter_end,
convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01') as prev_quarter_start,
dateadd(day,-1,dateadd(quarter,1,convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01'))) as prev_quarter_end,
dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))) as Year_Start,
dateadd(year,1,dateadd(day,0-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Year_End,
dateadd(year,-1,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Prev_Year_Start,
dateadd(year,-1,dateadd(year,1,dateadd(day,0-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))))) as Prev_Year_End,
dateadd(ms,-3,dateadd(day,0,dateadd(month,1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101)))))) as Month_End_Ts,
dateadd(ms,-3,dateadd(day,-1-day(@date)+2,convert(datetime,convert(varchar,@date,101)))) as Prev_Month_End_TS,
dateadd(ms,-3,dateadd(day,8-datepart(dw,@date),convert(datetime,convert(varchar,@date,101)))) as Week_End_TS,
dateadd(ms,-3,dateadd(day,1-datepart(dw,@date),convert(datetime,convert(varchar,@date,101)))) as Prev_Week_End_TS,
dateadd(ms,-3,dateadd(day,0,dateadd(quarter,1,convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01')))) as quarter_end_TS,
dateadd(ms,-3,dateadd(day,0,dateadd(quarter,1,convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01')))) as prev_quarter_end_TS,
dateadd(ms,-3,dateadd(year,1,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))))) as Year_End_TS,
dateadd(ms,-3,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Prev_Year_End_TS,
Year(@date) as Year,
Month(@date) as Month,
Day(@Date) as Day,
datename(month,@Date) as Month_Name,
datename(WEEKDAY,@date) as Day_Name,
datepart(weekday,@date) as WD
return
end
go
create function Holidays(@year smallint)
returns @table table
date datetime,
type varchar(10),
name varchar(25)
as
begin
insert into @table
select convert(datetime,convert(varchar,@year)+'-01-01') as date,'Holiday' as type ,'New Years Day' as name UNION ALL
select dbo.NthDayOfMonth(@year,2, 'Monday',3),'Holiday','Family Day' UNION ALL
select dateadd(d,0-case when datepart(weekday,convert(varchar,@year)+'-05-25') in (1,2) then 5+datepart(weekday,convert(varchar,@year)+'-05-25') else datepart(weekday,convert(varchar,@year)+'-05-25')-1 end, convert(varchar,@year)+'-05-25') ,'Holiday','Victoria Day' UNION ALL
select convert(varchar,@year)+'-01-07' ,'Holiday','Canada Day' UNION ALL
select dbo.NthDayOfMonth(@year,8, 'Monday',1),'Holiday','Civic Holiday' UNION ALL
select dbo.NthDayOfMonth(@year,9, 'Monday',1),'Holiday','Labour Day' UNION ALL
select dbo.NthDayofMonth(@year,10,'Monday',2),'Holiday','Thanksgiving' UNION ALL
select convert(varchar,@year)+'-11-11' ,'Holiday','Rememberance Day'UNION ALL
select convert(varchar,@year)+'-12-25' ,'Holiday','Christmas Day' UNION ALL
select convert(varchar,@year)+'-12-26' ,'Holiday','Boxing Day'
update @table
set date =
case when name != 'Boxing Day' and datepart(weekday,date) = 7 then dateadd(day,2,date)
when name != 'Boxing Day' and datepart(weekday,date) = 1 then dateadd(day,1,date)
when name = 'Boxing Day' and datepart(weekday,date) = 7 then dateadd(day,2,date)
when name = 'Boxing Day' and datepart(weekday,date) = 1 then dateadd(day,2,date)
when name = 'Boxing Day' and datepart(weekday,date) = 2 then dateadd(day,1,date)
else date
end
return
end
go
Using these functions (in place of a calendar table) you could do something like this:
DECLARE @forumTable TABLE (sales MONEY, saleDate DATE)
INSERT INTO @forumTable (sales, saleDate)
VALUES
(123.45, '2014-01-05'),(678.90, '2014-01-06'),(111.21, '2014-01-07'),(314.15, '2014-01-08'),(161.71, '2014-01-09'),
(819.20, '2014-02-05'),(212.22, '2014-02-06'),(324.25, '2014-02-07'),(262.72, '2014-02-08'),(829.30, '2014-02-09')
SELECT SUM(f.sales), d.month_end
FROM @forumTable f
CROSS APPLY sandbox.dbo.dates(f.saleDate) d
GROUP BY d.month_end -
I just bought the creative cloud. For 20 euros per month, and when I downloaded Illustrator it tells me that the trial has expired and gives me the option to buy. Why?
Hi Florencia33,
Please check if you are signed into the Creative cloud with the correct email ID under which you have subscribed.
Please refer to the steps as mentioned in the help document:
Sign out, Sign in | Creative Cloud Desktop app
Regards,
Sheena -
Sorting grouped values by month and year within chart
Hello
I have a really tough problem which I can't seam to figure out.
I have a table called SOLAR_RETURN which has 4 columns:
- ID
- USER_ID
- DATUM
- RETURN
On a page I have 3 links, one for showing the information from the database by day, month or year.
The hidden field :P25_DATE_FILTER is being set through the URL when clicking one of the 3 links.
I have a linechart with the following sql statement which pulls the correct data according to the value of :P25_DATE_FORMAT:
select null link, to_char("SOLAR_RETURN"."DATUM", :P25_DATE_FILTER) as label, max("SOLAR_RETURN"."RETURN") as value from "SOLAR_RETURN"
WHERE "SOLAR_RETURN"."USER_ID" = :USER_ID
AND to_char(DATUM, :P25_DATE_FILTER) = decode(:P25_DATE_FILTER,'YYYY',to_char(DATUM, 'YYYY'),'MM-YYYY',to_char(DATUM, 'MM-YYYY'),'DD-MM-YYYY',to_char(DATUM, 'DD-MM-YYYY'))
GROUP BY to_char(DATUM, :P25_DATE_FILTER)
Everything is working great, only the sorting is messed up. I need to sort it so that when :P25_DATE_FORMAT is set to DD-MM-YYYY it will be sorted by year desc, month desc, day desc. If the value would be MM-YYYY it would need to sort by year desc, month desc.
I have tried the following without succes:
ORDER BY to_char(DATUM, :P25_DATE_FILTER) ASC
--> This doesnt cut it since it sorts like this: (for example)
01-2010
02-2010
11-2009
12-2009
Vice versa for DESC
Is there any way that I can sort the grouped values by day, month and year seperately?
Thanks in advance!
MarcHi,
What is data type for column DATUM ?
If it is date did you try ORDER BY DATUM DESC ?
Br,Jari -
Table ( In-focus)
CREATE TABLE "LIBRARY"."INFOCUS_LOG"
("LOGDATETIME" DATE,
"COUNTER" NUMBER(6,0)
Procedure
create or replace PROCEDURE IN_FOCUS_PAGE
(ldt INFOCUS_LOG.logdatetime%TYPE,
COT INFOCUS_LOG.counter%TYPE)
IS
BEGIN
INSERT
INTO INFOCUS_LOG
VALUES(ldt, COT);
DBMS_OUTPUT.PUT_LINE('RECORD IS ADDED......!');
COMMIT;
END IN_FOCUS_PAGE;
What do I need to do if I want to insert month and year only for this particular table.
Result Example:
JAN-2007
FEB-2007
MAR-2007
Message was edited by:
user579538A DATE is always going to have a full day and time component, so you cannot store just the month and year. You can, of course, choose to display just the month and year, i.e.
SELECT TO_CHAR( date_column, 'MON-YYYY' )
FROM some_tableor to extract the month and year separately
SELECT EXTRACT( year from date_column ) yr,
EXTRACT( month from date_column ) dt
FROM some_tableJustin -
SELECTION SCREEN FIELD FOR MONTH AND YEAR
Hi All.
We are developing a 'Monthly Sales Tax(payable) Report.
they want the report based on the date(in the selection screen it will come only month and year only.).Depends on that month and year for that select-options ,it will pick up the record.
like if, jan 2005 to march 2006.
then it will pick up from 01.01 .20005 to 31.03.2006 records.
Can any body help me to resolve this.
Thanks in advance,
Regards,
VenkatHi Venkat,
Copy the following code.
DATA : ws_billfrom TYPE dats,
ws_billto TYPE dats.
DATA : mon TYPE fcltx.
SELECT-OPTIONS: s_month FOR mon
MATCHCODE OBJECT zsdhtch_sh_mnth
OBLIGATORY. "o get values for F4
PARAMETER : p_year LIKE bkpf-gjahr
MATCHCODE OBJECT zsdhtch_sh_year
OBLIGATORY.
RANGES : s_date FOR sy-datum.
DATA : ws_fcmnr TYPE fcmnr.
START-OF-SELECTION.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-low.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = ws_billfrom
IMPORTING
ev_month_begin_date = ws_billfrom
ev_month_end_date = ws_billto.
s_date-low = ws_billfrom.
s_date-high = ws_billto.
s_date-sign = 'I'.
s_date-option = 'BT'.
IF NOT s_month-high IS INITIAL.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-high.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = ws_billfrom
IMPORTING
last_day_of_month = ws_billto.
s_date-high = ws_billto.
ENDIF.
APPEND s_date.
WRITE s_date.
You can write your select statement here.
select * from dbtable where date in s_date.
If 'HR_JP_MONTH_BEGIN_END_DATE' is nto there in your server, you can use 'RP_LAST_DAY_OF_MONTHS' in both cases.
Regards,
Susmitha.
Dont forget to reward points for useful answers -
I want to accumulate rain for the day, month and year; What formula can I use?
I want to accumulate rain for the day, month and year; What formula or expression can I use.
I am using a Rain Wise product that converts pulses to an analog value. The Rain Wise device can be
set to measure up to 1", 5", or 10". I will be setting the unit to 10 inches in increments of 0.01 inches.
What I would like to do is everytime the signal increments I would like to count it as 0.01 then after reaching
a period of time whether it be a day or a month reset back to zero.
Need some advise on this problem.
Solved!
Go to Solution.Hello Ryan,
Lookout gets a Modbus over Ethernet signal which originates as a 4-20mA input to a Moxa Ethernet I/O Module (E1240) in the field. In Lookout I created a ModbusEthernet Driver and a tag which scales 0 - 65534 RAW to 0-10 Eng. [0 - 10 is inches of rain] Also, another piece of information is that after the rain gauge maxes out at 10 inches it will zero out and start over.
I though the accumulator was time based and took a sample over a specific time period, for instance, one sample every 30 seconds then accumulate. If this is so then if I have 5 inches of rain and then it stopped raining, then 30 seconds latter it would sample, it would see 5 inches and add that to be 10 inches when actually it had only rained 5 inches.
I really need some help with this process,
David Lopez
City of Corpus Christi -
Need working days for a particular month and year
Hi,
I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
Regards,
VigneshTry this:
SQL> var yr NUMBER;
SQL> exec :yr := 2010;
PL/SQL procedure successfully completed.
SQL> with t as (select :yr yr from dual)
2 SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
3 (select TO_DATE('01-JAN-'||yr) + lv dat FROM
4 (select level - 1 lv,yr from t
5 connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
6 WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
7 GROUP BY TO_CHAR(dat,'MON-RR');
TO_CHAR(DAT, COUNT(*)
APR-10 22
AUG-10 22
DEC-10 23
FEB-10 20
JAN-10 21
JUL-10 22
JUN-10 22
MAR-10 23
MAY-10 21
NOV-10 22
OCT-10 21
TO_CHAR(DAT, COUNT(*)
SEP-10 22
12 rows selected.
SQL> Edited by: AP on Jul 27, 2010 7:54 AM -
Can we modify the pnp selection screen and get only month and year?
Dear Freinds,
I have requirement where i have to modify the PNP selection screen. So with the help of report category and coding in AT SELECTION-SCREEN OUTPUT , i have modified all the fields relating to dates . i.e i have removed all the radio buttons (i.e Today, Current month,current year etc) and finally
i have landed with only Period ( PNPBEGDA & PNPENDDA range) . But i dont want the PNPBEGDA & PNPENDDA range , but i want only is the month and year ( i.e just like the PNPPABRP & PNPPABRJ)
on my selection screen along with the pernr .
i have used the below code to close all the fields except pnpbegda and pnpendda.
AT Selection-Screen output.
loop at screen.
IF screen-group4 = '098' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '092' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '094' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '100' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '104' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
MODIFY SCREEN.
endloop.
i.e on my selection screen i want only month & year combination and pernr -
when iam using the logical database PNP . Could any one please let me know how can i get only mon & year only on my selection screen .
If it is possible please let me know .
Thanks & regards
divya.Hi ,
The requirement is that the user doesnt want to enter the date range i.e for ex: 01012008 to 31012008.
As per the requirement the user will enter only the month and year only . so i on the selection screen
i want only the month and year only . Is there any means i can modify the date period which is there by
default (PNPbegda and PNPendda) on PNP selection screen. Instead of we givign to the user the
PNPBEGDA and PNPPENDA i want is only month and year .
AS already the code has already been written and now they have asked that they want only the month and year on the selection screen.
Please suggest me in this regard.If iam hiding all the buttons relating the dates fields, and now if iam adding the parameters for the month and year it is coming below below the fields pernr , personnel ara and subara , company code , payroll area, employee group of the standard fields of PNP selection screen , there by any body could please suggest me how to change.
regards
divya. -
Hi all Thanks in Advance
I need help in Pivoting Data
SELECT ID,MONTH,COUNT FROM TABLE_PIVOT ORDER BY ID,MONTH
ID MONTH COUNT
10 10/01/2009 60
10 11/01/2009 80
10 12/01/2009 78
10 01/01/2010 81
10 02/01/2010 73
10 03/01/2010 84
10 04/01/2010 100
10 05/01/2010 107
10 06/01/2010 90
10 07/01/2010 0
10 08/01/2010 0
10 09/01/2010 73
20 10/01/2010 71
20 11/01/2010 76
20 12/01/2010 79
20 01/01/2011 79
20 02/01/2011 81
20 03/01/2011 88
20 04/01/2011 97
20 05/01/2011 87
20 06/01/2011 97I tried to pivot with below query
SELECT ID,
SUM(DECODE(to_char(month,'MM'),'01',count,0)) " Jan",
SUM(DECODE(to_char(month,'MMYY'),'02',count,0)) Feb,
SUM(DECODE(to_char(month,'MM'),'03',count,0)) Mar,
SUM(DECODE(to_char(month,'MM'),'04',count,0)) Apr,
SUM(DECODE(to_char(month,'MM'),'05',count,0)) May,
SUM(DECODE(to_char(month,'MM'),'06',count,0)) June,
SUM(DECODE(to_char(month,'MM'),'07',count,0)) July,
SUM(DECODE(to_char(month,'MM'),'08',count,0)) August,
SUM(DECODE(to_char(month,'MM'),'09',count,0)) September,
SUM(DECODE(to_char(month,'MM'),'10',count,0)) October,
SUM(DECODE(to_char(month,'MM'),'11',count,0)) November,
SUM(DECODE(to_char(MONTH,'MM'),'12',count,0)) December
FROM Table_PIVOT
GROUP BY ID
ORDER BY ID
ID Jan FEB MAR APR MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER
10 81 0 84 100 107 90 0 0 73 60 80 78
20 79 0 88 97 87 97 0 0 0 71 76 79I want output to display the column names with Month and Year like below
ID Oct-2009 Nov-2009 Dec-2009 Jan-2010 Feb-2010 ................... OCT-2010 NOV-2010 DEC-2010 JAN-2011 FEB-2011 ......
10 60 80 78 81 73 ...................
20 71 76 79 79 81
CREATE TABLE "TABLE_PIVOT"
( "ID" NUMBER,
"MONTH" DATE,
"COUNT" NUMBER
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('10/01/2009','MM/DD/YYYY'),60);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('11/01/2009','MM/DD/YYYY'),80);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('12/01/2009','MM/DD/YYYY'),78);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('01/01/2010','MM/DD/YYYY'),81);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('02/01/2010','MM/DD/YYYY'),73);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('03/01/2010','MM/DD/YYYY'),84);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('04/01/2010','MM/DD/YYYY'),100);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('05/01/2010','MM/DD/YYYY'),107);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('06/01/2010','MM/DD/YYYY'),90);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('07/01/2010','MM/DD/YYYY'),0);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('08/01/2010','MM/DD/YYYY'),0);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (10,to_timestamp('09/01/2010','MM/DD/YYYY'),73);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('10/01/2010','MM/DD/YYYY'),71);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('11/01/2010','MM/DD/YYYY'),76);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('12/01/2010','MM/DD/YYYY'),79);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('01/01/2011','MM/DD/YYYY'),79);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('02/01/2011','MM/DD/YYYY'),81);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('03/01/2011','MM/DD/YYYY'),88);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('04/01/2011','MM/DD/YYYY'),97);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('05/01/2011','MM/DD/YYYY'),87);
Insert into TABLE_PIVOT (ID,MONTH,COUNT) values (20,to_timestamp('06/01/2011','MM/DD/YYYY'),97);
COMMIT;Hi,
user1849 wrote:
Any Sample code is appreciated
I didn't see any solution for following one in your linklI think Centinul was specifically referring to:
Help for a query to add columns
but other links from
SQL and PL/SQL FAQ
may help you more.
>
Re: How to pipeline a function with a dynamic number of columns?
Posted: May 9, 2006 2:58 PM in response to: Billy Verreynne Reply
Interesting stuff! It's going to take me awhile to digest it.
For what it's worth, I was trying to build a pivoting function that would take a MYTABLE table like this:
YEAR CITY X Y
2000 BAL 95 96
2000 BOS 101 101
2001 BAL 92 94
2001 BOS 101 101
2002 BAL 98 98
2002 BOS 98 99
2003 BAL 95 96
2003 BOS 105 104
and allow me to do something like:
CREATE VIEW MYPIVOT
AS
SELECT *
FROM TABLE (PIVOT(MYTABLE, [with other params]))
and get the following view MYPIVOT on the table:
YEAR BOS_X BOS_Y BAL_X BAL_Y
2000 101 101 95 96
2001 101 101 92 94
2002 98 99 98 98
2003 105 104 95 96
Where the number of distinct CITY values will vary over time. I am able to build the query I need dynamically, but since the CITY data values in the original table change, the columns are not necessarily static from invocation to invocation. Therefore I didn't want to just create a view using the dynamic SQL once, because it may need to be created next time I need to access the view. I wanted to be able to access the pivoted data on demand.A pipelined function is your best bet for that.
I couldn't do was be able to execute the query and treat it as a pipelined function, hence my original question.Sorry, I don't understand.
I'll dig into the code above to see if it does what I wanted, but if someone has a better suggestion on how to approach this, I'd be interested in hearing it.A completely different approach is String Aggregation , where you would get output like this:
YEAR TXT
BOS_X BOS_Y BAL_X BAL_Y
2000 101 101 95 96
2001 101 101 92 94
2002 98 99 98 98
2003 105 104 95 96Note that this output contains 6 rows and 2 columns. On the first row, year is NULL and txt=' BOS_X BOS_Y BAL_X BAL_Y'. You can do this is pure, static SQL, without knowing the number of cities in advance. -
Date concatenation using MONTH and YEAR
Env : Oracle Reports 9I.
I need to display reports based on dates.
If the user enters in one field 'SEP' and in another '2005',
how can I concatenate both the fields as one and then display
all results for SEP 2005?
The Table has a field called Eff_Date (of type Date)
and containing values:
Eff_Date
==============
01-09-05
02-09-05
04-09-05
05-09-05
My code is
SELECT col1,
col2
FROM TableA
Where TRUNC(Eff_Date )=:MONTH ?? PARAMETER: Here is the month : SEPT
and TRUNC(Eff_date) =:YEAR ?? PARAMETER: Here is the Year : 2005I need to concatenate parameters MONTH and YEAR in one and then
display records for that month.
How can I write the SQL Query to concatenate MONTH and YEAR and
TRUNCATE the column eff_date?
Please help.Env : ORACLE REPORTS 9I
I am passing 3 parameters to the report:
Parameters are of type CHAR
Report Parameters
Year / Month : 2005 / AUG
Effective Date :
The colunm in table is eff_date
eff_date
01/08/2005
02/08/2005
03/08/2005
15/09/2005
17/09/2005
18/09/2005
29/09/2005The problem is:
1)If I dont enter anything,I just get displayed 2 record for the above.
It should display all records rather than 2.
2)If I enter Effective date as 01-AUG-2005,no records are displayed.
This is my code:
Select col1,col2
from TableA
where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) )
AND TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH, 'yyyymon') ,
TRUNC(ch.eff_date) )
)Shud i change the AND to OR? -
Loop through month and year till date while using a merge statement
Hello Guys,
I have 2 tables with the following datas in them:-
Company
CompanyId CompanyName
1 Company1
2 Company2
3 Company3
Employees
EmployeeId EmployeeName CompanyId StartDate
1 Employee1 1 12/21/2011
2 Employee2 1 01/20/2012
3 Employee3 2 03/23/2012
4 Employee4 2 07/15/2012
5 Employee5 2 01/20/2013
6 Employee6 3 12/17/2013
Now i want to check, How many people were recruited in the team in the specified month and year? I have the storage table as follows:-
RecruiterIndicator
CompanyId Year Month EmployeeRecruited
1 2011 12 1
1 2012 1 1
2 2012 3 1
2 2012 7 1
2 2013 1 1
3 2013 12 1
This should be a merge stored procedure that should update the data if it is present for the same month year and company and insert if that is not present?
Please help me with this
Thanks
AbhishekIt's not really clear where the merge to come into play. To get the RecruiterIndicator table from Employess, this query should do:
SELECT CompanyId, Year(StartDate), Month(StartDate), COUNT(*)
FROM Employees
GROUP BY CompanyId, Year(StartDate), Month(StartDate)
Erland Sommarskog, SQL Server MVP, [email protected] -
Concatenate Date fields as month and year
Hi,
I want to concatenate the field bseg-augdt as month and year.
And have to append as a seperate field (Fiscal month | fiscal year) in the output.
Plz help me to overcome this issue.
Thanks and Regards,
Karthik
Moderator message: very basic, please try yourself and search for information before asking.
locked by: Thomas Zloch on Aug 4, 2010 1:22 PMEnv : ORACLE REPORTS 9I
I am passing 3 parameters to the report:
Parameters are of type CHAR
Report Parameters
Year / Month : 2005 / AUG
Effective Date :
The colunm in table is eff_date
eff_date
01/08/2005
02/08/2005
03/08/2005
15/09/2005
17/09/2005
18/09/2005
29/09/2005The problem is:
1)If I dont enter anything,I just get displayed 2 record for the above.
It should display all records rather than 2.
2)If I enter Effective date as 01-AUG-2005,no records are displayed.
This is my code:
Select col1,col2
from TableA
where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) )
AND TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH, 'yyyymon') ,
TRUNC(ch.eff_date) )
)Shud i change the AND to OR?
Maybe you are looking for
-
In sql statements with JSP. Heres the deal: Access database: Tablename: EVENT FieldName: event_id DataType: Number I want to compare the event_id to an integer variable called "var" in a WHERE clause in an SQL statement through a JSP. String query =
-
HELP!!! Pages won't open my documents. In the sidebar there is a preview of my document for half a second, then it goes black. The actual document itself is blank (white) and I can't copy/paste or type anything into it. I already uninstalled and rein
-
compre la suite hace un año y recien ahora lo voy a ocupar pero no encuentro donde descargarla me ayudan por favor!!!!! saludos!!!!!
-
Hi I have created a freight order for which the Rail is the mode of transport. I have created a schedule for the Rail.I cannot able to assign the Schedule to the created Freight order. Through transportation cockpit,i can able to create the freight
-
Create Language specific text for Service MAster
Hi All, Can Someone help me to maintain language dependent text for Service Master. I need to maintain it for different languages. Regards, Smita