Need to display a group by month
i need to group my data by month, there are some dates that dont exist
i am using a date field but doenst contain every month.
i need to display jan, feb etc even if the date doesnt exist in the field
any ideas???
To actually make it useful you will need to join it to your original data set. Unfortunately, you probably don't have the "MonthNumber" anywhere in your original data set, making a direct link impossible... as it is now.
So to carry the example out into something useful... (again for SQL Server... And using the AdventureWorks sample database)
IF object_id('tempdb..#Temp') IS NOT NULL
BEGIN
DROP TABLE #Temp
END
CREATE TABLE #Temp (Number INT, MonthName VarChar(20))
INSERT INTO #Temp (Number, MonthName) Values (1, 'January')
WHILE (SELECT MAX(Number) FROM #Temp) < 12
BEGIN
INSERT INTO #Temp (Number, MonthName) SELECT MAX(Number)+1, DateName(mm,DateAdd(mm,MAX(Number),0)) FROM #Temp
END
SELECT
c.FirstName,
c.LastName,
c.ModifiedDate,
t.Number,
t.MonthName
FROM #Temp AS t
LEFT OUTER JOIN Person.Contact AS c
ON t.Number = DatePart(mm,c.ModifiedDate)
ORDER BY c.ModifiedDate
DROP TABLE #Temp
... which will produce results like this...
FirstName LastName ModifiedDate Number MonthName
David Wruck 1999-01-31 00:00:00.000 1 January
Candy Spoon 1999-01-31 00:00:00.000 1 January
Jane Parkinson 1999-01-31 00:00:00.000 1 January
Nuan Yu 1999-01-31 00:00:00.000 1 January
Bjorn Rettig 1999-02-01 00:00:00.000 2 February
Manoj Syamala 1999-02-01 00:00:00.000 2 February
William Vong 1999-02-01 00:00:00.000 2 February
Marie Reinhart 1999-02-01 00:00:00.000 2 February
Hope this helps,
Jason
Similar Messages
-
I need to display all the previous months sales.
Hi Gurus,
I have a requirement were i need to display all the previous months sales.
i.e if a user enters sept 2011, then in report it should display from April 2011(which is the first month of fiscal year).h
and also it should display total sales in another column till that month.
Regards
ArunHi,
Part 2 and Part 3 of the document.
Link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f002c608-2533-2c10-25a1-d0e7f7b5b662?QuickLink=index&overridelayout=true]
Link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10fc4382-afa6-2c10-1380-fa224fe4324f?QuickLink=index&overridelayout=true]
Documents by 'Surendra Kumar Reddy Koduru' are always useful. Try to go through all of them.
All the best!!! -
UPTO total need to display for every continue month
Hi All,
In one of my report I need two type of columns
1. Month wise total - Coming correctly
2. UPTO total- In this column I need to display total of all previous invoices upto month for that column displays for a particular Customer.
Example :-
Customer
Sep-12
Sep-11
Aug-12
Aug-11
UPTO-Sep-12
UPTO-Sep-11
UPTO Aug-12
ABC
10
12
15
13
UPTO Aug 12 + Sep 12
UP TO Aug11+sep11
UP TO Jul-12+aug12
As per above example I need a running sum but in horizontal way and as per customer and Month.
Please suggest how I can achieve this.
Thanks in advance
Ashok K GuptaHi,
I tried all three function of Time Series but all three are not giving appropriate result.
Thanks\
Ashok -
RE: Workbook need to display chart by diffrent material
Folks,
I have to create report which need to display chart( by material, month, and sales QTY). I know I can use workbook create chart but which only work for one or specific materials, I need to display many materials dynamically. if it need to create macro pls send to me some sample code.
Thanks,
SamHi Sam,
Please see the below code for the macro.
Sub Distinct_Material()
' Distinct_Material Macro
' Distinct_Material
Columns("E:F").Select
Range("E1:F142").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"H1"), Unique:=True
Columns("H:I").Select
Selection.Copy
Sheets("Name of the work book").Select
ActiveSheet.Paste
End Sub
I hope this will help you.
BR,
Praveen -
Conv. based on the month - Need to display the output in quarterly basis.
Hi Gurus,
I need to display the output quarterly based on the month.
For example,
If the year is 2012 and month is between
01 to 03 i need to display it as 2012Q1
likewise 04 to 06 as 2012q2
and 07 to 09 as 2012q3
and 10 to 12 as 2012q4.
Please help me by providing sample codes. Please help yourself by writing the code and get back when you have a specific question.
Thanks!
Regards,
Manoj
Edited by: kishan P on Mar 2, 2012 3:14 PMHi Vinod
To get the last 13 months in webi report .follow below approach
Assuming you have calendar Month object in the report.
convert your selected date into M/d/yy format . let's say you selected 12/18/13 , your variable should be 12/1/13
variable :
Selected Month =ToDate(FormatDate(useresponse("Date");"Mmm yyyy");"Mmm yyyy")
Flag for month =ToDate([CalMonth];"Mmm yyyy")<=[Selected Month]
Report filter =[Flag for month]+Previous(Self)
select the table you want to filter
add filter -> Report filter between 1 to 13.
Hope this will help. -
Need to display data from one group while in another repeating group
I have a repeating group in my .rft file which displays line level data that has a quote number in it.
At the end of this repeating group I need to display the total for the quote number but these values are in another group that's within a differnt group higher up in the XML tree. Both of the groups have quote number so there is a link between the two. How do I do this? When I add the "higher up" repeating group within the current group I can't get any data to show. Any help would be appreciated.
Kind RegardsHere's the data, I do know how to to move up the tree like a file system but I think my problem is I need to move up the tree and repeat based on the value (quote number) of the lower node.
For instance for each quote number in repeating group G_FORX_OPS_QTE_ORDER_LINES loop through the occurances of same quote number in G_OPPCAT_BREAKDOWN so I can get a total of the fields by quote number
This is overly simplified but it would be like this
<?for-each-group:G_FORX_OPS_QTE_ORDER_LINES;QUOTE_NUMBER?>
quote number 1428
various line level data....
various line level data....
etc....
-- Open loop to get data from other group (Only get data for quote 1428!!)
<?for-each-group:/FORX_AS_OPPOR/LIST_G_OPPORTUNITY_SHEET/G_OPPORTUNITY_ID/LIST_G_OPPCAT_BREAKDOWN/G_OPPCAT_BREAKDOWN;./QUOTE_NUMBER1?>
Total For Quote 1428
Billing Class
BILLABLE: Billable total in dollars
INTERNAL: Internal total in dollars
<?end for-each-group?>
<!-- Generated by Oracle Reports version 6.0.8.26.0
-->
- <FORX_AS_OPPOR>
- <LIST_G_OPPORTUNITY_SHEET>
- <G_OPPORTUNITY_ID>
<COMMENTS1>Opportunity Includes Quote Number(s): 1428-2 1443-1 1444-1 Order Number(s): 159038-10 159044-3</COMMENTS1>
<CUSTOMER_ID>1183</CUSTOMER_ID>
<UPDATED_BY>CTYNER</UPDATED_BY>
<DEPOSITS>5704.68</DEPOSITS>
<OPPORTUNITY_ID>1000216</OPPORTUNITY_ID>
<OPPORTUNITY_NAME>1000216:UAT DEMO</OPPORTUNITY_NAME>
<CUSTOMER_NUMBER>103736</CUSTOMER_NUMBER>
<ENTITY>FSG</ENTITY>
<SOLD_TO>ALLSTATE INSURANCE COMPANY</SOLD_TO>
<CONTRACT_ID>S620_N</CONTRACT_ID>
<SALESREP_ID>2239</SALESREP_ID>
<SALES_REP_NAME>Conley, Michael</SALES_REP_NAME>
<ORDER_ACCEPTANCE>Skokie</ORDER_ACCEPTANCE>
<BOOKED_COUNT>2</BOOKED_COUNT>
<TERRITORY_NAME>Enterprise - Enterprise</TERRITORY_NAME>
- <LIST_G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1428</QUOTE_NUMBER1> First Occurence of 1428
<INT_ITM_TYPES>HARDWARE</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>BILLABLE</INT_BILLING_CLASS>
<SUM_ITM_COUNT>5</SUM_ITM_COUNT>
<SUM_ITM_PRICE>151500.4</SUM_ITM_PRICE>
<SUM_ITM_COST>1688</SUM_ITM_COST>
<SUM_ITM_GPM>149812.4</SUM_ITM_GPM>
<SUM_ITM_MARKUP>88.7514218009478672985781990521327014218</SUM_ITM_MARKUP>
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1428</QUOTE_NUMBER1> Second Occurence of 1428
<INT_ITM_TYPES>INVOICE_ADJUSTMENT</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>BILLABLE</INT_BILLING_CLASS>
<SUM_ITM_COUNT>4</SUM_ITM_COUNT>
<SUM_ITM_PRICE>29.72</SUM_ITM_PRICE>
<SUM_ITM_COST>0</SUM_ITM_COST>
<SUM_ITM_GPM>29.72</SUM_ITM_GPM>
<SUM_ITM_MARKUP />
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1443</QUOTE_NUMBER1>
<INT_ITM_TYPES>HARDWARE</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>BILLABLE</INT_BILLING_CLASS>
<SUM_ITM_COUNT>5</SUM_ITM_COUNT>
<SUM_ITM_PRICE>2084</SUM_ITM_PRICE>
<SUM_ITM_COST>1748</SUM_ITM_COST>
<SUM_ITM_GPM>336</SUM_ITM_GPM>
<SUM_ITM_MARKUP>.192219679633867276887871853546910755149</SUM_ITM_MARKUP>
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1444</QUOTE_NUMBER1>
<INT_ITM_TYPES>HARDWARE</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>BILLABLE</INT_BILLING_CLASS>
<SUM_ITM_COUNT>4</SUM_ITM_COUNT>
<SUM_ITM_PRICE>1500.4</SUM_ITM_PRICE>
<SUM_ITM_COST>1364</SUM_ITM_COST>
<SUM_ITM_GPM>136.4</SUM_ITM_GPM>
<SUM_ITM_MARKUP>.1</SUM_ITM_MARKUP>
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1444</QUOTE_NUMBER1>
<INT_ITM_TYPES>INVOICE_ADJUSTMENT</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>BILLABLE</INT_BILLING_CLASS>
<SUM_ITM_COUNT>4</SUM_ITM_COUNT>
<SUM_ITM_PRICE>66.28</SUM_ITM_PRICE>
<SUM_ITM_COST>0</SUM_ITM_COST>
<SUM_ITM_GPM>66.28</SUM_ITM_GPM>
<SUM_ITM_MARKUP />
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1428</QUOTE_NUMBER1>
<INT_ITM_TYPES>EXPENSE_ADJUSTMENT</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>INTERNAL</INT_BILLING_CLASS>
<SUM_ITM_COUNT>1</SUM_ITM_COUNT>
<SUM_ITM_PRICE>0</SUM_ITM_PRICE>
<SUM_ITM_COST>22.98</SUM_ITM_COST>
<SUM_ITM_GPM />
<SUM_ITM_MARKUP />
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1444</QUOTE_NUMBER1>
<INT_ITM_TYPES>EXPENSE_ADJUSTMENT</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>INTERNAL</INT_BILLING_CLASS>
<SUM_ITM_COUNT>1</SUM_ITM_COUNT>
<SUM_ITM_PRICE>0</SUM_ITM_PRICE>
<SUM_ITM_COST>22.98</SUM_ITM_COST>
<SUM_ITM_GPM />
<SUM_ITM_MARKUP />
</G_OPPCAT_BREAKDOWN>
- <G_OPPCAT_BREAKDOWN>
<QUOTE_NUMBER1>1428</QUOTE_NUMBER1>
<INT_ITM_TYPES>REVENUE_ADJUSTMENT</INT_ITM_TYPES>
<OPPORTUNITY_ID3>1000216</OPPORTUNITY_ID3>
<INT_BILLING_CLASS>INTERNAL</INT_BILLING_CLASS>
<SUM_ITM_COUNT>1</SUM_ITM_COUNT>
<SUM_ITM_PRICE>20</SUM_ITM_PRICE>
<SUM_ITM_COST>101</SUM_ITM_COST>
<SUM_ITM_GPM />
<SUM_ITM_MARKUP />
</G_OPPCAT_BREAKDOWN>
</LIST_G_OPPCAT_BREAKDOWN>
- <LIST_G_FORX_OPS_QTE_ORDER_LINES>
- <G_FORX_OPS_QTE_ORDER_LINES>
<ORDER_ACCEPTANCE1>SKOKIE</ORDER_ACCEPTANCE1>
<COMMITMENT />
<COMMITMENT_APPLIED_AMOUNT />
<PARTIAL_COMMENTS />
<COMMENT_FOR_INVOICE />
<QUOTE_DATE>07/13/2009 02:00:10PM</QUOTE_DATE>
<LINE_NUMBER>1</LINE_NUMBER>
<EXTD_SELLING_PRICE>880</EXTD_SELLING_PRICE>
<ORDER_PAY_TERM>Automated Term Due in 44 Days</ORDER_PAY_TERM>
<QUOTE_PAY_TERM />
<ITEM_CATEGORIES>HARDWARE.MACHINE.SERVER.</ITEM_CATEGORIES>
<QUOTE_STATUS>Order Submitted</QUOTE_STATUS>
<QUOTE_USER>Tyner, Chris</QUOTE_USER>
<OPPORTUNITY_ID1>1000216</OPPORTUNITY_ID1>
<DATASOURCE>1</DATASOURCE>
<HEADER_ID>398631</HEADER_ID>
<LINE_ID>900897</LINE_ID>
<LINE_TYPE_ID>1181</LINE_TYPE_ID>
<ORDER_NUMBER>159038</ORDER_NUMBER>
<ORDER_VERSION>10</ORDER_VERSION>
<TEAM>IBM</TEAM>
<OPPORTUNITY_NAME1 />
<QUOTE_NAME>1000216:IBM:UAT DEMO</QUOTE_NAME>
<QUOTE_NUMBER>1428</QUOTE_NUMBER>
<QUOTE_VERSION>2</QUOTE_VERSION>
<NEW_PARTIAL>0</NEW_PARTIAL>
<COMMIT_DEL_DATE>13-JUL-09</COMMIT_DEL_DATE>
<ORDERED_QUANTITY>1</ORDERED_QUANTITY>
<PO_NUMBER>098534089</PO_NUMBER>
<GROUP_NUM>1</GROUP_NUM>
<INVENTORY_ITEM_ID>845256</INVENTORY_ITEM_ID>
<ORDERED_ITEM>7978BDU</ORDERED_ITEM>
<PRODUCT>7978BDU</PRODUCT>
<ITEM_DESCRIPTION>X3550, XEON QUAD CORE E5430 80W 2.66GHZ/1333MHZ/12MB L2, 2X1GB CHK, O/BAY 2.5IN HS SAS, SR 8K-I, PCI-E RISER CARD, ULTRABAY ENHANCED DVD-ROM/CD-RW COMBO DRIVE, 670W P/S, RACK</ITEM_DESCRIPTION>
<MANUFACTURER_DESCRIPTION>IBM</MANUFACTURER_DESCRIPTION>
<TYPE />
<EQUIPMENT_CODE>B</EQUIPMENT_CODE>
<TAX_CLASS_CODE>HW</TAX_CLASS_CODE>
<CLS />
<SUBINVENTORY />
<UNIT_LIST_PRICE>0</UNIT_LIST_PRICE>
<ITEM_UNIT_COST>800</ITEM_UNIT_COST>
<VENDOR_INVENTORY_RETURN />
<SHIPPING_TYPE />
<SHIPPING_ORG>DSP</SHIPPING_ORG>
<SOLD_TO1>ALLSTATE INSURANCE COMPANY</SOLD_TO1>
<SOLD_TO_ACCOUNT_NUMBER>103736</SOLD_TO_ACCOUNT_NUMBER>
<INVOICE_TO_LOCATION>10110384</INVOICE_TO_LOCATION>
<INVOICE_TO>ALLSTATE INSURANCE COMPANY</INVOICE_TO>
<INVOICE_TO_ACCOUNT_NUMBER>103736</INVOICE_TO_ACCOUNT_NUMBER>
<INVOICE_TO_ADDRESS1>2775 SANDERS RD</INVOICE_TO_ADDRESS1>
<INVOICE_TO_ADDRESS2 />
<INVOICE_TO_ADDRESS3 />
<INVOICE_TO_ADDRESS4 />
<INVOICE_TO_EMAIL />
<INVOICE_TO_PHONE_NUMBER>847-402-0223</INVOICE_TO_PHONE_NUMBER>
<INVOICE_TO_ADDRESS5>NORTHBROOK, IL, 60062-6110, US</INVOICE_TO_ADDRESS5>
<INVOICE_TO_CONTACT>CRAIG SOCKEL</INVOICE_TO_CONTACT>
<L_INVOICE_TO_LOCATION>10110384</L_INVOICE_TO_LOCATION>
<L_INVOICE_TO_ACCOUNT_NUMBER>103736</L_INVOICE_TO_ACCOUNT_NUMBER>
<L_INVOICE_TO>ALLSTATE INSURANCE COMPANY</L_INVOICE_TO>
<L_INVOICE_TO_ADDRESS1>2775 SANDERS RD</L_INVOICE_TO_ADDRESS1>
<L_INVOICE_TO_ADDRESS2 />
<L_INVOICE_TO_ADDRESS3 />
<L_INVOICE_TO_ADDRESS4 />
<L_INVOICE_TO_EMAIL />
<L_INVOICE_TO_PHONE_NUMBER>847-402-0223</L_INVOICE_TO_PHONE_NUMBER>
<L_INVOICE_TO_ADDRESS5>NORTHBROOK, IL, 60062-6110, US</L_INVOICE_TO_ADDRESS5>
<L_INVOICE_TO_CONTACT>CRAIG SOCKEL</L_INVOICE_TO_CONTACT>
<SHIP_TO_ACCOUNT_NUMBER>103736</SHIP_TO_ACCOUNT_NUMBER>
<SHIP_TO>ALLSTATE INSURANCE COMPANY</SHIP_TO>
<SHIP_TO_LOCATION>10271260</SHIP_TO_LOCATION>
<SHIP_TO_ADDRESS1>3075 SANDERS RD STE 12C</SHIP_TO_ADDRESS1>
<SHIP_TO_ADDRESS2 />
<SHIP_TO_ADDRESS3 />
<SHIP_TO_ADDRESS4 />
<SHIP_TO_ADDRESS>NORTHBROOK, IL, 60062-7119, US</SHIP_TO_ADDRESS>
<SHIP_EMAIL>[email protected]</SHIP_EMAIL>
<SHIP_TO_PHONE_NUMBER>847-402-0223</SHIP_TO_PHONE_NUMBER>
<SHIP_TO_CONTACT>ORLANDO LOPEZ</SHIP_TO_CONTACT>
<L_SHIP_TO_ACCOUNT_NUMBER>103736</L_SHIP_TO_ACCOUNT_NUMBER>
<L_SHIP_TO>ALLSTATE INSURANCE COMPANY</L_SHIP_TO>
<L_SHIP_TO_LOCATION>10271260</L_SHIP_TO_LOCATION>
<L_SHIP_TO_ADDRESS1>3075 SANDERS RD STE 12C</L_SHIP_TO_ADDRESS1>
<L_SHIP_TO_ADDRESS2 />
<L_SHIP_TO_ADDRESS3 />
<L_SHIP_TO_ADDRESS4 />
<L_SHIP_TO_ADDRESS>NORTHBROOK, IL, 60062-7119, US</L_SHIP_TO_ADDRESS>
<L_SHIP_EMAIL>[email protected]</L_SHIP_EMAIL>
<L_SHIP_TO_PHONE_NUMBER>847-402-0223</L_SHIP_TO_PHONE_NUMBER>
<L_SHIP_TO_CONTACT>ORLANDO LOPEZ</L_SHIP_TO_CONTACT>
<DEL_TO_ACCOUNT_NUMBER>103736</DEL_TO_ACCOUNT_NUMBER>
<DEL_TO>ALLSTATE INSURANCE COMPANY</DEL_TO>
<DEL_TO_LOCATION>10110327</DEL_TO_LOCATION>
<DEL_TO_ADDRESS1>3075 SANDERS RD</DEL_TO_ADDRESS1>
<DEL_TO_ADDRESS2 />
<DEL_TO_ADDRESS3 />
<DEL_TO_ADDRESS4 />
<DEL_TO_ADDRESS>NORTHBROOK, IL, 60062-7119, US</DEL_TO_ADDRESS>
<DEL_TO_EMAIL />
<DEL_TO_PHONE_NUMBER>847-402-0223</DEL_TO_PHONE_NUMBER>
<DEL_TO_CONTACT />
<UNIT_SELLING_PRICE>880</UNIT_SELLING_PRICE>
<BILL_TO_LAST_UPDATE>21/04/2009 02:25:18PM</BILL_TO_LAST_UPDATE>
<SHIP_TO_LAST_UPDATE>13/07/2009 01:31:45PM</SHIP_TO_LAST_UPDATE>
<BILL_TO_UPDATED_BY>SLUMPP</BILL_TO_UPDATED_BY>
<SHIP_TO_UPDATED_BY>CTYNER</SHIP_TO_UPDATED_BY>
<ORDER_QUOTE_USER>CTYNER</ORDER_QUOTE_USER>
<PARTICIPANTS>Conley, Michael Order:159044 100% and Conley, Michael Order:159038 100% and Conley, Michael Quote:1443 50% and Jones, Maureen Quote:1443 50%</PARTICIPANTS>
<ORDERED_DATE>07/13/2009 02:23:23PM</ORDERED_DATE>
<BOOKED_DATE>07/13/2009 02:31:15PM</BOOKED_DATE>
<ORDER_QUOTE_STATUS>BOOKED</ORDER_QUOTE_STATUS>
<ORDER_USER_STATUS>RE-BOOK REQD</ORDER_USER_STATUS>
<BUYER>Tyner, Chris</BUYER>
<SERIAL_NUM>45784687</SERIAL_NUM>
<INVOICE_HANDLING_FORMAT_VALUE />
<INVOICE_HANDLING_FORMAT />
<PRINT_TRADE_NAME_VALUE>No</PRINT_TRADE_NAME_VALUE>
<ITEM_EXTD_COST>800</ITEM_EXTD_COST>
<QUOTE_APPROVERS>Tyner, Chris</QUOTE_APPROVERS>
</G_FORX_OPS_QTE_ORDER_LINES> -
Need to display records only once for that particular group
Hi,
I have a requirement like displaying repeated records only once for that particular group.
For eg, in the emp table, I need to display repeated deptno only once for the particular group of job.
And for the above requirement I have used the below query,
SELECT empno, DECODE (LAG (job, 1) OVER (ORDER BY job), job, NULL, job),
DECODE (LAG (deptno, 1) OVER (ORDER BY deptno), deptno, NULL, deptno)
FROM emp;
Output:
EMPNO JOB DEPTNO
7782 10
7934 CLERK
7839 PRESIDENT
7876 20
7788
7902 ANALYST
7566 MANAGER
7844 30
7900
7654 SALESMAN
7698
But in the above output you can find that, say deptno 10 is getting displayed only once, whereas I want that deptno 10 to be checked whether it is getting repeated within the group of JOB and than hide the deptno 10 only if it is repeated within that job group. If not, deptno 10 should be displayed again.
Please help me in this.
Regards,
ShivaHi,
Hope the below helps.
SELECT emp_id, job, deptno,
CASE WHEN LAG(deptno, 1) OVER (partition by job order by deptno) = deptno THEN null else deptno end
FROM empRegards
Ameya -
I need to display the date of every month 1st
Hi All,
I need to display the date from 01/01/2007 to 09/01/2008.
example like this
01/01/2007
02/01/2007
03/01/2007
01/01/2008
02/01/2008
09/01/2008
could u pls help me
thanks,
Dharma.This should give you something to work with:
SQL> SELECT ADD_MONTHS(TO_DATE('01/01/2007','MM/DD/YYYY'),LEVEL-1) AS months from dual connect by level <= 21;
MONTHS
01/01/2007 00:00:00
02/01/2007 00:00:00
03/01/2007 00:00:00
04/01/2007 00:00:00
05/01/2007 00:00:00
06/01/2007 00:00:00
07/01/2007 00:00:00
08/01/2007 00:00:00
09/01/2007 00:00:00
10/01/2007 00:00:00
11/01/2007 00:00:00
12/01/2007 00:00:00
01/01/2008 00:00:00
02/01/2008 00:00:00
03/01/2008 00:00:00
04/01/2008 00:00:00
05/01/2008 00:00:00
06/01/2008 00:00:00
07/01/2008 00:00:00
08/01/2008 00:00:00
09/01/2008 00:00:00
21 rows selected.Hope this helps! -
Variable (Perhaps replacement Path) to group past months together
Hello.
I'm trying to perform a query that would group past months data within the current month to aggregate my Key Figures.
As an example, I have in my InfoCube:
- Material
- CalendarMonth
- Initial Qty (Key Figure)
- Added Qty (Key Figure)
- Substracted Qty (Key Figure)
I'd like to get something like my materials on rows, CalendarMonth on column with my 3 Key Figures on rows as well. The only thing is that all data pertaining to months prior to "Right now (i.e. August 08)" should be aggregated in August 08, therefore, my first month of data displayed would be August and not January 08 if I have data in this month.
This might be very basic to you experts out there but I'm pretty new to the nice BW world and can't figure how to do it. Any help would be appreciated.
Thank you.
P.s. I can't find anywhere (except for the small hints on the right when posting a new thread) how I can format my post as I'd like to put TABS and space but they're getting removed in the preview, is there anywhere the list of ALL possible codes I can use when posting ?August 08 September 08 October 08 November 08 December 08 January 09 February 09 March 09
MATERIAL-1 Initial Qty 20,000
Added Qty 5,000 8,000 2,000 2,500 3,000
Subst. Qty 2,000 6,500 15,000 2,800 6,400 5,000
Total 20,000 23,000 16,500 24,500 11,500 11,200 4,800 2,800
MATERIAL-2 Initial Qty u2026 u2026 u2026 u2026 u2026 u2026 u2026 u2026
Added Qty u2026 u2026 u2026 u2026 u2026 u2026 u2026 u2026
Subst. Qty u2026 u2026 u2026 u2026 u2026 u2026 u2026 u2026
Total u2026 u2026 u2026 u2026 u2026 u2026 u2026 u2026
Ok, I've finally been able to manage a "similar" output to what I'm trying to achieve. The total line would actually be a calculated key figure based on the three others. So in the example above, user as specified March 2009 to be the end calendar period he wants to see the inventory "estimates". All data prior August 2008 should be shown in August 2008 in their respective Key Figures and then the "Total" would adjust accordingly. So to answer your question, yes, the same logic need to apply to all 3 Key Figures. -
I need to display a month-by-month record of several indicators. The data is entered in daily, and I need to do basic things like average, sum, compare to target, etc. I've got a couple of views that simplify the data down to an organization, a date, and a value to ease the UNIONs. Now what I'm struggling with is the grouping of values. I've seen some posts that suggest using TRUNC(my_date,'MM') as a grouping method. My concern is: if the data spans multiple years, won't that grab data from the same months but different years?
Just looking for a little confirmation. If that works, it's and easy solution. If not, can someone suggest a way to group based on both year and date in the same statement? I am trying to pivot/aggregate the information based on date to display for more than a dozen indicators, so I'll be using a CASE statement for the values, thus the need for a single evaluation criteria.
Here's a sample:
select 'C3' as SECTION, '<strong># of Audits</strong>' as HEADING, NULL as OWNER,
NVL (SUM (CASE WHEN TRUNC(DATE_INDEX,'MM') = TRUNC(to_date((:P3_DATE_START,'MM/DD/YYYY'),'MM')
THEN VALUE END),0) AS MON1,
NVL (SUM (CASE WHEN TRUNC(DATE_INDEX,'MM')+1 = TRUNC(to_date((:P3_DATE_START,'MM/DD/YYYY'),'MM')+1
THEN VALUE END),0) AS MON2,
from V_VF_SAFETY_AUDITS
where ORG_ID = :P3_ORG_ID
group by 'C3', '<strong># of Audits</strong>', NULL
union
...Hi,
blarman74 wrote:
... I've seen some posts that suggest using TRUNC(my_date,'MM') as a grouping method. My concern is: if the data spans multiple years, won't that grab data from the same months but different years?Exactly, it will grab data from different years and put them into different groups.
TRUNC (my_date, 'MM') will return the first DATE in the same month as my_date. For example, if my_date is
27-Apr-2009 17:50:03, then TRUNC(my_date, 'MM') will return
01-Apr-2009 00:00:00.
Did you try it in your query? Did it not do what you wanted?
If you want to put everything from the month of April 2009 in the same group with April 2008 (and April 2007, and ...) then use TO_CHAR instead of TRUNC: "GROUP BY TO_CHAR (my_date, 'MM')"
If you need help, post some sample data (that does not work with your existing query, modified to include TRUNC or TO_CHAR) and the correct results you want from that data. -
Group by month, and also show months with no records
hi - having a major mental block this morning, pretty sure this is an easy one so just need one of you expert types to point me in the right direction..
Using the sample data below, I just need to generate a report to show userid, mon-yy, count of transactions. I need to show the full 12 months, so with a zero if there's no transactions.
I'm not sure if this is the right approach but I'm using a subquery to generate the 12 months, as obvisouly they're not in the transaction data. The fact I have to to_char against the subquery kind of set alarm bells ringing though, I think there's a better solution but as I say, mental block.
The query at the end was to show the subquery thing works, but for the life of me I can't think today how to extend this to include the userid and give me the desired result (bottom code block).
Frustrating when this should be relatively simple!?!
thanks in advance all :o)
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
create table trans (pkid number, userid number, transdate date);
insert into trans values (1, 10, sysdate-300);
insert into trans values (2, 10, sysdate-100);
insert into trans values (3, 20, sysdate-100);
insert into trans values (4, 20, sysdate-50);
insert into trans values (5, 20, sysdate-20);
commit;
select * from trans;
PKID USERID TRANSDATE
1 10 05-AUG-10
2 10 21-FEB-11
3 20 21-FEB-11
4 20 12-APR-11
5 20 12-MAY-11
select sub.mon, count(t.transdate) from trans t,
(select to_char(add_months(sysdate, -level),'MON-YY') as mon
from dual
connect by level <=12) sub
where sub.mon = to_char(transdate(+),'MON-YY')
group by sub.mon
order by to_date(sub.mon,'MON-YY')
MON COUNT(T.TRANSDATE)
JUN-10 0
JUL-10 0
AUG-10 1
SEP-10 0
OCT-10 0
NOV-10 0
DEC-10 0
JAN-11 0
FEB-11 2
MAR-11 0
APR-11 1
MAY-11 1
12 rows selected.Desired:
10 JUN-10 0
10 JUL-10 0
10 AUG-10 1
...and so on until...
10 MAY-11 0
20 JUN-10 0
20 JUL-10 0
20 AUG-10 0
...and so on until...
20 FEB-11 1
20 MAR-11 0
20 APR-11 1
20 MAY-11 1Hi,
That's what a Partitioned Outer Join does:
select sub.mon
, count (t.transdate)
from (
select to_char ( add_months (sysdate, -level)
, 'MON-YY'
) as mon
from dual
connect by level <= 12
) sub
left outer join trans t PARTITION BY (t.userid)
ON sub.mon = to_char (transdate,'MON-YY')
group by t.userid
, sub.mon
order by t.userid
, to_date (sub.mon,'MON-YY')
;A regular outer join guarantees that you'll get each row from the driving table displayed at least once. But you want each row from sub displayed n times, where n is the number of distinct userids found in t. "PARTITION BY t.userid" means "treat each distinct value of userid as a separate table", and the results will all be UNIONed together.
Partitioned outer joins were new in Oracle 10. Before that, you had to form a result set of the distinct values of userid, then cross-join that with the distinct months from sub, and finally outer-join that to the real data. -
News articles grouped by month and year
PHP and MySQL...
Don't know if I am going to get an answer here, but I am looking for a bit of advice on how to handle grouping of news articles into months and each then into the respective year to make it easier for the user to navigate content. I am trying to acheive this effect:
2012
- July
- June
- March
- January
2011
- December
- October
- April
2010
- November
- You get the idea I hope
I have set up MySQL to use a 'date' field called fld_articledate (formatted as YYYY-MM-DD). I need to structure my recordset query to select by year and group it, but then I also need to group by month relative to that year, but I have no idea of where to begin. So I guess my question is two-part:
How do I group by year?
How do I then group by month of that year?
Once I have my queries sorted, I assume I'd print to page with repeat and nested repeat regions!
Thanks.
MatPHP and MySQL both have a lot of built in functions for working with dates.
Here is a little code example from one of my projects that is similar to what you want to do. this example uses PDO, but the query is the same if you are using the older mysql extension. the last line builds an array of the result. You may not need this.Also note that the month and year are returned from the query using aliases (month, year); They could just as well be called "mymonth' and myyear, etc. The second to the last like formats the result for display.
$sql=$dbh->prepare("SELECT DISTINCT EXTRACT(YEAR FROM(startdate)) AS year, EXTRACT(MONTH FROM (startdate)) as month FROM courses WHERE startdate > $currentdate order by startdate");
$sql->execute();
while ($monthorder = $sql->fetch(PDO::FETCH_ASSOC)){
$month = $monthorder['month'];
$year = $monthorder['year'];
$monthtext = date('F Y', mktime(0,0,0,$month,1,$year));
$monthlist[]=array('month'=>$month, 'year'=>$year);
Since you want to link to articles, you then need a second query that will retrieve those details based on whatever month is selected. something like this:
("SELECT courses.course_id, title, startdate, enddate, highlight_photo FROM courses WHERE startdate > '$currentdate' AND EXTRACT(YEAR FROM (startdate)) = '$year' AND EXTRACT(MONTH FROM (startdate)) = '$month' ORDER BY startdate") -
Displaying Two groups of data side by side
We are using XML Publisher 5.6.2. We have a requirement where we need to display two independent groups side by side.
What we tried was, we had a single table, on which on the same row, we defined the first group ( for-each:group1)<?Col1?><end-each>, in a single cell as part of three different form fields and then in the second column, we started the next group.
But when we ran the report, the second group does not get dsiplayed. The workaround we have to use is that define the second group in a seperate row than the first group. This displayed the data for both the groups.
The issue is that, if Group1 has 10 rows, then my second group will be pushed down.
Has anybody had this issue and if there is a resolution, please let us know.
Thanks,
- Vasu K -hi this is mohan,
I would Like to display the data in single table. i have 10 groups when i m trying the columns becoming null. when i m taking it in diff tables its working fine but my client is not satisfied with that is there any solution for this making it in one table.
Regards&Thanks
Mohan.katepalli
Path Infotech Limited -
ALV-Need to display total in top/first line!!!
Hi,
i have 3 numerical fields in my ALV output. I need to display the total in top/first line in output and download the same in excel into local system.if possible send me the sample code to how to do it.
Regards,
Nandha.TABLES : BSEG , BKPF.
TABLES: SSCRFIELDS.
TABLES: ITCPO.
DATA :FLAG TYPE I, MAINTAIN TYPE I,
FLAG1 TYPE I,
FLAG2 TYPE I,
FLAG3 TYPE I.
DATA :BEGIN OF ITAB_BKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
BELNR LIKE BKPF-BELNR,
BLART LIKE BKPF-BLART,
BUDAT LIKE BKPF-BUDAT,
END OF ITAB_BKPF.
DATA :BEGIN OF ITAB_BSEG OCCURS 0,
BUKRS LIKE BSEG-BUKRS,
GJAHR LIKE BSEG-GJAHR,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
BSCHL LIKE BSEG-BSCHL,
HKONT LIKE BSEG-HKONT,
DMBTR LIKE BSEG-DMBTR,
MWSKZ LIKE BSEG-MWSKZ,
ZUONR LIKE BSEG-ZUONR,
KOSTL LIKE BSEG-KOSTL,
FISTL LIKE BSEG-FISTL,
FIPOS LIKE BSEG-FIPOS,
SGTXT LIKE BSEG-SGTXT,
END OF ITAB_BSEG.
DATA BEGIN OF ITAB_BKPF_BSEG OCCURS 0.
INCLUDE STRUCTURE ZBKPF_BSEG.
DATA END OF ITAB_BKPF_BSEG.
*DATA ITAB_BKPF_BSEG LIKE TABLE OF ZITAB_BKPF_BSEG WITH HEADER LINE.
DATA i_print LIKE TABLE OF ITCPO WITH HEADER LINE.
TYPE-POOLS : SLIS , kkblo.
DATA:TEXT2(30) VALUE 'Voucher Print',
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
CT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
WA_SUBT LIKE SLIS_EV_SUBTOTAL_TEXT,
WA_I_EVENT TYPE SLIS_ALV_EVENT,
TEMP_CAT TYPE SLIS_FIELDCAT_ALV
DATA : TEXT2538(16) VALUE 'Voucher Printing'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_BUKRS LIKE BKPF-BUKRS OBLIGATORY.
"Company code
SELECT-OPTIONS : S_BELNR FOR BKPF-BELNR MODIF ID M01.
"Accounting Doc No
PARAMETERS: P_GJAHR LIKE BKPF-GJAHR MODIF ID M02.
"Fiscal year
SELECT-OPTIONS: S_BLART FOR BKPF-BLART MODIF ID M03,
"Document type
S_BUDAT FOR BKPF-BUDAT MODIF ID M04.
"Posting date
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
IF S_BELNR IS NOT INITIAL.
FLAG = 1.
ENDIF.
IF S_BLART IS NOT INITIAL.
FLAG1 = 1.
ENDIF.
IF P_GJAHR IS NOT INITIAL.
FLAG2 = 1.
ENDIF.
IF S_BUDAT IS NOT INITIAL.
FLAG3 = 1.
ENDIF.
SELECT
BUKRS
GJAHR
BELNR
INTO CORRESPONDING FIELDS OF TABLE ITAB_BKPF
FROM BKPF
WHERE BUKRS EQ P_BUKRS
IF SY-SUBRC NE 0.
MESSAGE E000(ZPROJ).
ENDIF.
IF FLAG NE 0.
DELETE ITAB_BKPF WHERE
NOT ( BELNR IN S_BELNR AND GJAHR EQ P_GJAHR )
ENDIF.
IF FLAG1 NE 0.
DELETE ITAB_BKPF WHERE
NOT ( BLART IN S_BLART AND BUDAT IN S_BUDAT )
ENDIF.
IF FLAG2 NE 0.
DELETE ITAB_BKPF WHERE
NOT ( GJAHR EQ P_GJAHR )
ENDIF.
IF FLAG3 NE 0.
DELETE ITAB_BKPF WHERE
NOT ( BUDAT IN S_BUDAT )
ENDIF.
SELECT
BUKRS
GJAHR
BELNR
BUZEI
BSCHL
HKONT
DMBTR
MWSKZ
ZUONR
KOSTL
FISTL
FIPOS
SGTXT
FROM BSEG
INTO TABLE ITAB_BSEG
FOR ALL ENTRIES IN ITAB_BKPF
WHERE
BUKRS EQ P_BUKRS AND
BELNR EQ ITAB_BKPF-BELNR AND
GJAHR EQ ITAB_BKPF-GJAHR
LOOP AT ITAB_BKPF.
LOOP AT ITAB_BSEG WHERE BUKRS EQ ITAB_BKPF-BUKRS AND
BELNR EQ ITAB_BKPF-BELNR AND
GJAHR EQ ITAB_BKPF-GJAHR.
MOVE-CORRESPONDING ITAB_BSEG TO ITAB_BKPF_BSEG.
* MOVE-CORRESPONDING ITAB_BKPF TO ITAB_BKPF_BSEG.
APPEND ITAB_BKPF_BSEG.
ENDLOOP.
ENDLOOP.
LOOP AT ITAB_BKPF_BSEG.
ITAB_BKPF_BSEG-ZMENG = ITAB_BKPF_BSEG-DMBTR.
MODIFY ITAB_BKPF_BSEG TRANSPORTING zmeng.
ENDLOOP.
PERFORM CHANGE_CATALOG.
PERFORM ALV_DISPLAY.
FORM CHANGE_CATALOG .
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'BUKRS'.
TEMP_CAT-SELTEXT_L = 'Company Code'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 30.
TEMP_CAT-HOTSPOT = 'X'.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'BELNR'.
TEMP_CAT-SELTEXT_L = 'Document No.'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-HOTSPOT = 'X'.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'GJAHR'.
TEMP_CAT-SELTEXT_L = 'Fiscal Year'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
TEMP_CAT-HOTSPOT = 'X'.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'BUZEI'.
TEMP_CAT-SELTEXT_L = 'Item'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 5.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'BSCHL'.
TEMP_CAT-SELTEXT_L = 'Posting Key'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'HKONT'.
TEMP_CAT-SELTEXT_L = 'Account'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'DMBTR'.
TEMP_CAT-SELTEXT_L = 'Amount'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
TEMP_CAT-DO_SUM = 'X'.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'MWSKZ'.
TEMP_CAT-SELTEXT_L = 'Tax'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'ZUONR'.
TEMP_CAT-SELTEXT_L = 'Assignment'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'KOSTL'.
TEMP_CAT-SELTEXT_L = 'Cost Center'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'FISTL'.
TEMP_CAT-SELTEXT_L = 'Fund Center'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'FIPOS'.
TEMP_CAT-SELTEXT_L = 'Commitment Item'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
CLEAR TEMP_CAT.
TEMP_CAT-FIELDNAME = 'SGTXT'.
TEMP_CAT-SELTEXT_L = 'Text'.
TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
TEMP_CAT-DDICTXT = 'L'.
TEMP_CAT-OUTPUTLEN = 15.
APPEND TEMP_CAT TO CT_FIELDCAT.
GS_LAYOUT-ZEBRA = 'X'.
<b>GS_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.</b>
data : text like slis_ev_subtotal_text value 'total'.
gs_layout-subtotals_text = text.
*gs_layout-totals_only = 'X'.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'BUKRS'.
WA_SORT-SPOS = 1.
WA_SORT-UP = 'X'.
*wa_sort-group = '*'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'BELNR'.
WA_SORT-SPOS = 2.
WA_SORT-SUBTOT = 'X'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'GJAHR'.
WA_SORT-SPOS = 3.
WA_SORT-SUBTOT = 'X'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'DMBTR'.
WA_SORT-SPOS = 4.
APPEND WA_SORT TO IT_SORT.
gs_layout-subtotals_text = 'total'.
ENDFORM.
FORM ALV_DISPLAY.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_STRUCTURE_NAME =
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = CT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT[]
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'A'
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE 0 = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB_BKPF_BSEG
* EXCEPTIONS
* PROGRAM_ERROR = 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.
ENDFORM. "ALV_DISPLAY
*i_calLback_user_command = 'USER_COMMAND'.
FORM USER_COMMAND
USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
DATA wa LIKE LINE OF ITAB_BKPF_BSEG.
DATA itab LIKE TABLE OF ITAB_BKPF_BSEG WITH HEADER LINE.
READ TABLE ITAB_BKPF_BSEG index SELFIELD-TABINDEX INTO wa.
APPEND ITAB_BKPF_BSEG TO ITAB.
ENDLOOP.
CALL FUNCTION '/1BCDWB/SF00000204'
* EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS = i_ctrl
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS = i_print
* USER_SETTINGS = 'X'
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
ITAB_BKPF_BSEG = ITAB
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "user_command -
How to enhance table control in DMS. Need to display doknr more than 25 cha
Hi there.
In transaction IL03 - document tab - I need to display a doknr which is longer than 25 characters.
I search for exit/enhancement for DMS - saplcv140/control SUB_DOC, but cant find anything.
If it is not possible to enhance this field, i would like to add a new field (more than 25 char) and fill in the long doknr.
The documents that are attached contains both an internal docnumber(from the external system) and an external docnumber (functional location type of number). It is very important to show external documentno in the table control.
Actually in the table DRAW the external dok number is in the field MRK_FILEP. Can this field somehow get in the tablecontrol?
Anybody has experience with docno longer than 25 characters? Or how to enhance tablecontrol sub_doc (screen 0204) in fuction group CV140.
Br,
Liselotte.The BAdI CRM_BADI_RF_Q1O_SEARCH is for enhancing OneOrder based searches. Not for business partners.
The BAdI CRM_BUPA_IL_SEARCH is the way to go. I just checked in our system.
In the method SEARCH_CRITERIA_INITIAL check if your field is supplied in IS_PARAMETERS. If yes return CV_IS_NOT_INITIAL = 'X'.
Then in SEARCH_PARTNERS you delete the entries from table CT_PARTNER_KEYS according to your parameter.
However this is not very performant. If you have a search with criteria only of your own for the BAdI SAP coding will first select everything and then you filter out.
Anyway, it is much faster to implement than a new search...
cheers Carsten
Edited by: Carsten Kasper on Nov 18, 2008 7:44 PM
Maybe you are looking for
-
HP 3200 All in One Printer and HP Pavillion Media Center TV PC not working
I have down-loaded the proper driver and successfully installed the proper CD (floppy) for the printer and I still can not print either from e-mail or from "LivePix 2.0" software. I think I have worn out my welcome with HP on-line chat support. Would
-
Can I delete iOS 7 and reinstall iOS 6
Hi, I'm not liking the iOS 7 on my iPad, can I delete it and reins tire iOS 6?
-
10.6.4 is out, and the moon didn't change to green cheese
Remember everyone, 10.6.4 is software, and therefore it can't "cause" hardware to fail. Remember 10.6.4 may have been under testing by many developers, but there is no guarantee your software was tested by that developer with the latest seed, until a
-
Configuring the MDM 2.0 Catalog UI
Hi, Could someone please confirm or explain whether any configuration functionality exists to disable the commands or functions in the standard 'List View' tab of the MDM 2.0 Catalog UI? In our scenario we would like to disable the 'Compare' and 'Add
-
Average of the dates in a column.
Hello Oracle Gurus, I am having a problem. I have a table with 2 columns. One is the feed arrival time and one is the feed name.I want to find out the average feed arrival time of all the feed. To explain it better suppose there are 2 feeds feed 1, f