Discoverer Parameters: Year to Date
Hi guys,
At the moment im working on a database warehousing project. I'm using discoverer as a front end for a user friendly environment. Does anyone know how i can create a parameter to show the year to date? i need to put the following condition into the paramater:
FULL_DATE BETWEEN =add_months(sysdate,-12) AND =sysdate
However, as im sure you'll find, you cannot use the 'BETWEEN' function when using parameters :( - Ideally i'd like the user to be able to choose between two buttons, one showing all the data and one showing year to date. I would prefer to use a parameter to do this rather than the user adding/removing conditions from worksheet.
Thanks in advance,
Chris.
Hi Chris
Take a close look at Rod's answer because you can use BETWEEN when using parameters. Rod's answer looks for the code YTD and if found uses the full year to date.
Another solution would be to use a parameter that asks the user whether they want to see the year to date, receiving Y or N. Having got the answer you then create a suitable DECODE, like this:
FULL_DATE BETWEEN DECODE(:YTD_QUESTION,'Y',ADD_MONTHS(SYSDATE,-12), FULL_DATE) AND SYSDATE
This solution works when the datatype that you are checking for will not allow a user to type characters, so can be used when a date or number is being checked.
Best wishes
Michael
Similar Messages
-
How do I set up a year to date structure in Discoverer 3i?
This mainly relates to how to deal with months say that do not have data for them and therefore do not appear in the YTD structure. Discoverer will not show these months on the structure. How can we get around this in 3i?
Example.
Month 1: 100 units sold
YTD:100
Month 2: 50 units sold
YTD:150
Month 3: 0 units sold. No record in db.
YTD: NOT shown this month - no record in db.
We would like to see YTD:150 here.
Month 4: 50 units sold
YTD: 200
Does Discoverer 3i address this, or is there a workaround?
Many thanks in advanceHi Chris
Take a close look at Rod's answer because you can use BETWEEN when using parameters. Rod's answer looks for the code YTD and if found uses the full year to date.
Another solution would be to use a parameter that asks the user whether they want to see the year to date, receiving Y or N. Having got the answer you then create a suitable DECODE, like this:
FULL_DATE BETWEEN DECODE(:YTD_QUESTION,'Y',ADD_MONTHS(SYSDATE,-12), FULL_DATE) AND SYSDATE
This solution works when the datatype that you are checking for will not allow a user to type characters, so can be used when a date or number is being checked.
Best wishes
Michael -
Till Last Year, To Date - Discoverer......
We have following table X
PNO Date Amount
10 10/31/2006 10
10 11/30/2006 15
10 11/30/2007 20
10 12/31/2007 30
10 1/31/2008 15
10 2/29/2008 25
10 3/31/2008 40
We need to create report as follows, the parameter is the Date.
Lets say user pass parameter : 3/31/2008
The report should look like,
PNO TillLastYear To date
10 75 155
Till Last Year - Sum of Amount column till Last Year
To Date - Sum of Amount Column to the date parameter passed.
Could some on guide me how to achieve this......?Hi,
You need to add the PNO item into your report and then create calculations based on your date item:
TillLastYear SUM(CASE WHEN DateItem < TRUNC(SYSDATE,'Y') THEN Amount END)
ToDate SUM(CASE WHEN DateItem < :DateParameter THEN Amount END)
Rod West -
Discoverer Report returning ' no data found '
Hi ...
i have an issue with one discoverer report .
Discoverer report name : EDI Price Exception Report.
when i ran the report in Discoverer Desktop edition It is returning 'No Data Found ' But i am taken the Query from admin edition and tried to ran in PL/SQL Developer/TOAD by setting Org_id condition
it's returning Data . the Desktop Edition of Discoverer for some specific date Range it's giving Data But from last month on wards it's not returning any Data.
in Discoverer Report Desktop it's not retuning the Data from November to till date
Oracle Applications 11i
Discoverer 4i
Oracle Data base :9i
OS : Windows.
Attached the Sql which i used to generate the Report :
I HAVE USED THE FOLLOWING :-for initialize the profile options
EXEC FND_GLOBAL.APPS_INITIALIZE (0,52163,660);
EXEC APPS.FND_CLIENT_INFO.SET_ORG_CONTEXT(2922);
SELECT A.CUST_PO_NUMBER,
A.ORDER_NUMBER,
A.ORDERED_DATE,
A.ORDER_TYPE,
-- C.CUSTOMER_ID,
C.CUSTOMER_NUMBER,
C.CUSTOMER_NAME,
B.LINE_NUMBER,
B.ORDERED_ITEM,
MSI.SEGMENT1 ACCO_ITEM, -- GRW 20060407
MSI.DESCRIPTION,
-- MSI.INVENTORY_ITEM_ID,
(SELECT MCI.CUSTOMER_ITEM_NUMBER
FROM MTL_CUSTOMER_ITEMS MCI,
MTL_CUSTOMER_ITEM_XREFS MCIX,
MTL_SYSTEM_ITEMS_B MSIB
-- MTL_PARAMETERS MP
WHERE MCI.CUSTOMER_ID = C.CUSTOMER_ID --1814924
AND MCI.CUSTOMER_ITEM_ID = MCIX.CUSTOMER_ITEM_ID
AND MCIX.INVENTORY_ITEM_ID = MSIB.INVENTORY_ITEM_ID
AND MSIB.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID --869899
AND MSIB.ORGANIZATION_ID = MTP.ORGANIZATION_ID --MP.ORGANIZATION_ID
AND MTP.ORGANIZATION_CODE = 'BRM'
AND MCI.CUSTOMER_ITEM_NUMBER = B.ORDERED_ITEM
AND NVL (mci.inactive_flag, 'N') <> 'Y'
AND NVL (mcix.inactive_flag, 'N') <> 'Y')
CUSTOMER_ITEM,
XXAB_ITEM_XREFS.GET_GBC_ITEM_NUM (B.ORDERED_ITEM) GBC_ITEM_NUMBER,
B.ORDERED_QUANTITY,
B.PRICE_LIST,
B.UNIT_SELLING_PRICE,
B.UNIT_LIST_PRICE,
TO_NUMBER (B.ATTRIBUTE7) CUST_SENT_PRICE,
apps.XXAB_CUST_SENT_PRICE_CONV_SO (C.customer_number,
B.ordered_item,
B.header_id,
B.line_number,
B.unit_selling_price,
B.attribute7,
B.pricing_quantity_uom,
B.attribute4)
CUST_SENT_PRICE_CONVERTED,
ABS ( (B.UNIT_SELLING_PRICE
- apps.XXAB_CUST_SENT_PRICE_CONV_SO (C.customer_number,
B.ordered_item,
B.header_id,
B.line_number,
B.unit_selling_price,
B.attribute7,
B.pricing_quantity_uom,
B.attribute4)))
DIFFERENCE,
MTP.ORGANIZATION_CODE,
B.SHIP_TO_LOCATION
FROM OE_ORDER_HEADERS_V A,
OE_ORDER_LINES_V B,
RA_CUSTOMERS C,
MTL_PARAMETERS MTP,
MTL_SYSTEM_ITEMS_B MSI
WHERE A.HEADER_ID = B.HEADER_ID
AND A.SOLD_TO_ORG_ID = C.CUSTOMER_ID
-- Added by Gati on 19-Oct-2012, tkt - INC000000118962
AND ROUND (TO_NUMBER (apps.XXAB_CUST_SENT_PRICE_CONV_SO (
C.customer_number,
B.ordered_item,
B.header_id,
B.line_number,
B.unit_selling_price,
B.attribute7,
B.pricing_quantity_uom,
B.attribute4)),
2) <> B.UNIT_SELLING_PRICE
--AND ROUND(TO_NUMBER(B.ATTRIBUTE7), 2) <> B.UNIT_SELLING_PRICE
--AND a.ship_from_org_id = mtp.organization_id
AND B.SHIP_FROM_ORG_ID = MTP.ORGANIZATION_ID -- GRW 20060413
--AND a.ship_from_org_id = msi.organization_id
AND B.SHIP_FROM_ORG_ID = MSI.ORGANIZATION_ID -- GRW 20060413
AND B.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID -- GRW 20060407
AND A.ORDER_SOURCE_ID = 6
AND A.ORG_ID = B.ORG_ID
AND TO_CHAR (A.ordered_date, 'DD-MON-YYYY') between '01-NOV-2013' and '03-NOV-2013'
and mtP.organization_code='BRM'
AND A.ORG_ID = (SELECT HOU.ORGANIZATION_ID
FROM HR_OPERATING_UNITS HOU
WHERE HOU.NAME = '50 ACCO Canada')
AND B.cancelled_flag <> 'Y'
AND B.flow_status_code <> 'CANCELLED'
AND B.ORDERED_ITEM <> 'INVALID_ITEM'
ORDER BY a.order_numberHi,
Assuming your initialization matches your discoverer login, it is pretty weird that you get no data.
I am not sure how you got the SQL but i suggest you trace the session to get the exact SQL ran by the discoverer.
You may find another condition or join that limits your data.
Also another thing that you should try is to initial the session by using all the parameters (including the security group as you have in your discoverer login):
begin
fnd_global.APPS_INITIALIZE(user_id =>, resp_id =>, resp_appl_id =>, security_group_id =>);
end -
Discoverer report returns no data from a certain time
Using Discoverer 10g,a discoverer report which returned data normally last month gets to return no data now.
We have four same environments, and two of them has this problem, two is OK.
And the SQL of the discoverer of the four environments are the same.
We have no any changment of this discoverer and related EUL for more than one year....
How should we investigate into this issue.
For example ,a point we should notice or something...
Could somebody give us a suggestion?
Thank you.Thanks for your qiuck reply.
1.empty table that is joined in the query.The four environments has almost the same data,it is not the cause.
2.security issue with the data, maybe the security definitions are different from one environment to another.we are now invesgate into this cause.
and there is a sql of the discoverer's EUL which shows no data in a enviroment(in this enviroment discoverer report gets no data), but in another enviroment data can show.
the sql is as following.
=============
SELECT loc_bu.org_id
,loc_bu.location_id building_id
,loc_bu.building building_name
,loc_bu.location_code building_number
,loc_fl.location_id floor_id
,loc_fl.location_code floor_number
,loc_fl.floor floor_name
,loc_of.location_id office_id
,loc_of.location_code office_number
,loc_of.office office_name
,loc_of.suite office_suite
,loc_of.location_alias office_alias
,loc_of.assignable_area office_assignable_area
,loc_of.space_type_lookup_code office_space_type_code
,lst.meaning office_space_type
,loc_of.function_type_lookup_code office_function_type_code
,fun.meaning office_function_type
,(SELECT ffv.description
FROM fnd_flex_values_vl ffv
,fnd_flex_value_sets ffvs
WHERE ffv.flex_value = loc_of.attribute1
AND ffv.flex_value_set_id = ffvs.flex_value_set_id
AND ffvs.flex_value_set_name = 'MB_PN_ON') occupancy_exception_flag
,loc_of.active_start_date
,loc_of.active_end_date
--ADD BY KEVIN 2008/6/26 START
,loc_of.attribute7 division_code_office
,(SELECT ffv.description
FROM fnd_flex_values_vl ffv
,fnd_flex_value_sets ffvs
WHERE ffv.flex_value = loc_of.attribute7
AND ffv.flex_value_set_id = ffvs.flex_value_set_id
AND ffvs.flex_value_set_name = 'MB_PN_DIVISION') division_description_office --ヌヨ-ホ・ヒオテ・
--ADD BY KEVIN 2008/6/26 END
FROM pn_locations loc_bu
,pn_locations loc_fl
,pn_locations loc_of
,fnd_lookups fun
,fnd_lookups lst
WHERE loc_bu.location_id = loc_fl.parent_location_id
AND loc_bu.location_type_lookup_code IN ('LAND', 'BUILDING')
AND nvl(loc_bu.attribute6, '99') <> '01'
AND loc_fl.location_id = loc_of.parent_location_id
AND loc_fl.location_type_lookup_code IN ('FLOOR', 'PARCEL')
AND nvl(loc_fl.attribute6, '99') <> '01'
AND loc_of.location_type_lookup_code IN ('OFFICE', 'SECTION')
AND nvl(loc_of.attribute6, '99') <> '01'
AND loc_of.function_type_lookup_code = fun.lookup_code(+)
AND fun.lookup_type(+) = 'PN_FUNCTION_TYPE'
AND loc_of.space_type_lookup_code = lst.lookup_code(+)
AND lst.lookup_type(+) = decode(loc_of.location_type_lookup_code,
'OFFICE',
'PN_SPACE_TYPE',
'SECTION',
'PN_PARCEL_TYPE')
AND nvl(loc_of.space_type_lookup_code,'99') <> '07';
====================
Ps.before excute this sql, we always first excute following command.
====
begin
fnd_client_info.set_org_context(117);
end;
====
The analyst of our team is not very good at the security problem, could you help us?
Thanks a lot. -
Year to Date and Monthly totals
I know that this is rather simplistic, but I'm new to Discoverer and need to set up a bunch of sales reports with MTD and YTD columns. I'm going to be using the same SQL query for many of my reports but customizing the reports to show sales by state, product line, etc.
Is there a formula/function I can use in Discover for the Month to Date and Year to Date totals?
Thanks,
JosephHi Joseph
You can use the analytic range SUM calculation for these. For the month to date, use the a PARTITION BY of month with a range of all the preceding rows in the partition up to and including the current row. For the year, you would simply change the PARTITION BY to be the year.
Here are some examples drawn from my own database:
I have the following items:
ORDER_YEAR
ORDER_MONTH
ORDER_DATE
SELLING_PRICE
With these defined, the formula for month to date is:
SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS UNBOUNDED PRECEDING)
The formlua for year to date is:
SUM(Selling Price SUM) OVER(PARTITION BY ORDER_YEAR ORDER BY ORDER_DATE ASC ROWS UNBOUNDED PRECEDING )
Basically what we are doing is telling Discoverer to SUM the SELLING_PRICE, and you should be able to take these and adjust them for your own report.
Let me take a look at the month to end and describe what is going on. Basically the PARTITION BY is defining a set of rows which are to be included. In this case it is all rows that have the same ORDER_MONTH. The ORDER BY clause tells Discoverer to place the items in order, with the oldest order first. The ROWS UNBOUNDED PRECEDING tells Discoverer to SUM all of the items within the set (within the PARTITION BY) from the oldest item (UNBOUNDED PRECEDING) to and including the current item. We could have added a BETWEEN clause too but that is implied. With a BETWEEN clause it would look like this:
SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
If you want the current row to be included with UNBOUNDED PRECEDING you don't need to explicitly name it because that is the default. Other options you could use are these:
UNBOUNDED FOLLOWING - this SUMS to the end of the PARTITION
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - you can guess that this will add all of the items, which you will rarely use because if you omit the ROWS command then this range between first and last is actually the default
Rather than ROWS BETWEEN you can also say RANGE BETWEEN, like this:
SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
I hope this little dissertation on running totals helps.
Best wishes
Michael -
Pl/sql Year to Date Function
Dear All!
Its very urgent task for me. i'm working on Oracle discoverer. i'm creating Project Year to Date report. i need one year to date function. i've only period name. The scnerio is this, in our company financial year is starting from (April to March i.e 01-April-2011 to 31-mar-2012). i need to apply YTD function on Period name. when any user select any period it will show from 01-apr-2011 to select mont. for example if user select Feb-12 then it must be from 01-apr-2011 to 29-feb-2012.
Please this is urgent.. give Query for function. please
Regards
Ahmed....Hello,
Can you put an example on apex.oracle.com and provide a link, it will be much easier to help you out?
Regards,
Carl
blog : http://carlback.blogspot.com/
apex examples : http://apex.oracle.com/pls/otn/f?p=11933:5 -
Hi,
I have to get the Year-to-date amount on an ALV output for a GL account. Is there any FM to do it?... Currently Iam just getting the output for the period that I put in selection screen.
Thank you,
SB.Hi
You have to use the filed symbols for this purpose.
see the sample code
report zfgldr0010
line-size 122
line-count 60
no standard page heading
message-id zndc.
Database Tables
tables: bsis, " Accounting: Secondary Index for G/L Accounts
ska1, " GL Account Master
t001, " Company Codes
csks, " Cost Centers Master
setnode, " Cost Center Group Hierarchy
setleaf. " Cost Center Group Hierarchy
Declaration of Internal Tables
Internal Table to fetch the Opex Budget & Capex Actual Data
data: begin of it_bud_tab occurs 0,
lednr like cosp-lednr, " Ledger No
objnr like cosp-objnr, " Object No
gjahr like cosp-gjahr, " Fiscal Year
wrttp like cosp-wrttp, " Actuals
versn like cosp-versn, " Version
twaer like cosp-twaer, " Currency
perbl like cosp-perbl, " Period Block
kstar like cosp-kstar, " Cost Element/GL A/C No
wog001 like cosp-wog001, " Total Value
wog002 like cosp-wog002, " Total Value
wog003 like cosp-wog001, " Total Value
wog004 like cosp-wog002, " Total Value
wog005 like cosp-wog001, " Total Value
wog006 like cosp-wog002, " Total Value
wog007 like cosp-wog001, " Total Value
wog008 like cosp-wog002, " Total Value
wog009 like cosp-wog001, " Total Value
wog010 like cosp-wog002, " Total Value
wog011 like cosp-wog001, " Total Value
wog012 like cosp-wog002, " Total Value
end of it_bud_tab.
Internal Table to fetch the Settlement Costs(Opex-Actual)
data: begin of it_set_tab occurs 0,
kokrs like coep-kokrs, " Controlling Area
belnr like coep-belnr, " Acc Document
buzei like coep-buzei, " Line Item
perio like coep-perio, " Period Block
wkgbtr like coep-wkgbtr, " Value in CO Curr
lednr like coep-lednr, " Ledger No
objnr like coep-objnr, " Object No
gjahr like coep-gjahr, " Fiscal Year
wrttp like coep-wrttp, " Actuals
versn like coep-versn, " Version
kstar like coep-kstar, " Cost Element
beknz like coep-beknz, " Dr/Cr Indicator
parob1 like coep-parob1, " Partner Object
end of it_set_tab.
Internal Table to fetch the COBRB data(Settlement rules)
data: begin of cobrb_tab occurs 0,
objnr like cobrb-objnr, " Object No
rec_objnr1 like cobrb-rec_objnr1, " Ref Object No
bureg like cobrb-bureg, " Dostribution Rule
lfdnr like cobrb-lfdnr, " Sequence No
perbz like cobrb-perbz, " Settlement Rule
konty like cobrb-konty, " Acct Assign Category
bukrs like bsis-bukrs, " Company Code
kostl like bsis-kostl, " Cost Center
end of cobrb_tab.
Internal Table to Settlement Actual Costs for Cost center & GL
data: begin of set_act_tab occurs 0,
kostl like csks-kostl, " Cost Center
hkont like bsis-hkont, " GL Account No
amt_atd like bsis-dmbtr, " YTD Actual
end of set_act_tab.
Internal Table to Settlement Actual Costs for Cost center
data: begin of set1_act_tab occurs 0,
kostl like csks-kostl, " Cost Center
hkont like bsis-hkont, " GL Account No
amt_atd like bsis-dmbtr, " YTD Actual
end of set1_act_tab.
Internal Table to Capex Budget Figures
data: begin of cap_tab occurs 0,
belnr like coej-belnr, " Accounting Doc No
buzei like coej-buzei, " Line Item No
objnr like coej-objnr, " Object No
wrttp like bpej-wrttp, " Value Type
gjahr like coej-gjahr, " Fiscal Year
wtjhr like bpej-wtjhr, " budget Value
end of cap_tab.
Internal Table to Segragate the Budget Figures(Full Year and YTD)
data: begin of cap1_tab occurs 0,
gjahr like coej-gjahr, " Fiscal Year
kostl(10) type n, " Cost Center
hkont(10) type n, " GL Account No
amt_fy like coej-wkf001, " Full Year Amount
amt_ytd like coej-wkf001, " Ytd Amount
end of cap1_tab.
Internal Table to Sum up the Budget Figures(Full Year and YTD)
data: begin of cap2_tab occurs 0,
gjahr like coej-gjahr, " Fiscal Year
kostl(10) type n, " Cost Center
amt_fy like coej-wkf001, " Full Year Amount
amt_ytd like coej-wkf001, " Ytd Amount
end of cap2_tab.
Internal Table to Segragate the CAPEX YTD data(GL Wise)
data: begin of cap_ytd_tab occurs 0,
gjahr like coej-gjahr, " Fiscal Year
kostl(10) type n, " Cost Center
kstar like coej-kstar, " Cost Element
amt_ytd like coej-wkf001, " Ytd Amount
end of cap_ytd_tab.
Internal Table to Segragate the CAPEX YTD data(CC Wise)
data: begin of cap1_ytd_tab occurs 0,
gjahr like coej-gjahr, " Fiscal Year
kostl(10) type n, " Cost Center
amt_ytd like coej-wkf001, " Ytd Amount
end of cap1_ytd_tab.
Internal Table to Segragate the Budget Figures(Full Year and YTD)
data: begin of it_ytd_tab occurs 0,
gjahr like cosp-gjahr, " Fiscal Year
kostl like bsis-kostl, " Cost Center
kstar like cosp-kstar, " Cost Element
amt_fy like cosp-wkf001, " Full Year Amount
amt_ytd like coej-wkf001, " Ytd Amount
end of it_ytd_tab.
Internal Table to Segragate the Budget Figures(Full Year and YTD)
data: begin of it_ytd1_tab occurs 0,
gjahr like cosp-gjahr, " Fiscal Year
kostl like bsis-kostl, " Cost Center
amt_fy like cosp-wkf001, " Full Year Amount
amt_ytd like coej-wkf001, " Ytd Amount
end of it_ytd1_tab.
Internal Table to fetch the Actual YTD Figures
data: begin of it_act_tab occurs 0,
bukrs like bsis-bukrs, " Company Code
hkont like bsis-hkont, " GL Account No
gjahr like bsis-gjahr, " Fiscal Year
belnr like bsis-belnr, " Accounting Doc No
budat like bsis-budat, " Posting Date
waers like bsis-waers, " Currency
kostl like bsis-kostl, " Cost Center
shkzg like bsis-shkzg, " Dr/Cr Indicator
dmbtr like bsis-dmbtr, " Doc Amount
end of it_act_tab.
Internal Table to fetch the Actual YTD Figures( GL-SUM)
data: begin of act1_tab occurs 0,
bukrs like bsis-bukrs, " Company Code
kostl like bsis-kostl, " Cost Center
hkont like bsis-hkont, " GL Account No
gjahr like bsis-gjahr, " Fiscal Year
dmbtr like bsis-dmbtr, " Doc Amount
end of act1_tab.
Internal Table to fetch the Actual YTD Figures( CC-SUM)
data: begin of act2_tab occurs 0,
bukrs like bsis-bukrs, " Company Code
kostl like bsis-kostl, " Cost Center
gjahr like bsis-gjahr, " Fiscal Year
dmbtr like bsis-dmbtr, " Doc Amount
end of act2_tab.
Internal Table to fetch the WBS Data
data: begin of wbs_tab occurs 0,
pspnr like prps-pspnr, " WBS Element
posid like prps-posid, " WBS Structure Element
objnr like prps-objnr, " Object No
psphi like prps-psphi, " Project ID
pbukr like prps-pbukr, " Company Code
pkokr like prps-pkokr, " Controlling Area
fkstl like prps-fkstl, " Cost center
end of wbs_tab.
Internal Table to get Capex Actual from Networks
data: begin of net_tab occurs 0,
aufnr like afko-aufnr, " Order No
ftrmi like afko-ftrmi, " Release Date
pronr like afko-pronr, " Project No
aufpl like afvc-aufpl, " Routing No
aplzl like afvc-aplzl, " Counter No
objnr like afvc-objnr, " Object No
projn like afvc-projn, " WBS Element
end of net_tab.
Internal Table to get Capex Actual from Orders
data: begin of ord_tab occurs 0,
aufnr like aufk-aufnr, " Order No
aedat like aufk-aedat, " Order Date
kostl like aufk-kostl, " Cost center
objnr like aufk-objnr, " Object No
pspel like aufk-pspel, " WBS Element
end of ord_tab.
Internal Table to fetch the Capex Actual Data
data: it_cap_tab like kv02s occurs 0 with header line.
Internal Table to store the output of function-G_SET_TREE_IMPORT.
data : ccenter_group_tab like sethier occurs 0 with header line.
Internal Table to store the output of function-G_SET_TREE_IMPORT.
data : cost_center_tab like setvalues occurs 0 with header line.
Declaration of Variables
data: v_f_oper_amnt like bsis-wrbtr, " Operations F Year Budget
v_f_depr_amnt like bsis-wrbtr, " Depreciation F Year Budget
v_f_main_amnt like bsis-wrbtr, " Maintenance F Year Budget
v_f_capx_amnt like bsis-wrbtr, " Capex F Year Budget
v_b_oper_amnt like bsis-wrbtr, " Operations Budget YTD
v_b_depr_amnt like bsis-wrbtr, " Depreciation Budget YTD
v_b_main_amnt like bsis-wrbtr, " Maintenance Budget YTD
v_b_capx_amnt like bsis-wrbtr, " Capex Budget YTD
v_a_oper_amnt like bsis-wrbtr, " Operations Actual YTD
v_a_depr_amnt like bsis-wrbtr, " Depreciation Actual YTD
v_a_main_amnt like bsis-wrbtr, " Maintenance Actual YTD
v_a_capx_amnt like bsis-wrbtr, " Capex Actual YTD
v_v_oper_amnt type i, " Operations Variance
v_v_depr_amnt type i, " Depreciation Variance
v_v_main_amnt type i, " Maintenance Variance
v_v_capx_amnt type i, " Capex Variance
v_t_f_amnt type i, " Total F Year Budget
v_t_b_amnt type i, " Total Budget YTD
v_t_a_amnt type i, " Total Actual YTD
v_t_v_amnt type i, " Total Variance
v_gt_f_amnt type i, " GTotal F Year Budget
v_gt_b_amnt type i, " GTotal Budget YTD
v_gt_a_amnt type i, " GTotal Actual YTD
v_gt_v_amnt type i, " GTotal Variance
v_per_oper type i, " % YTD Operations
v_per_depr type i, " % YTD Depreciation
v_per_main type i, " % YTD Maintenance
v_per_capx type i, " % YTD Capex
v_per_tot type i, " % YTD Total
v_per_gtot type i, " % YTD G Total
v_kstar(4) type n, " Cost element
v_yr(2) type c, " Year
v_year(4) type c, " Year
v_lines type i, " Number
v_str(10) type c, " String
v_gl(4) type n, " GL element
v_gl1(10) type n, " GL Account Code
v_mon(2) type n, " Month
v_month(2) type n, " Month
v_day(2) type n, " Day
v_date like sy-datum, " Start Date in Year
v_setid like sethier-setid, " To store Identification of a set
v_subrc like sy-subrc, " Return code
v_settid like rgsbs-setnr. " Identification of a set
data: v_f_oper_amnt1 type i, " Operations F Year Budget
v_f_depr_amnt1 type i, " Depreciation F Year Budget
v_f_main_amnt1 type i, " Maintenance F Year Budget
v_f_capx_amnt1 type i, " Capex F Year Budget
v_b_oper_amnt1 type i, " Operations Budget YTD
v_b_depr_amnt1 type i, " Depreciation Budget YTD
v_b_main_amnt1 type i, " Maintenance Budget YTD
v_b_capx_amnt1 type i, " Capex Budget YTD
v_a_oper_amnt1 type i, " Operations Actual YTD
v_a_depr_amnt1 type i, " Depreciation Actual YTD
v_a_main_amnt1 type i, " Maintenance Actual YTD
v_a_capx_amnt1 type i. " Capex Actual YTD
Declaration of Constants
constants : c_i type c value 'I', " Sign
c_x type c value 'X', " Sign
c_d type c value 'D', " Type
c_h type c value 'H', " Credit Ind
c_s type c value 'S', " Type
c_o type c value 'O', " Type
c_a type c value 'A', " Type
c_01(2) type n value '01', " Month
c_opt1(2) type c value 'EQ', " Option
c_opt2(2) type c value 'BT', " Option
c_dot(3) type c value '...', " Dots
c_or(2) type c value 'OR', " Type
c_ks(2) type c value 'KS', " Type
c_mon(2) type n value '01', " Month
c_ndc like setnode-setname value 'NDC', " CC Group
c_glno like coej-versn value '000', " For GL No
c_versn1 like coej-versn value '100', " Value
c_kokrs like coej-kokrs value '1000', " Controlling Area
c_wrttp like coej-wrttp value '01', " Value Type
c_wrttp1 like coej-wrttp value '41', " Value Type
c_wrttp2 like coej-wrttp value '04', " Value Type
c_versn like coej-versn value '000', " Version
c_kbud like bpej-vorga value 'KBUD', " Activity
c_kbfr like bpej-vorga value 'KBFR', " Activity
c_kbn0 like bpej-vorga value 'KBN0', " Activity
c_it_bud_tab_wog0(15) value 'IT_BUD_TAB-WOG0',
c_prart like prps-prart value 'CA', " Project Type
c_psin like afvc-steus value 'PSIN', " Control Key
c_lednr like cosp-lednr value '00', " Ledger
c_lednr1 like bpej-lednr value '0002', " Ledger
c_class1 like setnode-setclass value '0101', " Class
c_class2 like setnode-subclass value '1000', " Subclass
c_thous type i value '1000', " Number
c_settab like rgsbs-table value 'CCSS', " Table for set
c_cctfld like t800s-feld value 'KOSTL'. " Field name
Declaration of Ranges
ranges: rn_kostl for csks-kostl. " Cost Centers
Selection Screen
selection-screen begin of block b1 with frame title text-001.
parameters : p_bukrs like t001-bukrs
default '1000'," Company Code
p_gjahr like bsis-gjahr
default sy-datum+0(4), " Fiscal Year
p_date like bsis-budat obligatory. " Date
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-021.
parameters : p_cgrup like setnode-setname. " Cost Center Group
select-options: s_kostl for csks-kostl. " Cost Center
selection-screen end of block b2.
selection-screen begin of block b3 with frame title text-029.
select-options :
s_opers for ska1-saknr obligatory, " Operns & Support GL A/C
s_deprc for ska1-saknr obligatory, " Depreciation GL A/C
s_mmain for ska1-saknr obligatory, " Major Maintenance GL A/C
s_capex for ska1-saknr obligatory. " Capital Expenditure GL A/C
selection-screen end of block b3.
Initialization
initialization.
At selection-screen
at selection-screen.
Validate the Selection Screen fields
perform validate_screen.
Value request for Cost Center Group.
at selection-screen on value-request for p_cgrup .
Get the F4 Help for Cost center Group
perform set_auswaehlen(sapfk00b) using c_settab c_cctfld
changing p_cgrup v_subrc
v_settid.
Start-of-Selection
start-of-selection.
Clear all the Variables in the Program
perform clear_var.
Get the Cost Centers from Cost Center Group.
perform get_cc_values.
Get the Budget data from database Table COSP
perform get_budget_data.
Get the Settlement Costs data from database Tables COBRB,COSP
perform get_cobrb_data.
Get the Actual YTD data from database Table BSIS
perform get_act_ytd_data.
Get the WBS Element Data
perform get_wbs_data.
Get the Networks and Activities for the WBS
perform get_net_ord_data.
Get the WBS Budget data from database Tables BPEJ
perform get_cap_budget_data.
Get the WBS Actual YTD data for WBS
perform get_cap_act_ytd_data.
Top-of-page
top-of-page.
Write the Report and Column Headings
perform top_of_page.
End-of-Selection
end-of-selection.
D-splay the Output Report.
perform display_report.
Form-Routines
*& Form validate_screen
Validation of selection Screen fields
form validate_screen.
Validation of Company Code
clear t001.
if not p_bukrs is initial.
select single bukrs
into t001-bukrs
from t001
where bukrs eq p_bukrs.
if sy-subrc <> 0.
message e999 with 'Incorrect Company Code'(033).
endif.
endif.
Validation of GL Account Code( P & L Operations )
clear ska1.
if not s_opers[] is initial.
select saknr up to 1 rows
into ska1-saknr
from ska1
where saknr in s_opers
and ktopl = c_kokrs
and xbilk = ' '.
endselect.
if sy-subrc <> 0.
message e999 with
'Incorrect GL Account for Operations and Support Cost'(034).
endif.
endif.
Validation of GL Account Code( P & L Depreciation)
clear ska1.
if not s_deprc[] is initial.
select saknr up to 1 rows
into ska1-saknr
from ska1
where saknr in s_deprc
and ktopl = c_kokrs
and xbilk = ' '.
endselect.
if sy-subrc <> 0.
message e999 with
'Incorrect GL Account for Depreciation'(035).
endif.
endif.
Validation of GL Account Code( P & L Maintenance)
clear ska1.
if not s_mmain[] is initial.
select saknr up to 1 rows
into ska1-saknr
from ska1
where saknr in s_mmain
and ktopl = c_kokrs
and xbilk = ' '.
endselect.
if sy-subrc <> 0.
message e999 with
'Incorrect GL Account for Major Maintenance'(036).
endif.
endif.
Validation of GL Account Code (Balance Sheet-Capex)
clear ska1.
if not s_capex[] is initial.
select saknr up to 1 rows
into ska1-saknr
from ska1
where saknr in s_capex
and ktopl = c_kokrs
and xbilk = c_x.
endselect.
if sy-subrc <> 0.
message e999 with
'Incorrect GL Account for Capital Expenditures'(037).
endif.
endif.
Validation of Cost Center Group
if not p_cgrup is initial .
clear setleaf-setname.
select setname up to 1 rows
from setleaf
into setleaf-setname
where setname eq p_cgrup and
setclass = c_class1 and
subclass = c_class2.
endselect.
if sy-subrc <> 0.
clear setnode-setname.
select setname up to 1 rows
from setnode
into setnode-setname
where setname eq p_cgrup and
setclass = c_class1 and
subclass = c_class2.
endselect.
if sy-subrc <> 0.
message e999 with
'Enter Correct Cost Center Group'(038).
endif.
endif.
endif.
Validation of Cost Center
clear csks.
if not s_kostl[] is initial.
select kostl up to 1 rows
into csks-kostl
from csks
where kostl in s_kostl
and kokrs = c_kokrs.
endselect.
if sy-subrc <> 0.
message e999 with
'Enter Correct Cost Center Code'(039).
endif.
endif.
Enter either Cost Center Group or Values
if not p_cgrup is initial and not s_kostl[] is initial.
message e999 with
'Enter either Cost Center Group or Values'(040).
endif.
Validation of Date
if p_date+0(4) ne p_gjahr.
message e999(zndc) with
'Please Enter the date in same Fiscal Year'(020).
endif.
To enter only last day of the month
clear: v_month, v_day, v_year.
v_month = p_date+4(2).
v_day = p_date+6(2).
v_year = p_date+0(4).
if ( v_month = '01' or v_month = '03' or v_month = '05' or
v_month = '07' or v_month = '08' or v_month = '10' or
v_month = '12' ).
if v_day ne '31'.
message e999(zndc) with
'Enter Last date of the Month'(022).
endif.
elseif ( v_month = '04' or v_month = '06' or v_month = '09' or
v_month = '11' ).
if v_day ne '30'.
message e999(zndc) with
'Enter Last date of the Month'(022).
endif.
elseif v_month = '02'.
if v_year eq '2004' or v_year eq '2008'.
if v_day ne '29'.
message e999(zndc) with
'Enter Last date of the Month'(022).
endif.
else.
if v_day ne '28'.
message e999(zndc) with
'Enter Last date of the Month'(022).
endif.
endif.
endif.
endform. " validate_screen
*& Form get_cc_values
Get the Cost Centers from Cost Center Group
form get_cc_values.
Populate the Cost Centers from Cost Center Group
if s_kostl[] is initial.
if p_cgrup is initial.
p_cgrup = c_ndc.
else.
p_cgrup = p_cgrup.
endif.
Concatenating Setnode table setclass,subclass fields and
Cost Center Group
concatenate c_class1 c_class2 p_cgrup
into v_setid.
Calling function module to get SET_HIERARCHY & SET_VALUES
perform frm_g_set_tree_import tables ccenter_group_tab[]
cost_center_tab[]
using v_setid.
loop at cost_center_tab.
rn_kostl-low = cost_center_tab-from.
rn_kostl-high = cost_center_tab-to.
rn_kostl-sign = c_i.
if rn_kostl-low = rn_kostl-high.
rn_kostl-option = c_opt1.
else.
rn_kostl-option = c_opt2.
endif.
append rn_kostl.
endloop.
clear v_setid.
endif.
else.
rn_kostl[] = s_kostl[].
endif.
endform. "get_cc_values
*& FORM FRM_G_SET_TREE_IMPORT
Subroutine to call the function G_SET_TREE_IMPORT.
form frm_g_set_tree_import
tables ccenter_group_tab structure sethier
cost_center_tab structure setvalues
using p_v_setid.
call function 'G_SET_TREE_IMPORT'
exporting
CLIENT = SY-MANDT
FIELDNAME = ' '
LANGU = SY-LANGU
NO_DESCRIPTIONS = ' '
NO_RW_INFO = ' '
setid = p_v_setid
TABNAME = ' '
NO_VARIABLE_REPLACEMENT = ' '
ROOT_HEADER_ONLY = ' '
NO_TABLE_BUFFERING = ' '
MAX_HIER_LEVEL = 99
DATE_FROM =
DATE_TO =
IMPORTING
SET_NOT_TRANSPARENT =
tables
set_hierarchy = ccenter_group_tab
set_values = cost_center_tab
EXCEPTIONS
SET_NOT_FOUND = 1
ILLEGAL_FIELD_REPLACEMENT = 2
ILLEGAL_TABLE_REPLACEMENT = 3
OTHERS = 4
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. "frm_g_set_tree_import
*& Form clear_var
Clear all the Variables in the program
form clear_var.
Clear/Initialize all the Variables
clear: v_f_oper_amnt1, v_f_depr_amnt1, v_f_main_amnt1,
v_f_capx_amnt1, v_b_oper_amnt1, v_b_depr_amnt1,
v_b_main_amnt1, v_b_capx_amnt1, v_a_oper_amnt1,
v_a_depr_amnt1, v_a_main_amnt1, v_a_capx_amnt1,
v_f_oper_amnt, v_f_depr_amnt, v_f_main_amnt,
v_f_capx_amnt, v_b_oper_amnt, v_b_depr_amnt,
v_b_main_amnt, v_b_capx_amnt, v_a_oper_amnt,
v_a_depr_amnt, v_a_main_amnt, v_a_capx_amnt,
v_v_oper_amnt, v_v_depr_amnt, v_v_main_amnt,
v_v_capx_amnt, v_t_f_amnt, v_t_b_amnt,
v_t_a_amnt, v_t_v_amnt, v_gt_f_amnt,
v_gt_b_amnt,v_gt_a_amnt,v_gt_v_amnt,
v_per_oper, v_per_depr, v_per_main,
v_per_capx, v_per_tot, v_per_gtot.
endform. "clear_var
*& Form get_budget_data
Get the Budget Data from Database Table COSP
form get_budget_data.
Form Local data
data: l_period(2) type n,
l_name(35) type c,
l_monat type i .
l_monat = p_date+4(2).
Field Symbols
field-symbols <fs>.
clear it_bud_tab.
refresh it_bud_tab.
select lednr " Ledger No
objnr " Object No
gjahr " Fiscal Year
wrttp " Actuals
versn " Version
twaer " Currency
perbl " Period Block
kstar " Cost Element/GL A/C No
wog001 " Total Value
wog002 " Total Value
wog003 " Total Value
wog004 " Total Value
wog005 " Total Value
wog006 " Total Value
wog007 " Total Value
wog008 " Total Value
wog009 " Total Value
wog010 " Total Value
wog011 " Total Value
wog012 " Total Value
into table it_bud_tab
from cosp
where lednr = c_lednr and
gjahr = p_gjahr and
wrttp = c_wrttp and
versn = c_versn and
beknz in (c_d,c_s).
if sy-subrc = 0.
Segragate the Budget Figures(Full Year and YTD)
loop at it_bud_tab.
if it_bud_tab-objnr+0(2) eq c_ks.
move-corresponding it_bud_tab to it_ytd_tab.
it_ytd_tab-kostl = it_bud_tab-objnr+6(10).
it_ytd_tab-amt_fy = it_bud_tab-wog001 + it_bud_tab-wog002 +
it_bud_tab-wog003 + it_bud_tab-wog004 +
it_bud_tab-wog005 + it_bud_tab-wog006 +
it_bud_tab-wog007 + it_bud_tab-wog008 +
it_bud_tab-wog009 + it_bud_tab-wog010 +
it_bud_tab-wog011 + it_bud_tab-wog012.
Get the YTD Budget using Field Symbols
do l_monat times.
l_period = sy-index.
concatenate c_it_bud_tab_wog0 l_period
into l_name.
assign (l_name) to <fs>.
it_ytd_tab-amt_ytd = it_ytd_tab-amt_ytd +
<fs>.
enddo.
collect it_ytd_tab.
clear it_ytd_tab.
endif.
endloop.
sort it_ytd_tab by gjahr kostl kstar.
Cost Center wise Sum Up of Costs
loop at it_ytd_tab.
at end of kostl.
sum.
move-corresponding it_ytd_tab to it_ytd1_tab.
append it_ytd1_tab.
endat.
clear it_ytd1_tab.
endloop.
sort it_ytd1_tab by gjahr kostl.
Segragate the Budget Figures into different Accounts/Cost elements
loop at it_ytd_tab.
if it_ytd_tab-kostl in rn_kostl.
Budget Full Year and YTD (Operations & Support Cost)
if not s_opers[] is initial.
if it_ytd_tab-kstar in s_opers.
v_f_oper_amnt = v_f_oper_amnt + it_ytd_tab-amt_fy.
v_b_oper_amnt = v_b_oper_amnt + it_ytd_tab-amt_ytd.
endif.
endif.
Budget Full Year and YTD (Depreciation)
if not s_deprc[] is initial.
if it_ytd_tab-kstar in s_deprc.
v_f_depr_amnt = v_f_depr_amnt + it_ytd_tab-amt_fy.
v_b_depr_amnt = v_b_depr_amnt + it_ytd_tab-amt_ytd.
endif.
endif.
Budget Full Year and YTD (Major Maintainance)
if not s_mmain[] is initial.
if it_ytd_tab-kstar in s_mmain.
v_f_main_amnt = v_f_main_amnt + it_ytd_tab-amt_fy.
v_b_main_amnt = v_b_main_amnt + it_ytd_tab-amt_ytd.
endif.
endif.
endif.
endloop.
Convert the Amount fields to nearest Thousand
v_f_oper_amnt1 = v_f_oper_amnt / c_thous .
v_f_depr_amnt1 = v_f_depr_amnt / c_thous .
v_f_main_amnt1 = v_f_main_amnt / c_thous .
v_b_oper_amnt1 = v_b_oper_amnt / c_thous .
v_b_depr_amnt1 = v_b_depr_amnt / c_thous .
v_b_main_amnt1 = v_b_main_amnt / c_thous .
endif.
endform. "get_budget_data
*& Form get_cobrb_data
Get the Settlement Data from Database Table COBRB
form get_cobrb_data.
clear cobrb_tab.
refresh cobrb_tab.
select objnr " Object No
rec_objnr1 " Ref Object No
bureg " Dostribution Rule
lfdnr " Sequence No
perbz " Settlement Rule
konty " Acct Assign Category
bukrs " Company Code
kostl " Cost Center
into table cobrb_tab
from cobrb
where kostl in rn_kostl.
sort cobrb_tab by objnr rec_objnr1.
delete adjacent duplicates from cobrb_tab comparing objnr.
Get the Settlement Costs from COEP Table
clear it_set_tab.
refresh it_set_tab.
if not cobrb_tab[] is initial.
select kokrs " Controlling Area
belnr " Acc Document
buzei " Line Item
perio " Period Block
wkgbtr " Value in CO Curr
lednr " Ledger No
objnr " Object No
gjahr " Fiscal Year
wrttp " Actuals
versn " Version
kstar " Cost Element
beknz " Dr/Cr Indicator
parob1 " Partner Object
into table it_set_tab
from coep
for all entries in cobrb_tab
where lednr = c_lednr and
wrttp = c_wrttp2 and
versn = c_versn and
gjahr = p_gjahr and
objnr = cobrb_tab-objnr and
parob1 = cobrb_tab-rec_objnr1 and
beknz in (c_o, c_a).
endif.
Settlement Actual Costs
loop at cobrb_tab.
if cobrb_tab-objnr+0(2) eq c_or.
loop at it_set_tab where objnr = cobrb_tab-objnr
and parob1 = cobrb_tab-rec_objnr1.
set_act_tab-kostl = cobrb_tab-kostl.
set_act_tab-hkont = it_set_tab-kstar.
Get the Actual Settlement Costs YTD Amount
if it_set_tab-perio between c_mon and v_month.
set_act_tab-amt_atd = set_act_tab-amt_atd +
abs( it_set_tab-wkgbtr ).
endif.
collect set_act_tab.
clear set_act_tab.
endloop.
endif.
endloop.
sort set_act_tab by kostl hkont.
Sum Up the Settlement Costs-CC wise
loop at set_act_tab.
at end of kostl.
read table set_act_tab index sy-tabix.
sum.
move-corresponding set_act_tab to set1_act_tab.
append set1_act_tab.
endat.
clear set1_act_tab.
endloop.
sort set1_act_tab by kostl.
delete set1_act_tab where amt_atd = 0.
endform. "get_cobrb_data
*& Form get_act_ytd_data
Get the Actual YTD Data from Database Table BSIS
form get_act_ytd_data.
clear it_act_tab.
refresh it_act_tab.
select
bukrs " Company Code
hkont " GL Account No
gjahr " Fiscal Year
belnr " Accounting Doc No
budat " Posting Date
waers " Currency
kostl " Cost Center
shkzg " Dr/Cr Indicator
dmbtr " Doc Amount
into table it_act_tab
from bsis
where bukrs eq p_bukrs and
gjahr eq p_gjahr and
budat le p_date and
kostl in rn_kostl.
if sy-subrc = 0.
sort it_act_tab by bukrs hkont.
loop at it_act_tab.
if it_act_tab-shkzg = c_h.
it_act_tab-dmbtr = it_act_tab-dmbtr * -1.
endif.
move-corresponding it_act_tab to act1_tab.
collect act1_tab.
clear act1_tab.
endloop.
sort act1_tab by bukrs kostl hkont.
endif.
Cost Center wise Sum Up of Costs
loop at act1_tab.
at end of kostl.
sum.
move-corresponding act1_tab to act2_tab.
append act2_tab.
endat.
clear act2_tab.
endloop.
sort act2_tab by gjahr kostl.
Seperate the different Actual YTD Expenditures
loop at act1_tab.
Actual YTD (Operations & Support Cost)
if not s_opers[] is initial.
if act1_tab-hkont in s_opers.
v_a_oper_amnt = v_a_oper_amnt + act1_tab-dmbtr.
endif.
endif.
Actual YTD (Depreciation)
if not s_deprc[] is initial.
if act1_tab-hkont in s_deprc.
v_a_depr_amnt = v_a_depr_amnt + act1_tab-dmbtr.
endif.
endif.
Actual YTD (Major Maintainance)
if not s_mmain[] is initial.
if act1_tab-hkont in s_mmain.
v_a_main_amnt = v_a_main_amnt + act1_tab-dmbtr.
endif.
endif.
endloop.
Opex Settlement Actual Costs
loop at set_act_tab.
Actual YTD (Operations & Support Cost)
if not s_opers[] is initial.
if set_act_tab-hkont in s_opers.
v_a_oper_amnt = v_a_oper_amnt + set_act_tab-amt_atd.
endif.
endif.
Actual YTD (Depreciation)
if not s_deprc[] is initial.
if set_act_tab-hkont in s_deprc.
v_a_depr_amnt = v_a_depr_amnt + set_act_tab-amt_atd.
endif.
endif.
Actual YTD (Major Maintainance)
if not s_mmain[] is initial.
if set_act_tab-hkont in s_mmain.
v_a_main_amnt = v_a_main_amnt + set_act_tab-amt_atd.
endif.
endif.
endloop.
Convert Amount Fields to nearest thousands
v_a_oper_amnt1 = v_a_oper_amnt / c_thous .
v_a_depr_amnt1 = v_a_depr_amnt / c_thous .
v_a_main_amnt1 = v_a_main_amnt / c_thous .
endform. " get_act_ytd_data
*& Form get_wbs_data
Get the WBS Element Data
form get_wbs_data.
clear wbs_tab.
refresh wbs_tab.
select pspnr " WBS Element
posid " WBS Structure Element
objnr " Object No
psphi " Project ID
pbukr " Company Code
pkokr " Controlling Area
fkstl " Cost Center
into table wbs_tab
from prps
where pbukr = p_bukrs and
pkokr = c_kokrs and
fkstl in rn_kostl and
prart = c_prart.
Consider only the Same Year WBS Elements Data
loop at wbs_tab.
v_yr = wbs_tab-posid+5(2).
if v_yr <> p_gjahr+2(2) .
delete wbs_tab index sy-tabix.
endif.
clear: v_yr, v_gl.
endloop.
sort wbs_tab by pspnr posid.
endform. "get_wbs_data
*& Form get_net_ord_data
Get the Network, Orders Data for the WBS
form get_net_ord_data.
Get the Network data
clear: net_tab, ord_tab.
refresh: net_tab, ord_tab.
if not wbs_tab[] is initial.
select a~aufnr " Order No
a~ftrmi " Release Date
a~pronr " Project No
b~aufpl " Routing No
b~aplzl " Counter No
b~objnr " Object No
b~projn " WBS Element
into table net_tab
from afko as a join afvc as b
on aaufpl eq baufpl
for all entries in wbs_tab
-
Hi All;
I have a field called createdon
Using this field i need to create the SSRS expression for the table as below
Any help much appreciated
Thanks
Pradnya07use expressions as below
assuming this is to be done in SSRS
Today
=COUNT(IIF(
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
Yesterday
=COUNT(IIF(
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
LastWeek
=COUNT(IIF(
DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
Last fortnight
=COUNT(IIF(
(DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
Last Month
=COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
Year To Date
=COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
And
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to fetch year till date value for earning for current ,last and year
hi,
how to fetch year till date value for earning for current ,last and year before that from payroll result
plz reply soon,
pratyushDear Pratyush,
Pick this from CRT.
Use LDB PNPCE & Fire event GET PAYROLL &
then you can pick from CRT.
Hope this helps.
Kindly reward in case useful.
Regards & Thanks,
Darshan Mulmule -
Table for Year to date payments made to vendors
Hi friends,
I am generating one query, in which I have to show year to date payments made to vendors.
can anyone tell me from which table and from which foield can I get this information.
Please help.hi,
GO to SE16 and select doc type wise , you will get a solution .
i hope it helps you.
regds,
raman -
How to use multiple selection parameters in the data model
Hi, after have looked all the previous threads about how to use multiple selection parameters , I still have a problem;
I'm using Oracle BI Publisher 10.1.3.3.2 and I'm tried to define more than one multiple selection parameters inside the data template;
Inside a simple SQL queries they work perfectly....but inside the data template I have errors.
My data template is the following (it's very simple...I am just testing how the parameters work):
<dataTemplate name="Test" defaultPackage="bip_departments_2_parameters">
<parameters>
<parameter name="p_dep_2_param" include_in_output="false" datatype="character"/>
<parameter name="p_loc_1_param" include_in_output="false" datatype="character"/>
</parameters>
<dataTrigger name="beforeReport" source="bip_departments_2_parameters.beforeReportTrigger"/>
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
select deptno, dname,loc
from dept
&p_where_clause
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_DEPT" source="Q2">
<element name="deptno" value="deptno"/>
<element name="dname" value="dname"/>
<element name="loc" value="loc"/>
</group>
</dataStructure>
</dataTemplate>
The 2 parameters are based on these LOV:
1) select distinct dname from dept (p_dep_2_param)
2) select distinct loc from dept (p_loc_1_param)
and both of them have checked the "Multiple selection" and "Can select all" boxes
The package I created, in order to use the lexical refence is:
CREATE OR REPLACE package SCOTT.bip_departments_2_parameters
as
p_dep_2_param varchar2(14);
p_loc_1_param varchar2(20);
p_where_clause varchar2(100);
function beforereporttrigger
return boolean;
end bip_departments_2_parameters;
CREATE OR REPLACE package body SCOTT.bip_departments_2_parameters
as
function beforereporttrigger
return boolean
is
l_return boolean := true;
begin
if (p_dep_2_param is not null) --and (p_loc_1_param is not null)
then
p_where_clause := 'where (dname in (' || replace (p_dep_1_param, '''') || ') and loc in (' || replace (p_loc_1_param, '''') || '))';
else
p_where_clause := 'where 1=1';
end if;
return (l_return);
end beforereporttrigger;
end bip_departments_2_parameters;
As you see, I tried to have only one p_where_clause (with more than one parameter inside)....but it doesn't work...
Using only the first parameter (based on deptno (which is number), the p_where_clause is: p_where_clause := 'where (deptno in (' || replace (p_dep_2_param, '''') || '))';
it works perfectly....
Now I don't know if the problem is the datatype, but I noticed that with a single parameter (deptno is number), the lexical refence (inside the data template) works.....with a varchar parameter it doesn't work....
So my questions are these:
1) how can I define the p_where_clause (inside the package) with a single varchar parameter (for example, the department location name)
2) how can I define the p_where_clause using more than one parameter (for example, the department location name and the department name) not number.
Thanks in advance for any suggestion
AlexAlex,
the missing thing in your example is the fact, that if only one value is selected, the parameter has exact this value like BOSTON. If you choose more than one value, the parameter includes the *'*, so that it looks like *'BOSTON','NEW YORK'*. So you need to check in the package, if there's a *,* in the parameter or not. If yes there's more than one value, if not it's only one value or it's null.
So change your package to (you need to expand your variables)
create or replace package bip_departments_2_parameters
as
p_dep_2_param varchar2(1000);
p_loc_1_param varchar2(1000);
p_where_clause varchar2(1000);
function beforereporttrigger
return boolean;
end bip_departments_2_parameters;
create or replace package body bip_departments_2_parameters
as
function beforereporttrigger
return boolean
is
l_return boolean := true;
begin
p_where_clause := ' ';
if p_dep_2_param is not null then
if instr(p_dep_2_param,',')>0 then
p_where_clause := 'WHERE DNAME in ('||p_dep_2_param||')';
else
p_where_clause := 'WHERE DNAME = '''||p_dep_2_param||'''';
end if;
if p_loc_1_param is not null then
if instr(p_loc_1_param,',')>0 then
p_where_clause := p_where_clause || ' AND LOC IN ('||p_loc_1_param||')';
else
p_where_clause := p_where_clause || ' AND LOC = '''||p_loc_1_param||'''';
end if;
end if;
else
if p_loc_1_param is not null then
if instr(p_loc_1_param,',')>0 then
p_where_clause := p_where_clause || 'WHERE LOC in ('||p_loc_1_param||')';
else
p_where_clause := p_where_clause || 'WHERE LOC = '''||p_loc_1_param||'''';
end if;
end if;
end if;
return (l_return);
end beforereporttrigger;
end bip_departments_2_parameters;
I've written a similar example at http://www.oracle.com/global/de/community/bip/tipps/Dynamische_Queries/index.html ... but it's in german.
Regards
Rainer -
On iCal this year the date of shrove tuseday is showing on Tuesday 13 of February witch for a start is wrong coz it's a Thursday and wrong because its meant to be in march
kaeandcolesmon,
If you open the recovery drive (partition) it should only have a single folder (Recovery).
To make sure that your not saving restore points to that drive.
See:
Start, Control Panel, System, System Protection tab. Make sure the D drive partition is set to OFF so that it does not save there.
I am a volunteer. I am not an HP employee.
To say THANK YOU, press the "thumbs up symbol" to render a KUDO. Please click Accept as Solution, if your problem is solved. You can render both Solution and KUDO.
The Law of Effect states that positive reinforcement increases the probability of a behavior being repeated. (B.F.Skinner). You toss me KUDO and/or Solution, and I perform better.
(2) HP DV7t i7 3160QM 2.3Ghz 8GB
HP m9200t E8400,Win7 Pro 32 bit. 4GB RAM, ASUS 550Ti 2GB, Rosewill 630W. 1T HD SATA 3Gb/s
Custom Asus P8P67, I7-2600k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX660 2GB, 750W OCZ, 1T HD SATA 6Gb/s
Custom Asus P8Z77, I7-3770k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX670 2GB, 750W OCZ, 1T HD SATA 6Gb/s
Both Customs use Rosewill Blackhawk case.
Printer -- HP OfficeJet Pro 8600 Plus -
Month to Date and Year to date calculation
Hello Experts,
It would be great If you could provide the formula to implement in BO universe or in the Reporting level for the below requirement.
MTD, LastMonth, Year to Date, Last to LastMonth and examples are below.
Last Week:
Eg: Monday through Sunday
Description: Based on Todayu2019s date, select the Monday of the previous week for the start date and Sunday will be the end date.
Example:
If Today is May 22, 2009
The result would be, Monday = May 11, 2009, Sunday = May 17, 2009
MTD:
If Today is May 22, 2009
I need a result MTD = May 1, 2009 u2013 May 21, 2009
LastMonth:
If Today is May 22, 2009
I need a result LastMaont = April 1, 2009 u2013 April 30, 2009
Last to LastMonth:
If Today is May 22, 2009
I need a result LastMaont = March 1, 2009 u2013 March 31, 2009
Thank you.Nisniki,
Here are the methods using WebI:
MTD:
Create a local variable "MTD Start"
=RelativeDate(LastDayOfMonth(RelativeDate(CurrentDate();-30));1)
Create a local variable "MTD End"
=currentdate()
LastMonth
=LastDayOfMonth(RelativeDate(CurrentDate();-30))
Year to Date
create a local variable "YTD Begin"
=ToDate("01/01/"+FormatNumber(Year(CurrentDate());"####");"mm/dd/yyyy")
(reuse "MTD End" or build a "YTD End" variable same as "MTD End")
Last to LastMonth
(similiar to MTD, but using "60" versus "30" to move back two months versus moving back 1 month.
To perform this stuff in the universe requires an understanding of the SQL syntax for the paricular vendor your are working with. ANSI SQL agrees to represent and compute dates uniformly, however, the functions to make it happen varies by the vendor.
Thanks,
John -
Month to Date and Year to Date Scenarios
<b>Dear SAP BI Gurus,
Can anyone please give me guidance how to create a Month to Date and Year To Date Scenarios (Variables perhaps?) for 0SRR_CF_C1? The date is in decimal and not DATE format Im assuming the reason for this is to get the Time variance . Nonetheless, Id like to create a MTD and YTD scenario for reporting.
Much Thanks
Philips Manalaysay</b>Hi,
You should take a look at the blog and doc below.
/people/vikash.agrawal/blog/2006/10/17/enable-trend-reporting-150-by-manipulating-variable-value
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
Regards,
Maybe you are looking for
-
Selectable doesn't works for input field
I wonder that the selectable property doesn't works even for input field in flash 8' I can't see, select, type anything. Is there any reason for it and how can I tackle this issue. But it's not a problem in IE7 and works fine in IE7 even it doesn't d
-
Model Instance Vs Model Object
Hi experts can anyone plz explain me the difference between model instance and model objects. is it necessary to create model instance when dealing with WebService model. also tell me what do u mean by associating model objects. plz explain with refe
-
I have cs6 on my macbook but i want a new one.
i have cs6 on my macbook but i want a new one, my cs6 is one use ony, but can i uninstall it off this macbook to put it on a new macbook pro??
-
I tried to search for this but did not come across anything in forums or MSDN. Why this behavior? Is this correct or just a bug? string.Format("{0:M}", DateTime.Now) -> March 12 It is supposed to give the month number? 3? This works: string.Format("{
-
Any fix for X-FI screech of death? *sound clip included for downlo
http://members.cox.net/arfett/lamexfi.wav You can listen to it for yourself. Happens in certain games like conflict global storm if you turn the music all the way down. That clip happens to be from FEAR Extraction Point in which it happens throughout