Comparing GL Actual Values with BUDGET Values
Hi All,
Do we have any report in SAP, to Compare GL Actual Balances with BUDGET Values.
Regards,
Venkat
Hello,
In General Ledger accounting, there is no budgetary control is available.
Refer Internal Order Accounting or Project System or Funds Management for budgetary control.
Regards,
Ravi
Similar Messages
-
How to Run a Cost Estimate with Budgeted Values parallel to the Std Cost Estiamte
Hi Experts,
My client want to run a parallel cost estimate with Budgeted values for each type of cost in a similar process like standard cost estimate(currently only Std business run only the std. cost estimate). Below will be provided to run the said cost estimate.
1. Budgeted Cost for cost elements against each cost center
2. Re-posting/distribution will be required run to allocate and apportion the cost from service cost centers to Production cost centers
3. All Planned(future) Material Cost will be provided. (note that the valuation strategy of costing variant of standard cost estimate has below sequence
4. Budgeted activity quantities will be provided. (Cost and activity qty for Kp06 and Kp26)
Based on the above data business need to run a cost estimate with budgeted values parallel to the standard cost estimate(based on planned values), which will be compared with actual then Budget at each months.
Simply an alternative cost estimate with budgeted values for a given period for all materials.
Kindly advice the possibility of such a cost estimate in the system and if possible pls. mentioned the Process in order and configuration steps for the same.
Thanks in advance.
AzizHi..
You can define costing variants which have valuation variant for budgeted values parallel to the standard cost estimate in Customizing for Product Cost Controlling.
You can define target cost versions using above costing variants under the customizing transaction OKV6 as below picture.
When you calculate variances, you can check “all target cost version” flag to calculate variances for all target cost versions in the controlling area as below picture.
You can analysis the difference between actual cost and several budget cost using target cost version as below picture. -
How can I compare single value with multiple value...
Hello,
I want to compare one value with multiple values, how can it possible ?
Here in attachment I tried to design same logic but I got problem that when I entered value in y that is compared with only minimum value of x, I don't want that I want to compare y value with all the x value and then if y is less then x while loop should be stop.
I want to do so because in my program some time I didn't get result what I want, for example x values is 4,5,6,7,8 and y value is suppose 6 then while loop should be stop but here it consider only minimum number and its 4 here so while loop is not stop even y is less then 7 and 8. So I want to compare y value with all the entered values of x and if y is less then any of x values then while loop should be stop and led should be ON.
Please guide me how can I do so.....
Solved!
Go to Solution.
Attachments:
COMPARISON.vi 8 KBAnkitRamani wrote:
Thank you very mach for your help..
may be i have solved this ....i have made one change in my vi that instead of min. i select max and max. value is compare with the value of y and then if y is less then the max. while loop will be stop other wise its run continuously.
this is working fine...
any ways thanks again for your help and time...
I have to agree with Lewis - his way is more efficient.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
How to compare single value with multiple values
In my query I have something like this:
A.SOR_CD=B.SOR_CODE where A and B are 2 different tables. This condition is in the where clause. The column in table A has single values but some values in table B have multiple comma separated values (822, 869, 811, ..). I want to match this single
value on the left side with each of the comma separated values. Please let me know how will I be able to do it. The number of comma separated values on the right side may vary.Hi MadRad123,
According to your description, you want to compare single value with multiple values in your query. Right?
In this scenario, the table B has comma separated values, however those comma separated values are concatenated into a string. So we can use charindex() function to return the index of the table A value. And use this index as condition in
your where clause. See the sample below:
CREATE TABLE #temp1(
ID nvarchar(50),
Name nvarchar(50))
INSERT INTO #temp1 VALUES
('1','A'),
('2','A'),
('3','A'),
('4','A'),
('5','A')
CREATE TABLE #temp2(
ID nvarchar(50),
Name nvarchar(50))
INSERT INTO #temp2 VALUES
('1','a,A'),
('2','A,B'),
('3','c'),
('4','A,C'),
('5','d')
select * from #temp1 a inner join #temp2 b on a.ID=b.ID
where CHARINDEX(a.Name,b.Name)>0
The result looks like below:
Reference:
CHARINDEX (Transact-SQL)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to compare dropdown pre value with post value in sharepoint designer list workflow
How to compare dropdown pre value with post value in sharepoint designer list workflow
Hi,
Can you provide more details about your requirement? It would make others easier to find a solution for you.
By default, a workflow will be triggered after submitting data in the NewForm or EditForm.
If you want to monitor the value changed in a drop down menu which is supposed to be in NewForm or EditForm, it would be more appropriate to apply custom JavaScript in the NewForm
or EditForm page.
About how to detect the value changed using JavaScript, the demos in this thread would be helpful:
http://stackoverflow.com/questions/12080098/dropdown-using-javascript-onchange
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Urgent: Formular question: get first/last month value with qty value
We've got a query result as the following:
Jan_2007 -- Feb_2007 -- Mar_2007 -- Apr_2007
0 --- 54 --- 0 --- 3
23 ---0 --- 12 --- 7
In the above query result,
1st row shows the sales quantity in Jan_2007 is 0, in Feb_2007 is 54, in Mar_2007 is 0, and in Apr_2007 is 3.
2nd row shows the sales quantity in Jan_2007 is 23, in Feb_2007 is 0, in Mar_2007 is 12, and in Apr_2007 is 7.
We would like to add a new column to get the first/last month value with quantity, e.g., in 1st row, the 1st month value with quantity value (>0) is Feb_2007, and the last month value with quantity value (>0) is Apr_2007. Therefore the 1st month value with qty is Feb_2007 and the last month value with qty is Apr_2007. In 2nd row, the first month value with qty is Jan_2007 and the last month value with qty is Apr_2007. But how to use formular to get the 1st/last month values with qty?
We will give you reward points!Hello Kevin,
You can create forumula using [Boolean Operator|http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm]
IF<Logic Expression> THEN <Expression1> ELSE <Expression2> can also be made using a formula in the form
You can also use the [AND, OR Logical operators |http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm]to check all the keyfigure columns.
Thanks
Chandran -
User exit or BADI to validate service request value with PO value
Dear gurus,
Is there any userexit or BADI to validate service request value with PO value. Please help me regarding this.
Thanks in advanceHi,
Please check these enhancements (SMOD) for user exits available of transaction ML81N.
SRV_FRM - SRV: Formula calculation (obsolete since 4.0A!)
SRVSEL - Service selection from non-SAP systems
SRVREL - Changes to comm. structure for release of entry sheet
SRVQUOT - Service export/import for inquiry/quotations
SRVPOWEB - Purchase order for service entry in Web
SRVMSTLV - Conversion of data during importing of standard service cat.
SRVMAIL1 - Processing of mail before generation of sheet
SRVLIMIT - Limit check
SRVKNTTP - Setting the account assgnmt category when reading in, if "U"
SRVEUSCR - User screen on entry sheet tabstrip
SRVESSR - Set entry sheet header data
SRVESLL - Service line checks
SRVESKN - Set account assignment in service line
SRVESI - Data conversion entry sheet interface
SRVENTRY - Unplanned part of entry sheet (obsolete since Rel. 3.1G)
SRVEDIT - Service list control maintenance/display)
SRVDET - User screen on tab strip of service detail screen
INTERFAC - Interface for data transfer
Regards,
Ferry Lianto -
Compare current value with previous value
Hello,
I would like to compare the current value with the previous value of the current value.
How can I solve this problem?
MauritsHi,
after going through the basics course you surely can understand that example:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
I want to compare two columns and replace any equal values with the value in a specific cell
I want to compare the numbers in two columns and replace all matching numbers in the second columns with the corresponding value from a cell in the same row as the matching number.
Me too.
Barry -
Replacing the old value with new value on the website
Hi ,
I have two input fields CLIN # and PR#.When i enter the text,for the first it is working fine,second time when i enter it is replacing the value which i enter with the first one.I should not replace the old value.
ex:
Example when i enter test5 for the first time
CLIN # :Test 5
Next when i enter Test6 ,this value replaces the first one
CLIN#: Test6
CLIN#:Test6(there is no test5)
I am doing for my istore application.Any ideasAs the user that created the anonymous block ruun:
select count(*) from general_acct_mast_table;
and
select tbaadm.count(*) from general_acct_mast_table;I strongly suspect that they are actually two different tables, and the tbaadm version is substantially larger that the non-qualified one.
In any case I would not be doing this as a row-by-row procedure. I would create two lookup tables like:
create table masked_general as
select acid, foracid, round(dbms_random.value(81000000,85000000)) masked
from (select distinct acid, foracid
from general_acct_mast_table
where acct_ownership not in ('O'));
create table masked_stmnt as
select * from masked_general;
alter table masked_general add constraint masked_general_pk
primary key (acid);
alter table masked_stmnt add constraint masked_stmnt_pk
primary key (foracid);Then do the updates as:
update (select g.foracid, g.acid, gm.masked
from general_acct_mast_table g
join masked_general gm
on g.acid = gm.acid)
set foracid = masked;
update (select s.foracid, sm.masked
from mini_stmnt_details_table s
join masked_stmnt sm
on s.foracid = sm.acid)
set foracid = masked;Note that this assumes that both acid and foracid are individually unique in general_acct_mast_table, which seems to be implied by your procedure, and that you want to be able to roll the whole thing back if there are problems (that is, you do not want to commit between the update of general_acct_mast_table and mini_stmnt_details_table).
I would also probably a a verification step after creating the first masked table to ensire that you did get unique vluaes back fo the masked column.
John -
Want to sort HashMap based on Values with duplicate values
Hi. I have a requirement to sort the HashMap based on the values not on the keys. My HashMap contains the values which are duplicates. My program is some thing like this.
Map m = new HashMap();
m.put ("Gosling", new Integer(2000));
m.put ("Joy", new Integer(2000));
m.put ("Schwartz", new Integer(3000));
m.put ("Bracha", new Integer(4000));
m.put ("Gafter", new Integer(3000));
still i need to sort HashMap based on the values. How can i do it. I want the output some like this.
Gosling 2000
joy 2000 (may be interchanged)
Schwartz 3000
Gafter 3000 (Same as above)
Bracha 4000
Thanks.I found syntactical problems with above mentioned code.
Here is edited working version:
* test sortMap
public void testSortMap () {
Map m = new HashMap();
m.put ("IGGHHG", new Integer(232353453));
m.put ("ASDF", new Integer(345555000));
m.put ("DSF", new Integer(345555000));
m.put ("XYZ", new Integer(45555555));
m.put ("AAA", new Integer(0));
ArrayList outputList = sortMap(m);
int count = 0;
count = outputList.size();
while(count > 0) {
Map.Entry entry = (Map.Entry) outputList.get(--count);
System.out.print("Key:" + entry.getKey());
System.out.println("\tValue:" + entry.getValue());
* This method will use Arrays.sort for sorting Map
* @param map
* @return outputList of Map.Entries
public ArrayList sortMap(Map map) {
ArrayList outputList = null;
int count = 0;
Set set = null;
Map.Entry[] entries = null;
// Logic:
// get a set from Map
// Build a Map.Entry[] from set
// Sort the list using Arrays.sort
// Add the sorted Map.Entries into arrayList and return
set = (Set) map.entrySet();
Iterator iterator = set.iterator();
entries = new Map.Entry[set.size()];
while(iterator.hasNext()) {
entries[count++] = (Map.Entry) iterator.next();
// Sort the entries with your own comparator for the values:
Arrays.sort(entries, new Comparator() {
public int compareTo(Object lhs, Object rhs) {
Map.Entry le = (Map.Entry)lhs;
Map.Entry re = (Map.Entry)rhs;
return ((Comparable)le.getValue()).compareTo((Comparable)re.getValue());
public int compare(Object lhs, Object rhs) {
Map.Entry le = (Map.Entry)lhs;
Map.Entry re = (Map.Entry)rhs;
return ((Comparable)le.getValue()).compareTo((Comparable)re.getValue());
outputList = new ArrayList();
for(int i = 0; i < entries.length; i++) {
outputList.add(entries);
return outputList;
}//End of sortMap -
[8i] Best way to replace "similar" values with one value...?
Below is some sample data:
Sorry for the large set / complex set of sample data, but there should be no need to go through it in detail =).
2 things to keep in mind:
1) This is an 8i db
2) I cannot create any new tables within this db, though I can create views
CREATE TABLE ord_master
( part_nbr CHAR(25)
, ord_nbr CHAR(10)
, sub_ord_nbr CHAR(3)
, ord_type CHAR(2)
, ord_stat CHAR(2)
, date_closed DATE
-- please note, though none of the columns in ord_master are explicitly defined as NOT NULL,
-- none of them are NULL in the db, and given how things are input into the table, I don't
-- even think it's possible
-- a unique order is described by ord_nbr, sub_ord_nbr. there should only be one record in
-- this table for a given unique combination of those columns, though they are not the p.k.
-- NOTE: dates default to 12/31/1900, so in the table above, if an order is still open (thus,
-- not closed), it's date_closed will be 12/31/1900. It will only change once the order closes.
INSERT INTO ord_master
VALUES ('ABC-123','1','1','AA','CL',TO_DATE('05/01/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','1','2','AA','CL',TO_DATE('9/14/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','2','1','AA','CL',TO_DATE('12/03/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','3','1','AA','OP',TO_DATE('12/31/1900','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','4','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('XYZ-123','5','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
CREATE TABLE op_detail
( ord_nbr CHAR(10)
, sub_ord_nbr CHAR(3)
, major_seq_nbr CHAR(4)
, wctr_id CHAR(5)
, oper_stat CHAR(2)
, plan_su_rsrc NUMBER(5,2)
, plan_run_rsrc NUMBER(11,8)
, plan_subc_amt NUMBER(15,5)
, act_su_rsrc NUMBER(5,2)
, act_run_rsrc NUMBER(7,2)
, act_subc_amt NUMBER(15,2)
, act_start_dt DATE
, dt_completed DATE
, qty_planned NUMBER(13,4)
, qty_recvd NUMBER(13,4)
, qty_complete NUMBER(13,4)
, qty_scrap NUMBER(13,4)
, qty_on_hold NUMBER(13,4)
-- similar to ord_master, thought none of the columns are explicitly defined as NOT NULL,
-- none of the records have NULL values for any of these columns, and I don't think it's
-- really possible with the way the system is
INSERT INTO op_detail
VALUES ('1', '1', '0081', 'X516 ', 'CP', 0, 0, 0, 0, .2, 0, TO_DATE('02/03/2010', 'mm/dd/yyyy'), TO_DATE('02/03/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .87, 0, TO_DATE('04/06/2010', 'mm/dd/yyyy'), TO_DATE('04/06/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 159, TO_DATE('03/05/2010', 'mm/dd/yyyy'), TO_DATE('03/05/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0130', 'H211 ', 'CP', .5, .1, 0, .08, .63, 0, TO_DATE('02/10/2010', 'mm/dd/yyyy'), TO_DATE('02/10/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0120', 'H214 ', 'CP', .3, .05, 0, 0, .68, 0, TO_DATE('05/22/2009', 'mm/dd/yyyy'), TO_DATE('05/22/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0122', 'T203 ', 'CP', 2.5, 1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0130', 'H211 ', 'CL', .5, .1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 153.12, TO_DATE('06/10/2009', 'mm/dd/yyyy'), TO_DATE('06/10/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .08, 0, TO_DATE('06/17/2009', 'mm/dd/yyyy'), TO_DATE('06/17/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0081', 'X516 ', 'CL', 0, 0, 0, 0, 0, 0, TO_DATE('07/20/2009', 'mm/dd/yyyy'), TO_DATE('07/20/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, 3.03, 0, TO_DATE('09/11/2009', 'mm/dd/yyyy'), TO_DATE('09/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 204.16, TO_DATE('08/11/2009', 'mm/dd/yyyy'), TO_DATE('08/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0130', 'H211 ','CP', .5, .1, 0, 1.97, 2.67, 0, TO_DATE('07/28/2009', 'mm/dd/yyyy'), TO_DATE('07/29/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 255.2, TO_DATE('11/06/2009', 'mm/dd/yyyy'), TO_DATE('11/06/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0130', 'H212 ', 'CP', .5, .1, 0, .6, .03, 0, TO_DATE('10/21/2009', 'mm/dd/yyyy'), TO_DATE('10/21/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0550', 'R501 ', 'WK', 1, 16, 0, 2.2, 12.4, 0, TO_DATE('05/19/2010', 'mm/dd/yyyy'), TO_DATE('12/31/1900', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, .07, 0, TO_DATE('02/04/2010', 'mm/dd/yyyy'), TO_DATE('02/04/2010', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('4', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .59, 0, TO_DATE('02/06/2004', 'mm/dd/yyyy'), TO_DATE('02/06/2004', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);This is the query I'm working with right now:
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END AS wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
, AVG(s.plan_su_rsrc) AS avg_plan_setup
, MAX(s.plan_su_rsrc) AS max_plan_setup
, STDDEV(s.plan_su_rsrc) AS sdev_plan_setup
, MIN(s.plan_run_rsrc) AS min_plan_run
, AVG(s.plan_run_rsrc) AS avg_plan_run
, MAX(s.plan_run_rsrc) AS max_plan_run
, STDDEV(s.plan_run_rsrc) AS sdev_plan_run
, MIN(s.plan_subc_amt) AS min_plan_subc
, AVG(s.plan_subc_amt) AS avg_plan_subc
, MAX(s.plan_subc_amt) AS max_plan_subc
, STDDEV(s.plan_subc_amt) AS sdev_plan_subc
, MIN(s.act_su_rsrc) AS min_act_setup
, AVG(s.act_su_rsrc) AS avg_act_setup
, MAX(s.act_su_rsrc) AS max_act_setup
, STDDEV(s.act_su_rsrc) AS sdev_act_setup
, MIN(s.act_run_rsrc) AS min_act_run
, AVG(s.act_run_rsrc) AS avg_act_run
, MAX(s.act_run_rsrc) AS max_act_run
, STDDEV(s.act_run_rsrc) AS sdev_act_run
, MIN(s.act_subc_amt) AS min_act_subc
, AVG(s.act_subc_amt) AS avg_act_subc
, MAX(s.act_subc_amt) AS max_act_subc
, STDDEV(s.act_subc_amt) AS sdev_act_subc
, MIN(s.act_start_dt) AS min_start
, MAX(s.act_start_dt) AS max_start
, MIN(s.dt_completed) AS min_comp
, MAX(s.dt_completed) AS max_comp
, MIN(s.qty_planned) AS min_qty_plan
, AVG(s.qty_planned) AS avg_qty_plan
, MAX(s.qty_planned) AS max_qty_plan
, STDDEV(s.qty_planned) AS sdev_qty_plan
, MIN(s.qty_recvd) AS min_qty_recvd
, AVG(s.qty_recvd) AS avg_qty_recvd
, MAX(s.qty_recvd) AS max_qty_recvd
, STDDEV(s.qty_recvd) AS sdev_qty_recvd
, MIN(s.qty_complete) AS min_qty_comp
, AVG(s.qty_complete) AS avg_qty_comp
, MAX(s.qty_complete) AS max_qty_comp
, STDDEV(s.qty_complete) AS sdev_qty_comp
, MIN(s.qty_scrap) AS min_qty_scrap
, AVG(s.qty_scrap) AS avg_qty_scrap
, MAX(s.qty_scrap) AS max_qty_scrap
, STDDEV(s.qty_scrap) AS sdev_qty_scrap
, MIN(s.qty_on_hold) AS min_qty_hold
, AVG(s.qty_on_hold) AS avg_qty_hold
, MAX(s.qty_on_hold) AS max_qty_hold
, STDDEV(s.qty_on_hold) AS sdev_qty_hold
, COUNT(*) AS rec_cnt
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM ord_master o
, op_detail s
, ( -- begin in-line view a, to get the min act_start_dt for each order
SELECT s1.ord_nbr
, s1.sub_ord_nbr
, MIN (
CASE
WHEN s1.act_start_dt > TO_DATE('01/01/2000','mm/dd/yyyy')
THEN s1.act_start_dt
END
) AS ord_min_start
FROM op_detail s1
GROUP BY s1.ord_nbr
, s1.sub_ord_nbr
) a -- end in-line view a
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a.ord_nbr
AND o.sub_ord_nbr = a.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
ORDER BY o.part_nbr
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
, s.major_seq_nbrThis gives me a bunch of descriptive statistics on some data stored in the database, broken into groups by the time period.
I have 7 sets of possible values for the column wctr_id that are groups of similar/same work centers, and should be treated as the same, assuming the ord_nbr, sub_ord_nbr, and major_seq_nbr are the same. In my example case statement above, anytime I find 'H211' or 'H212', I am replacing it with 'Z211', which is my new, unique identifier for any wctr in the group ('H211', 'H212'). I have 7 of these sorts of groups that need to be replaced by a new, unique identifier. Is my CASE statement (noted above) the best way to do this, or is there a better way? These groups of similar-to wctr_id's are not listed in a table anywhere.Hi,
As always, thanks for posting the CREATE TABLE and INSERT statements; that's very helpful, and leads to faster, better solutions.
Another thing that is helpful, and promotes faster, better solutions, is to simplify your problem.
For example, you have to compute a lot of aggregates, but it looks like you already know how to do that. This problem only involves the CASE expressions, and how they interact with the GROUP BY clause. So just cut out most of the aggregate functions.
Also, it looks like the intricacies of in-line view a have nothing to do with your current problem. For purposes of posting this problem, pretend that a is a regular view, so it doesn't clutter up the main query.
I think your problem could be restated like this:
You already have a query like this:
CREATE OR REPLACE VIEW a
AS
SELECT s1.ord_nbr
, s1.sub_ord_nbr
, MIN (
CASE
WHEN s1.act_start_dt > TO_DATE('01/01/2000','mm/dd/yyyy')
THEN s1.act_start_dt
END
) AS ord_min_start
FROM op_detail s1
GROUP BY s1.ord_nbr
, s1.sub_ord_nbr
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END AS wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
-- lots of other agtgregates go here in real query
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM ord_master o
, op_detail s
, a -- in real query, a is an in-line view
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a.ord_nbr
AND o.sub_ord_nbr = a.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
ORDER BY o.part_nbr
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
, s.major_seq_nbr
;that produces this output:
` MIN_
PLAN_
PART_NBR OP_N WCTR SETUP TIME_PERIOD
ABC-123 0081 X516 .0 12 mos. back
ABC-123 0130 Z211 .5 12 mos. back
ABC-123 0170 X928 .0 12 mos. back
ABC-123 0324 Y000 .1 12 mos. back
ABC-123 0120 H214 .3 24 mos. back
ABC-123 0122 T203 2.5 24 mos. back
ABC-123 0130 Z211 .5 24 mos. back
ABC-123 0170 X928 .0 24 mos. back
ABC-123 0324 Y000 .1 24 mos. back
ABC-123 0324 Y000 .1 37 mos. back +The output is correct; the problem is, can we get the same results without 2 copies of the wctr CASE expression, and 3 copies of the time_period CASE expression?
Is that a fair description of the problem?
For starters, you can use column aliases in the ORDER BY clause. Unfortunately, that's the only place where you can use column aliases in the same query where they are defined . You can compute them in a sib-query, and then use them in super-queries.
In other words, wouldn't it be nice if we had a table just like op_detail, but with an additional column called wctr? Make a view: either a regular view (especially if wctr, computed the same way, will be used in several different queries) or an in-line view, as shown below.
Wouldn't it be great if there was a table that was just like a, except that it had time_period alreay computed? Make a view: either a regular view or an in-line view, as shown below.
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, s.wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
-- lots of other agtgregates go here in real query
, a2.time_period
FROM ord_master o
, ( -- Begin in-line view s, with data from op_detail
SELECT op_detail.* -- or list all columns needed in main query
, CASE -- replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE wctr_id
END AS wctr
FROM op_detail
) s -- End in-line view s, with data from op_detail
, ( -- Begin in-line view a2, to compute time_period
SELECT a.*
, CASE
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM a -- in real query, a is an in-line view
) a2 -- End in-line view a2, to compute time_period
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a2.ord_nbr
AND o.sub_ord_nbr = a2.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, s.wctr
, a2.time_period
ORDER BY o.part_nbr
, a2.time_period
, s.major_seq_nbr
;In your example, wctr is the same as wctr_id except for two values. If it was more complicated (e.g., if there were not just 2 values that need to be mapped to 'Z211', but also 3 values to were equivalent to 'Z987', and 1 that was to be treated like 'A012', and 5 that should appear as 'A666', and ...), then you could code all that in a humongeous CASE expression (a nested CASE expression, if it involves more that 128 branches), but it really belongs in a table, where you have the raw wctr_id (like 'H211') in one column, and its corresponding equivalent (such as 'Z211') in another. I know you said you can't create new tables; I'm just pointing this out so you can tell the people who won't let you create new tables that it's a bad idea, likely to cause errors and certain to waste time in the future. -
How to modify person or group field value with new value
Hi
I have person or group field having property Person Only.
Thsi firls already have one value. Now I want to update it but this code to update value is not working.
string myName = @"ABC\myname";
web.EnsureUser(myName);
SPUser myUser = web.SiteUsers[myName];
SPFieldUserValue myNamevlaue = new SPFieldUserValue(web, myUser.ID, myUser.LoginName);
oSplistItem["My_x0020_User"] = myNamevalue;
oSplistItem.Update();
I am getting myNamevalue correct in the veriable. But why its not updating in the list?
is there any issue in the above code?
Do I need to delete previous value and then update new value in this field? How?Hi,
The format of the user value in people/Group field must be
ID;#Name, you can use the following code snippets to update the people/group field.
string loginName = "ABC\\myname";
SPUser user = web.SiteUsers[loginName];
SPList list = web.Lists.TryGetList("ListName");
if (list == null)
Console.WriteLine("list is not exist!");
return;
SPListItem item = list.GetItemById(3);
item["My_x0020_User"] = user.ID.ToString() + ";#" + user.Name;
item.Update();
Thanks,
Jason
Please remember to mark the reply as answer if it help, and unmark the answer if it provide no help. -
KF creation - Non-cumulative value with NCUM value change - option
What is the use above option in the KF creation?
ThanksHi,
A non-cumulative is a non-aggregating key figure on the level of one or more objects, which is always displayed in relation to time. Examples of non-cumulatives include headcount, account balance and material inventory.
If you use non-cumulative key figures, an absolute non-cumulative value (the marker) and all non-cumulative value changes are saved in the fact table of the InfoCube. In this way, the retention and volume of data in the data loading process is optimized. A data record is then only loaded to the InfoCube if a non-cumulative changes because of a transaction. Non-cumulatives can then be evaluated at any time in queries, using non-cumulative key figures.
Pls chk this links;
http://sap.seo-gym.com/inventory.pdf
http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/da1640dc88e769e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a62ebe07211d2acb80000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/da1640dc88e769e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a62f8e07211d2acb80000e829fbfe/frameset.htm
Reagrds
CSM Reddy -
Compare turnover actual month with previous month on monthly based report
Hello Gurus,
please help me with the following requirment:
In have a monthly based report with key figure 'turnover'. Now I want to calculate deviation turnover actual month vs turnover previous month from last year. How to handle this?
Example:
CalYear/Month
01.2010 02.2010 03.2010 04.2010
Turnover 10 20 15 20
Calculated xxxx xxxx xxxx xxx
Thank you very much!
MuammerHello voodi,
it doesn't work. With offset function it shows the turnover only in the columns from last year. I need the turnover from last year in the columns from this year. Any ideas?
Expected:
CalYear/Month
01.2010 02.2010 03.2010 04.2010
Turnover 10 20 15 20
Turnover last year xxxxx xxxxx xxxxxx xxxxx
With offset -12
CalYear/Month
01.2009 02.2010 ... 01.2010 02.2010 03.2010 04.2010
Turnover 20 50 .... 10 20 15 20
Turnover last year 20 50 ... blank blank blank blank
Thank you!
Muammer
Maybe you are looking for
-
How do I transfer information from external hard drive
I just had the (SeaGate) hard drive replaced on my daughter's Mac. What are the on screen choices after the Welcome Screen? I think my daughter may have clicked the wrong thing because now I seem to be having a problem getting her backed up info fr
-
Help required in Weblogic 6 - Creation & Configuration of Web Application
Forum Home > Enterprise JavaBeans[tm] Topic: Help required in Weblogic 6 - Creation & Configuration of Web Application Duke Dollars 2 Duke Dollars assigned to this topic. Reward the best responses to your question using the icons below, or transfer a
-
How to release the cancelled transport request ...
Hi Experts, i have released a TR and it was cancelled bcos my system is very slow. Once the system is up,i was tried to release the TR.But i am not able to release it. Please help me on this. Thanks, Babu
-
Union select as cursor in procedure
Hi! With ref. to an earlier post from Sept. 11, 2009, I am facing the following problem: In my procedure I have this statement as a cursor: SELECT a.carrier_code, a.flight_no, a.from_city, a.origin, a.dept_time, a.to_city, a.destination, a.arr_time,
-
Are videos supposed to play embedded in safari ?
In facebook or you tube on safari the videos will not play, YouTube asks for flash and facebook only shows me the thumbnail of the video,no play button, is this normal?