Display data in month wise
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,
Priya
hi 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.
Similar Messages
-
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 -
Display schedule qty - Month wise in ALV Grid
Hi Experts,
I have a requirement to display the schedule line quantities month wise in ALV Grid. The columns sholud be dynamic columns based on the input date range. I got some idea about how to create dynamic ALV but it is not clear to implement in my requirement.
Please Guide me in achiving the same.
Example:
Jan 2011 Feb 2011 March 2011
100 2000 300
Thanks&Regards,
KarthikHi.,
Create field catalog dynamically as like this.,
select-options s_date for sy-datum.
data: n type i,
count type i,
cnt type string,
field type string,
descr type string.
DATA: m TYPE t247-mnr,
month_name type char10,
m1 type i.
n = s_date-high+4(2) - s_date-low+4(2) . " getting number of months
m1 = s_date-low+4(2).
m = m1.
n = n + 1.
DO n TIMES. " building field catalog dynamically
m = m + 1.
count = count + 1.
cnt = count.
concatenate 'FIELD' cnt into field.
CALL FUNCTION 'ISP_GET_MONTH_NAME' " FM to get month name
EXPORTING
LANGUAGE = sy-langu
MONTH_NUMBER = m
IMPORTING
* LANGU_BACK =
LONGTEXT = month_name .
concatenate month_name s_date-low+0(4) into descr separated by ''.
wa_fieldcat-col_pos = count.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-fieldname = field.
wa_fieldcat-seltext_m = descr.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
ENDDO.
After this create dynamic table using,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
then loop the internal table and assign the component to final internal table,.
like .,
CONCATENATE 'FIELD' index INTO fieldvalue. " do same like fieldcatalog
ASSIGN COMPONENT fieldvalue OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = wa-fieldvalue.
hope this helps u.,
Thanks & Regards,
Kiran -
Display information on Month wise
We have one requirement and we need to display the Month wise information on the report (Sysdate - 1, sydate -2 ....etc)
for example today is 08 Sept 2011 In template level we need to display below
Sept 2011 Aug 2011 Jul 2011 Jun 2011 May 2011 Apr 2011
Please let me know if it's possible to do in RTF Template.Pull all the required date and data from DB using queries,.
-
Hi All,
What is the code to write when i want to display a date like 9 months before a certian date?
Like for example, i have a data which is StartDate and the value is 30 June 2014. In my report i want to display 30 Sept 2013.
How can i do that?
Thanks.Hi,
Try below formula content:
DateAdd('m', -9, <your date field>)
Thanks,
Raghavendra -
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
; -
Report display will be 2010,2011 year wise display and 2012 Month display
Hi,
I want to Create Report, output will be 2010,2011 year wise display, 2012,2013 month wise display and Fiscal year quarter display, all are display based on input value of Fiscal year data, please anyone guide me, How to do?
Thanks,
NandishHi,
How to assign KF to Time Characteristics,My report dsplay will be like this, For example
Input Fiscal YEAR=2010 to 2013
Material 2010 2011 APR.2012 to MARCH 2013
Quantity A1 200 300 * *
Quantity A2 300 400 * *
Also Display quarter wise display. How to do
Thanks,
Nandish -
Display data column wise in alv
my problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PMmy problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PM -
Query has to display completed quarters and Data loaded month.
Hi All,
I have 2 issues in BEX .
1. I need to display data loaded month(0calmonth):
Ex: Jan 2007 data has loaded in May 2007, my query has to display for 3 months JAN 2007, Dec 2006, November 2006.
2. completed quarters : if we are in mid of 3 quarter, query has to display Quarter1 and quarter2 (completed) ,nothing has to display in quarter 3.
Thanks in advance for your inputs.1. you mentioned data loded month... but you are pointing Calender month that data belongs to? Are you want display based on Calender Month that data belongs to (Jan 2007) or Loded Month (May 2007) or Last Loded Month?
2. create User Exit variable on Quarter or Month IO. in the User Exit Code, check which Quarter that current month belongs to? if it is mid of 3rd quarter, pass Quarter 1 and 2 (or for month 1 to 6).
hope this helps.
Nagesh Ganisetti.
REMOVED -
Hi,
We have a report in which we need to calculate all the employee hours per month, but at the same time we have a condition that says to supress all the Employees who work more than 40 hours a week, my question here is how do we relate weekly hours to mothly hours, since each month might have more than 20 working days. Any help on this will be appreciated.
Thanks,
Varun.HI i am not using any customer exit. i have hours comming from a key figure, i am concerned about how to do the calculations for the month. i need to eliminate all the employees who works more than 40 hours per week.
But on my report i need to display the hours month wise, so my question is a month can have 20 working days or 21 or 22 or 19. How do we identify this and is there any method.
Thank You,
Varun. -
Hi
I have a requiement , I need to display a report which will give sales target and Actual , month wise for respective sales representative
the format is as follows
Sales Representative Jan feb upto Dec
target Actual target Actual
I have a ODS which will give the Actual Fig and I am using a flat file to upload the target values into another ODS
I will use a Infoset or multiprovider to merge it
Pl suggest how to go about it ?
I mean do I need to create 12 Target Infoobjects(Key Fig)
and how i will do mapping and compare month wise target and actual values
regrds
kisholoyHi kisholoy,
According to me u need not to have separate ODS for the Target figures, u can have the target data into the Actual figure ODS with different infosource arrangement for the Target figures.
I have done such thing previously and it works fine in the same situation.
Well at a reporting side u can keep Sales representative in selection so that viewer can see report for the perticular sales representative or can see for all sales representative.
For this arrangement follow the things i have mentioned hereabove.
1. create a structure for the months in a year. PS: Also put Fiscal year in Selection. (Put this fiscal year and sales representative in the Free characteristics.)
2. Show Text and key for sales representative by ticking ovet this display option in the properties.
3. Go in the Columns create strcture for actual and target figures.
Thus ur query is ready. Do some additional settings as per custemer need.
Hope it helps.
Assign the points if it works. -
Display total dmbtr according to mat type and month wise
hi all,
i want to display total dmbtr according to mat type and month wise. like
month mat.type total_dmbtr
jan 2008 fert xxxxxxxxxx
jan 2008 mcfe yyyyyyyy
feb 2008 fert mmmmmthis is my prog..but am gettin o/p for one month irrespective of material type..
tables : mseg, mkpf, mara, S031.
********************DECLARATION******************************************
types : begin of ty_mkpf,
budat type budat,
mblnr type mblnr,
end of ty_mkpf.
TYPES : BEGIN OF TY_S031,
WERKS TYPE werks_d,
SPMON TYPE SPMON,
matnr TYPE matnr,
END OF TY_S031.
types : begin of ty_mseg,
mblnr type mblnr,
matnr type matnr,
werks type werks_d,
menge type menge_d,
dmbtr type dmbtr,
bwart type bwart,
end of ty_mseg.
types : begin of ty_mara,
matnr type matnr,
mtart type mtart,
end of ty_mara.
data : it_mkpf type ty_mkpf occurs 0 with header line,
it_mseg type ty_mseg occurs 0 with header line,
it_mara type ty_mara occurs 0 with header line,
IT_S031 TYPE TY_S031 OCCURS 0 WITH HEADER LINE.
it_final TYPE ty_final OCCURS 0 WITH HEADER LINE.
data : flag type dmbtr,
flag1 type dmbtr ,
flag3 type dmbtr ,
flag4 type dmbtr,
flag5 type dmbtr,
flag6 type dmbtr,
flag7 type dmbtr,
f1 type i VALUE 0,
num_of_loops TYPE i VALUE 0,
flag2 TYPE spmon.
**********************************INITIALIZATION***************************
flag = 0.
flag1 = 0.
flag3 = 0.
flag4 = 0.
flag5 = 0.
flag6 = 0.
flag7 = 0.
******************selection screen*****************************************
selection-screen begin of block b1 with frame title txt_001.
select-options : plant for S031-werks,
month for S031-SPMON.
date for mkpf-budat. "+4(2).
MONTH FOR MONTH_NAMES_GET.
selection-screen end of block b1.
flag2 = month-low.
f1 = month-high - month-low.
if month-high is initial.
num_of_loops = 1.
else.
num_of_loops = f1 + 1.
endif.
start-of-selection.
perform getdata1.
*& Form get_data
text
form getdata1.
if month-high is INITIAL.
write : / 'for month ' COLOR COL_GROUP, flag2 COLOR COL_GROUP.
Select WERKS SpMON matnr from S031 into corresponding fields of table it_S031
where SpMON = flag2 AND WERKS IN PLANT.
loop at IT_S031.
at first.
write : /5 'mat_num', 20 'month', 40 'QTY',58'amt',68'movement_type', 85'mat_type'. ",105 'qty remaining'.
skip.
endat.
select single mblnr werks matnr menge dmbtr bwart from mseg into corresponding fields of it_mseg
where werks = IT_S031-werks and ( bwart = '102' or bwart = '101' or bwart = '601' or bwart = '602' )
and matnr = it_s031-matnr.
if it_mseg-bwart = '101'.
flag = flag + it_mseg-dmbtr.
elseif it_mseg-bwart = '102'.
flag1 = flag1 + it_mseg-dmbtr.
elseif it_mseg-bwart = '601' .
flag4 = flag4 + it_mseg-dmbtr.
elseif it_mseg-bwart = '602' .
flag5 = flag5 + it_mseg-dmbtr.
endif.
flag3 = flag - flag1. "101-102
flag6 = flag4 - flag5. "601-602
select SINGLE matnr mtart from mara into corresponding fields of it_mara
where matnr = it_mseg-matnr. " and mtart = 'FERT' .
loop at it_mara.
write : / it_mara-matnr,20 IT_S031-SPMON, it_mseg-menge, it_mseg-dmbtr, 70 it_mseg-bwart, 88 it_mara-mtart.
skip.
endloop.
endloop.
skip 1.
write : / 'TOTAL QTY RECVD (a = 101-102) ' , flag3.
write : / 'TOTAL QTY CONSUMED ( b = 601-602) ' , flag6.
flag7 = flag3 - flag6.
write : / 'QTY REMAINING (a-b) ' , flag7.
skip 2.
flag = 0.
flag3 = 0.
flag4 = 0.
flag5 = 0.
flag6 = 0.
flag7 = 0.
flag2 = flag2 + 1.
endif.
do num_of_loops times.
if not flag2 gt month-high.
write : / 'for month ' COLOR COL_GROUP, flag2 COLOR COL_GROUP.
Select WERKS SpMON matnr from S031 into corresponding fields of table it_S031
where SpMON = flag2 AND WERKS IN PLANT.
loop at IT_S031.
at first.
write : /5 'mat_num', 20 'month', 40 'QTY',58'amt',68'movement_type', 85'mat_type'. ",105 'qty remaining'.
skip.
endat.
select single mblnr werks matnr menge dmbtr bwart from mseg into corresponding fields of it_mseg
where werks = IT_S031-werks and ( bwart = '102' or bwart = '101' or bwart = '601' or bwart = '602' )
and matnr = it_s031-matnr.
if it_mseg-bwart = '101'.
flag = flag + it_mseg-dmbtr.
elseif it_mseg-bwart = '102'.
flag1 = flag1 + it_mseg-dmbtr.
elseif it_mseg-bwart = '601' .
flag4 = flag4 + it_mseg-dmbtr.
elseif it_mseg-bwart = '602' .
flag5 = flag5 + it_mseg-dmbtr.
endif.
flag3 = flag - flag1. "101-102
flag6 = flag4 - flag5. "601-602
select matnr mtart from mara into corresponding fields of table it_mara
where matnr = it_mseg-matnr. " and mtart = 'FERT' .
loop at it_mara.
write : / it_mara-matnr,20 IT_S031-SPMON, it_mseg-menge, it_mseg-dmbtr, 70 it_mseg-bwart, 88 it_mara-mtart.
skip.
endloop.
endloop.
skip 1.
write : / 'total recd qty (a = 101-102) ' , flag3.
write : / 'total Qty consumed ( b = 601-602) ' , flag6.
flag7 = flag3 - flag6.
write : / 'Qty remaining (a-b) ' , flag7.
skip 2.
flag = 0. flag3 = 0. flag4 = 0. flag5 = 0. flag6 = 0. flag7 = 0.
flag2 = flag2 + 1.
endif.
enddo.
endform. "getdata1 -
Hi,
i have a dimension table with month_key having values (201201,201202,201203.......202011,202012) and month name ( Jan 12, feb 12,......NOV 20, Dec 20) and a fact table with columns (month_key ,measure_types, Amount)
My requirement is to create a power pivot report in which when a user select a month from the filter, the report should display the (selected month+18 ) month's data against each type . when JAN 12 is selected ,the jan 2012 +18 = june 2013
, month name should be populated with months till june 2013 only .
i tried creating calculated column"END DATE " in the fact table with dax expression to calculate the 18th monh from the current month as below
month_key END DATE
201201 201306
201202 201307
and thought of filtering the table with month key <= ENDDATE but it is not working as expected. could you please guide me on this ? Is there any time intelligence function that serve the purpose . Iam using excel 2010
..hence could not do any calculation on the report side also. please suggest .
Thanks in advanceDo you need to show the measure calculated for those 18 months as a total on 1 row, or do you need to select a single month and then display on row filters 18 distinct rows?
The first is trivial as driezl has suggested.
The second will require a second calendar table.
I created this example workbook for a coworker who had a similar problem. You will have to use the disconnected table as your filter and pull your related table onto the rows.
Finally, the easiest way to deal with the sort of date arithmetic you need to do is to restructure your date table to have a series of "Sequential" fields. These fields should be the number of units of time since the beginning of your calendar.
For example, consider a calendar starting on January 1, 2010. For January - December 2010, [MonthSequential] = 1, 2, ..., 12. For January - December 2011, [MonthSequential] = 13, 14, ..., 24, and so on, incrementing by 1 for each sequential month in time.
Assuming you have this set up in your date tables (one related to your model - DimDate - and one disconnected - DisconDimDate) your measure would look like this:
18 Month Measure:=
CALCULATE( [Measure]
, FILTER( DimDate
, DimDate[MonthSequential] >= MAX( DisconDimDate[MonthSequential] )
&& DimDate[MonthSequential] <= MAX( DisconDimDate[MonthSequential] ) + 18
Please review this example along with the workbook I have linked above. -
How to display the data in row wise in smartform
Hi,
I have to make a modification a smartform of poprinting and i want to display the row wise . At present it is displaying the
column wise. Actually there is a text which i want to display the data row wise.
It is possible to display the data in row wise of the text .
Edited by: nav009 on Oct 8, 2009 10:39 AMHello ,
I assume that your requiremen is related to smartform.the below is the solution i suggest.
As per my understanding of your requirement ,It's clear that as of now there is some description field which is also getting displayed along with other PO fields.
However you would like to display the description field in a new line since the length of this field is longer than other fields as a result the data is getting scattered .
Therefore one better option could be: since the whole data from PO would be in a loop you can display all other fields in one line type of the table as per the intial requirement and you display the description line alone in a new line type wth the desired length so that data would not be scattered and no data loss would happen.
I assume you are aware of creating of line types for table.
Thanks
M.Naveen. -
How to display dates in half-months?
How can I display dates in half-months from dim_date table? like shown below:
Assume that 8/14/2012 is current date..
07/15 - 07/30 - no. of opties created between those dates
07/01 - 07/14 - no. of opties created
06/15 - 06/30 - ...
06/01- 06/14 - ...
How can display the dates in those buckets? Any ideas appreciated.
Thanks in adv.Try to build the same in RPD using the below sql.
I've created a Flag based on W_DAY_D."DAY_OF_MONTH" <= 14 then 'F' else 'S' end
in answers I've got min and max based on exp: min(Time."Row Wid" by Time.Flag)
WITH
SAWITH0 AS (select distinct T31328."PER_NAME_MONTH" as c1,
case when T31328."DAY_OF_MONTH" <= 14 then 'F' else 'S' end as c2
from
"W_DAY_D" T31328 /* Dim_W_DAY_D_Common */
where ( T31328."PER_NAME_YEAR" = '2012' ) ),
SAWITH1 AS (select min(T31328."ROW_WID") as c1,
max(T31328."ROW_WID") as c2,
case when T31328."DAY_OF_MONTH" <= 14 then 'F' else 'S' end as c3
from
"W_DAY_D" T31328 /* Dim_W_DAY_D_Common */
where ( T31328."PER_NAME_YEAR" = '2012' )
group by case when T31328."DAY_OF_MONTH" <= 14 then 'F' else 'S' end )
select distinct SAWITH0.c1 as c1,
case when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c3 is not null then SAWITH1.c3 end as c2,
SAWITH1.c1 as c3,
SAWITH1.c2 as c4
from
SAWITH0 full outer join SAWITH1 On SAWITH0.c2 = SAWITH1.c3
Hope this helps, pls mark
Maybe you are looking for
-
Checkmarks in iTunes Podcasts list
In the iTunes Library, the Podcasts list has a checkmark column. What does the checkmark mean? I can't find an explanation anywhere. TIA for the information.
-
Re: Need help recover the Satellite A100-522
Dear All I have a notebook and when I turn on could not found operation system error apears. I wanted to revcovery, but when I want to do it preaze in the first step. Also I wanted to do installation with new XP but I cannot delete drive C and instal
-
Transfer Payload data to Screen
Dear All I have to retrieve a perticular value of a field (say MATNR) from an IDOC MATMAS which is in XI. I know that this value is stored in the payload of the message. By searching I have found that the payload is stored in SXMSCLUP TABLE. How can
-
How to efficiently import/export dozens of playlists?
I have a ton of play lists. I trade playlists with friends a lot, its a great way to get tips on new music to get and see what each other are playing. How can I efficently save lots of playlist and/or import them? Having to do it one playlist at a ti
-
Adobe 2.0 digital edition
I just download this edition for ebooks reading it was working fine at the first time , till i turn off my computer. It stopped working after I turn back on my computer. the window keep pops up says adobe 2.0 digital edition stop working windown is c