Query for MAP Calculation - Price Control ind V and S

SAP Guru's
Query regarding MAP Calculation Logic
Scenario:
*I have one material xyz
1. It is split valuated material,
2. Two valuation types with diff price control indicators
3. Batch Management is also activated on this material.*
Follwoing is the Material Master Accounting1 View :
Vauation Type     Price Control     Total Value     Qty     MAP                  Batch     
     ZA1          V                     610835.00             37     16509.05(V)          01
     ZB1          S                     0                  1     20000.00(S)          02
but when we are running MM03 w/o Valuation Type Accounting 1 View
is showing MAP as 16074.60 i.e. 610835.00/38
Diff. Reports Output------>
MB5L - List of Stock Values: Balances --> Output
ValArea          Total Stock          Total Value
A101               1                          0
A101               37                          610835.00
Net-->               38                  610835.00
MB52 - Display Warehouse Stocks
Check Box - Display Batch Stocks
Condition1: When Display Batch Stocks is selected on main screen of MB52
Mat.     Palnt      Sloc      Unrestricted     Stck in Transit          Total Value
xyz     A101     0010      0                    30                       482238.00
XYZ     A101     0010      7                    0                       115563.00
xyz     A101     0010      1                    0                        0
This is not correct result as Total Values is 597801.00 only      
Condition2: When Display Batch Stocks is not selected on main screen of MB52
Mat.     Palnt     Sloc     Unrestricted     Stck in Transit          Total Value
xyz     A101     0010         0                  30                       482238.00
XYZ     A101     0010         8                   0                       128597.00
This is correct result as Total Values is 610835 .00 only
So my query on above issue is :
1. How System is including 1 Qty of Std Price Control for MAP calculation?
As per my understanding MAP is only for Price Control V indicator Materials Stock
2. Whats the difference between these two report output from MM03 Accounting
   view?
Thanks

hi Animesh,
For Split Valuated Material at header level Price control is always "V" i.e. Moving average price reagrdless of the Price control you have given for different valuation types.
Due to this you are getting these kind of results. Please visit the following link for more information
http:///saphelp/EN/8f/d1de34e4cb2300e10000009b38f83b/frameset.htm
Check it and revert back.
Regards,
Jay
Edited by: SAP_MM on Dec 4, 2008 10:19 AM

Similar Messages

  • Functions for mapping Latin-1 character codes to and from WinLatin-1  character codes

    HI ALL
    I will like to know how could i write own functions for mapping Latin-1 character codes to and from WinLatin-1
    character codes.
    Can show me some source code or how to mapping it. Because i just begineer.
    Hope you able to help me..

    I see your issue. I tried to reproduce this issue using sqlplus.
    Setup NLS_LANG as you mentioned using WE8ISO8859P1 and connect to a UTF8 db.
    [oracle@server ~]$ locale -a | grep en_US
    en_US
    en_US.iso88591
    en_US.iso885915
    en_US.utf8
    [oracle@server ~]$ export LC_ALL=en_US.iso88591
    [oracle@server ~]$ locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.iso88591"
    LC_NUMERIC="en_US.iso88591"
    LC_TIME="en_US.iso88591"
    LC_MEASUREMENT="en_US.iso88591"
    LC_IDENTIFICATION="en_US.iso88591"
    LC_ALL=en_US.iso88591
    [oracle@server ~]$ echo $NLS_LANG
    AMERICAN_AMERICA.WE8ISO8859P1
    SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
    AL32UTF8
    SQL> select nchr(223) from dual;
    NCHR
    ß
    SQL> select chr(223) from dual;
    ERROR:
    ORA-29275: partial multibyte character
    SQL> SELECT CHR (223 USING NCHAR_CS) from dual;
    C
    ß
    SQL>  select  CONVERT('ß', 'WE8ISO8859P1','UTF8') FROM DUAL;
    CO
    SQL> select  CONVERT(CHR(223 USING NCHAR_CS), 'WE8ISO8859P1','UTF8') FROM DUAL;
    select  CONVERT(CHR (223 USING NCHAR_CS), 'WE8ISO8859P1','UTF8') FROM DUAL
    ERROR at line 1:
    ORA-12703: this character set conversion is not supportedI found that beta is in WE8ISO8859P1 character set
    here[url http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch2charset.htm#NLSPG164]What Characters Does a Character Set Support?
    But I don't really understand whats the problem in the conversion.

  • Query for Auto Calculation based on input of 2 Fields

    Hi,
    I would like to write a sql query to allow for auto calculation based on the Inputs of 2 other fields before Adding the Order.
    For example. A query on Sales Order where I have Item 040634 (Code for a Flower) and Quantity 200.
    I have a UDF (Bunching) where the value is 10, 15 or 20.
    Based on the Bunching the result should be given in another UDF (Noofsleeves).
    (Quantity) 200 / (Bunching) 10 = 10 (Noofsleeves)
    The Order will be having multiple items where the Bunching can differ for each item.
    Is it also possible to remove the calculated noofSleeves from Inventory.
    I am using 2007A SP01 PL05

    Hi ,
    You may try this: Apply this fms on other udf and auto refresh on the udf mentioned in the query (in your case Bunching).
    SELECT $[RDR1.Quantity.number] / $[RDR1.U_UDF.number]
    You may check these too.
    cALCULATION OF udf ON UNIT PRICE
    FMS
    Thanks,
    joseph
    Edited by: Joseph Antony on Jul 8, 2010 12:31 PM

  • MR21 for split valuation & price control "V"

    hi all,
    Case: Split valuation is activated but parent has price control "V" and child i.e. diff valuation types have "S". We want to make std prices of all valuation types "0". It is done but the parent still shows value in MAP.
    a. How do we make MAP of parent as "0" (price control "V"), will it allow?
    b. Will it impact and how e.g. MB5L
    c. Is it ok if we ignore the valuation of parent
    d. All valuation types under parent are made "0"
    Thx
    Bhushan

    Hi
    The price control at the plant level will always be V,where at the valuation type level either V or S can be maintianed.It is not recommeneded to ignore the valuation class at the plalnt level in case of split valuation because if you are going for costing run then this needs to be maintained.becoz cost of a material procured needs to be determined at plant level
    Regards
    Sandeep
    Edited by: sandeep13 on Feb 8, 2010 12:49 PM

  • Production costs for material with price control V

    Dear all,
    Can anyone pls tell me, how will the costing occur for a material produced in-house and having price control 'V' ? I am not able to see the target costs.
    Also kindly tell me the settings to be done in CO, like target cost version, valuation variant, costing variant, etc.
    Thank you,
    Shrenik

    Rather than giving my own versions I have compiled here SAP inputs. Pl let me know if you require any clarifications:
    Costing variant has the following components:
    <b>Define Costing Types
    Define Valuation Variants
    Define Date Control
    Define Quantity Structure Control
    Define Transfer Strategy
    Define Reference Variants</b>
    <u>Costing type:</u>
    In the costing type, you define the purpose of a material cost estimate by specifying, for example, which field in the material master record the costing results can be transferred to:
    Update Cost Estimate
    Standard price Standard cost estimate (01)
    Tax-based price Inventory cost estimate
    Commercial price Inventory cost estimate
    Price other than std price Modified standard cost estimate or
    current cost estimate
    No update Any cost estimate
    Define Valuation Variants:
    Define Valuation Variants
    Here you create a valuation variant containing the parameters required for valuation of a cost estimate.
    You also specify which costing sheet should be used to calculate overhead.
    Valuation Strategies
    Material valuation
    Here you define the sequence in which the system searches for prices from the accounting view or costing view of the material master record to valuate materials. You can also access prices from purchasing info records and condition types.
    For material cost estimates, you also specify whether additive costs can be added to the selected price.
    With configurable/configured material components and with procurement alternatives, the sequence defined here is ignored if the strategy "price from purchasing info record" was selected, in which case that strategy is always executed first. For more information, refer to the SAP Library in the component Product Cost Planning under Raw Material Costing or Mixed Costing.
    Activity Types / Processes
    Here you define the sequence in which the system searches for prices in activity type planning or actual activity price calculation in Cost Center Accounting or Activity-Based Costing to valuate the utilized activity types and business processes.
    You also specify which plan/actual version is used.
    Subcontracting
    Here you define the sequence in which the system searches for prices in the purchasing info record. In purchasing, quota arrangements are used to create a mixed price for materials that are manufactured with external vendors with parts provided by the customer. You can specify whether the quota of the individual vendors that are entered in the source list for the material to be processed should be determined through the planned quota arrangement or the actual quota arrangement.
    External processing
    Here you define the sequence in which the system searches for prices in the purchasing info record or routing operation for valuation of the external activities.
    Strategy Sequence
    You define the individual valuation methods for the valuation variant as strategy sequences. For the valuation of the material components you define a strategy sequence that reads the fields of the material master record in a particular sequence such as:
    1. Planned price 1
    2. Standard price
    3. Moving price
    The first price that is not zero is used to valuate the material component.
    Target versions:
    Target cost versions  are used in the following ways:
    In variance calculation:
    To control which variance (total variance, production variances or planning variance) is calculated
    To valuate unplanned scrap( scrap variance)
    Unplanned scrap is valuated in the period-end closing activities when the variances are calculated. You can specify in a valuation variant for WIP and scrap which cost estimate you want to use to calculate the target costs for the valuation of unplanned scrap. You assign the valuation variant to target cost version 0 if you want to include it in the valuation of scrap.
    When you are using a cost object hierarchy with active distribution, you use the target cost version to control which cost estimate the system uses to calculate the target costs, which are used as the basis for determining equivalences for actual cost distribution.
    The actual costs collected at the level of the hierarchy are distributed across the orders in accordance with these equivalences. This distribution is proportional to the target costs for the cost element under which the actual costs are written. Actual costs for material costs are distributed in proportion to the target costs for the origin group, such as for the material, if you have entered an origin group in the costing view of the material master record and have set the indicator Material origin, for example.
    If no target costs were calculated under this cost element, enter a cost element group in the target cost version. The actual costs are distributed in proportion to the target costs for this cost element group. This cost element group should be complete. If costs were updated under a cost element that is not in this cost element group, no distribution is possible.
    You can calculate equivalences on the basis of SAP standard target cost versions 0, 1 and 3.
    The standard system supplies the following target cost versions:
    Target cost version 0 ( total variance)
    The amount of the total variance generates a posting in Financial Accounting during settlement.
    For this version, select actual costs as the control costs and standard cost estimate as the target costs.
    Target cost version 1 ( production variance)
    For this version you choose actual costs as the control costs and planned costs as the target costs.
    Target cost version 2( planning variance)
    With target cost version 2, the costs from the preliminary order cost estimate are interpreted as control costs.
    For this version, select planned costs as the control costs and current cost estimate as the target costs. You cannot calculate planning variances for the product cost collector.
    Target cost version 3 (production variance of the period)
    You compare the planned costs of the period calculated on the basis of an alternative material cost estimate (such as a modified standard cost estimate) with the actual costs of the period on the basis of the yield delivered to stock in the period.
    The base quantity for variance calculation is the yield.
    For this version, you choose the actual costs as the control costs and the alternative material cost estimate as the target costs. To determine the alternative material cost estimate, enter a costing variant and choose a costing version.
    The target cost version specifies which data is to be compared. The target cost version also specifies which variance variant is used and therefore which variance catagories are calculated. You can define a different target cost version for each controlling area

  • CK40N - Update for material with price control 'V'

    i Experts,
    When im running standard cost estimate in CK40N, say for material types semi finished. The components that is raw materials of the SFG is also updated with the price, meaning for a raw material with price control 'V' has a price of 10, after
    releasing the cost estimate for the SFG, when i look into the material master of raw material, the price of 10 is also updated
    in the standard price.
    I am not sure why this is happening, i believe it should not happen. Because in the valuation variant, if i give the strategy as standard price, this price is easily picked up. And more over with price control 'V', i can change the standard price. Can anybody throw some light on this.
    Best regards
    gj

    Hi Rakesh,
    Thanks for the information. But i do agree even during release there is no impact on the inventory. But in my cost variant, say in PPC1, if i give the strategy say 1. standard price 2. moving average price, during cost estimate run, its going to take the standard price for the material irrespective of the price derived automatically for moving average price. For eg in our case for raw material with price control 'V' after sce run if the standard price is 10 and moving average price is 14, as per strategy of PPC1 above its going to take 10 and not 14.
    Is there any other way to avoid this. Please correct me if i had went wrong somewhere.
    Best regards
    gj

  • JDOQL querying for Map entry

    Hello,
    Here's some setup:
    /* This object contains a Map that ties a
    * Company (key) to a String ID (value).
    public class MyObject {
    private Map company2id = new HashMap();
    Example Data:
    MyObject1 map:
    Key[Company1], Value["ID1"]
    Key[Company2], Value["ID2"]
    MyObject2 map:
    Key[Company1], Value["ID2"]
    Key[Company2], Value["ID1"]
    Now I want to query for the MyObject instance that has an entry in that
    map
    with a key of Company1 and a value of "ID1". How do I do that?
    I can't query for a map that has a key of Company1 and a value of "ID1"
    because that would return both MyObject instances. Instead, I have to
    query
    for the entry that has those values as both key and value. I hope that
    sentence made sense.
    So this doesn't work: "company2id.containsKey(myCompany) &&
    company2id.containsValue(myId)"
    What I need is something like:
    "company2id.containsEntry(myCompany, myId)" or
    "company2id.containsKey(myCompany) && entry.value == myId"
    What would you recommend I do? Is there a custom extension I can use?
    Use
    SQL?
    It seems like this might be a common need.
    thanks,
    dave

    What would you recommend I do? Is there a custom extension I can use?
    Use
    SQL?
    It seems like this might be a common need.You can use a pure SQL query, SQL embedded in the JDOQL query (with our
    ext:sql extension in 3.2b2, or ext:sqlVal/ext:sqlExp for 3.1.x), or
    write your own JDOQL extension that emits the right SQL. Our reference
    guide has a section on query extensions you'll want to check out.
    I agree, though, that it's a fairly common need, and we'd like to
    include a standard Map.get() extension in the future (it may even become
    a standard supported method in JDO 2).

  • Terms user query Changes in unit price in purchase order and a/p invoice

    Dear sir
         please give me a term user query for , if any changes in unit price in purchase order and a/p invoice

    Hi,
    Try this:
    SELECT  Distinct ' true'
    FROM adoc T2
    JOIN ado1 T0 ON T2.docentry = T0.docentry AND T2.Objtype = '22'
    JOIN por1 T1 ON T1.docentry = T0.docentry AND T1.Linenum=T0.Linenum
    WHERE  $[$38.14.number] != T0.Price
    Thanks & Regards,
    Nagarajan

  • SAP B1 query for turnover in sales sorted by item and supplier.

    Hello experts,
    please, is it possible to create a query SAP B1 for finding turnover in sales by item and supplier? I would need to know exact total quantity of sold items sorted by supplier.
    Is it possible?
    Thank you in advance 
    jonmar7

    Try to include Credit Memo in this way:
    SELECT T4.CardCode,T4.CardName, SUM(T0.Price * T0.Quantity) AS turnover,SUM(T0.Quantity) AS QTY, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
    FROM INV1 T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T2.ItmsGrpCod = T1.ItmsGrpCod INNER JOIN OINV T3 ON T3.DocEntry = T0.DocEntry INNER JOIN OCRD T4 ON T1.CardCode = T4.CardCode INNER JOIN OCRG T5 ON T4.GroupCode = T5.GroupCode
    WHERE T4.CardName LIKE '[%0]%'AND T3.DocDate Between [%1] AND [%2]
    GROUP BY T4.CardCode, T4.CardName, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
    UNION ALL
    SELECT T4.CardCode,T4.CardName, SUM(-T0.Price * T0.Quantity) AS turnover,SUM(-T0.Quantity) AS QTY, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
    FROM RIN1 T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T2.ItmsGrpCod = T1.ItmsGrpCod INNER JOIN ORIN T3 ON T3.DocEntry = T0.DocEntry INNER JOIN OCRD T4 ON T1.CardCode = T4.CardCode INNER JOIN OCRG T5 ON T4.GroupCode = T5.GroupCode
    WHERE T4.CardName LIKE '[%0]%'AND T3.DocDate Between [%1] AND [%2]
    GROUP BY T4.CardCode, T4.CardName, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
    Inventory transfer should not affect your sales at all.  As for A/R Correction Invoice, you need to include OCSI and CSI1 tables.  We don't have those data to try.  You have to add them by yourself.

  • SQL Query for mapping a set of batches to a class rooms group

    Hi All,
    I am using Oracle 11g Release 2 database.
    I have the following data set:
    ClassRooms
    ClassId ClassName                    Capacity     Group
    1 Babbage/Software Engg Lab          24          1
    2     Basement - PG Block               63          1
    3     Classroom 1                    56          1
    4     Classroom 10                    24          1
    5     Classroom 11                    24          1
    6     Classroom 12                    35          1
    7     Classroom 13                    42          1
    8     Classroom 14                    42          1
    9     Classroom 15                    42          1
    10     Classroom 2                    35          1
    11     Classroom 3                    35          1
    12     Classroom 4                     35          1
    13     Classroom 5                    35          1
    14     Classroom 6                    25          1
    15     Classroom 7                    25          1
    16     Classroom 8                    24          1
    17     Classroom 9                    24          1
    18     Control Sys Lab                    24          1
    19     Dig & Embd Sys Lab               20          1
    20     DSP & Comm Lab                    20          1
    21     Electromechanical System Lab     28          1
    22     Farabi/Web Tech Lab               36          1
    23     Gen Purpose Lab                    40          1
    24     Shirazi/DB Tech Lab               36          1
    25     Adv Elect Lab                    30          2
    26     Classroom 16                    42          2
    27     Classroom 17                    49          2
    28     Classroom 18                    56          2
    29     Classroom 19                    42          2
    30     Classroom 20                    49          2
    31     Classroom 21                    35          3
    32     Classroom 22                    35          3
    33     MDA Lab                         20          3
    DegreeBatches
    BatchId      BatchName Strength
    1          BIT-11          79          
    2          BIT-12          28          
    3          BS(CS)-1          35          
    4          BS(CS)-2          78          
    5          BE(SE)-1          69          
    6          BE(SE)-2          84          
    7          BE(SE)-3          64          
    8          BICSE-7          84          
    9          BICSE-8          43          
    10          BEE-1          112          
    11          BEE-2          151          
    12          BEE-3          157          
    13          BEE-4          157          
    I want to map a degree batch combination to a class rooms group in such away that they fully utilize maximum capacity of the class rooms within a group (Ideal case) or as close to it as possible. Can it be done with a SQL query?
    Any response will be highly appreciated.
    SQL Scripts to generate the required tables and populate data is below:
    CREATE TABLE ClassRooms (ClassId NUMBER, ClassName     VARCHAR2(50), Capacity NUMBER, Group NUMBER);
    INSERT INTO ClassRooms VALUES(1,'Babbage/Software Engg Lab',24,1);
    INSERT INTO ClassRooms VALUES(2,'Basement - PG Block',63,1);
    INSERT INTO ClassRooms VALUES(3,'Classroom 1',56,1);
    INSERT INTO ClassRooms VALUES(4,'Classroom 10',24,1);
    INSERT INTO ClassRooms VALUES(5,'Classroom 11',24,1);
    INSERT INTO ClassRooms VALUES(6,'Classroom 12',35,1);
    INSERT INTO ClassRooms VALUES(7,'Classroom 13',42,1);
    INSERT INTO ClassRooms VALUES(8,'Classroom 14',42,1);
    INSERT INTO ClassRooms VALUES(9,'Classroom 15',42,1);
    INSERT INTO ClassRooms VALUES(10,'Classroom 2',35,1);
    INSERT INTO ClassRooms VALUES(11,'Classroom 3',35,1);
    INSERT INTO ClassRooms VALUES(12,'Classroom 4',35,1);
    INSERT INTO ClassRooms VALUES(13,'Classroom 5',35,1);
    INSERT INTO ClassRooms VALUES(14,'Classroom 6',25,1);
    INSERT INTO ClassRooms VALUES(15,'Classroom 7',25,1);
    INSERT INTO ClassRooms VALUES(16,'Classroom 8',24,1);
    INSERT INTO ClassRooms VALUES(17,'Classroom 9',24,1);
    INSERT INTO ClassRooms VALUES(18,'Control Sys Lab',24,1);
    INSERT INTO ClassRooms VALUES(19,'Dig & Embd Sys Lab',20,1);
    INSERT INTO ClassRooms VALUES(20,'DSP & Comm Lab',20,1);
    INSERT INTO ClassRooms VALUES(21,'Electromechanical System Lab',28,1);
    INSERT INTO ClassRooms VALUES(22,'Farabi/Web Tech Lab',36,1);
    INSERT INTO ClassRooms VALUES(23,'Gen Purpose Lab',40,1);
    INSERT INTO ClassRooms VALUES(24,'Shirazi/DB Tech Lab',36,1);
    INSERT INTO ClassRooms VALUES(25,'Adv Elect Lab',30,2);
    INSERT INTO ClassRooms VALUES(26,'Classroom 16',42,2);
    INSERT INTO ClassRooms VALUES(27,'Classroom 17',49,2);
    INSERT INTO ClassRooms VALUES(28,'Classroom 18',56,2);
    INSERT INTO ClassRooms VALUES(29,'Classroom 19',42,2);
    INSERT INTO ClassRooms VALUES(30,'Classroom 20',49,2);
    INSERT INTO ClassRooms VALUES(31,'Classroom 21',35,3);
    INSERT INTO ClassRooms VALUES(32,'Classroom 22',35,3);
    INSERT INTO ClassRooms VALUES(33,'MDA Lab',20,3);
    CREATE TABLE DegreeBatches (BatchId NUMBER, BatchName VARCHAR2(50), Strength NUMBER);
    INSERT INTO DegreeBatches VALUES(1,'BIT-11',79);          
    INSERT INTO DegreeBatches VALUES(2,'BIT-12',28);          
    INSERT INTO DegreeBatches VALUES(3,'BS(CS)-1',35);          
    INSERT INTO DegreeBatches VALUES(4,'BS(CS)-2',78);          
    INSERT INTO DegreeBatches VALUES(5,'BE(SE)-1',69);          
    INSERT INTO DegreeBatches VALUES(6,'BE(SE)-2',84);          
    INSERT INTO DegreeBatches VALUES(7,'BE(SE)-3',64);          
    INSERT INTO DegreeBatches VALUES(8,'BICSE-7',84);          
    INSERT INTO DegreeBatches VALUES(9,'BICSE-8',43);          
    INSERT INTO DegreeBatches VALUES(10,'BEE-1',112);          
    INSERT INTO DegreeBatches VALUES(11,'BEE-2',151);     
    INSERT INTO DegreeBatches VALUES(12,'BEE-3',157);     
    INSERT INTO DegreeBatches VALUES(13,'BEE-4',157);     
    Best Regards
    Bilal
    Edited by: Bilal on 27-Dec-2012 09:52
    Edited by: Bilal on 27-Dec-2012 10:07

    Bilal, thanks for the nice problem! Another possibility for duplicate checking is to write a small PL/SQL function returning 1 if a duplicate id is found, then equate it to 0: 'Duplicate_Token_Found (p_str_main VARCHAR2, p_str_trial VARCHAR2) RETURN NUMBER'. This would parse the second string and might use p_str_main LIKE '%,' || l_id || ',%' for each id. Anyway the full query (without that) is given below:
    Solution with names
    SQL> WITH rsf_itm (con_id, max_weight, nxt_id, lev, tot_weight, tot_profit, path, root_id, lev_1_id) AS (
      2  SELECT c.id,
      3         c.max_weight,
      4         i.id,
      5         0,
      6         i.item_weight,
      7         i.item_profit,
      8         ',' || i.id || ',',
      9         i.id,
    10         0
    11    FROM items i
    12   CROSS JOIN containers c
    13   UNION ALL
    14  SELECT r.con_id,
    15         r.max_weight,
    16         i.id,
    17         r.lev + 1,
    18         r.tot_weight + i.item_weight,
    19         r.tot_profit + i.item_profit,
    20         r.path || i.id || ',',
    21         r.root_id,
    22         CASE WHEN r.lev = 0 THEN i.id ELSE r.nxt_id END
    23    FROM rsf_itm r
    24    JOIN items i
    25      ON i.id > r.nxt_id
    26     AND r.tot_weight + i.item_weight <= r.max_weight
    27   ORDER BY 1, 2
    28  ) SEARCH DEPTH FIRST BY nxt_id SET line_no
    29  , rsf_con (nxt_con_id, nxt_line_no, con_path, itm_path, tot_weight, tot_profit, lev) AS (
    30  SELECT con_id,
    31         line_no,
    32         To_Char(con_id),
    33         ':' || con_id || '-' || (lev + 1) || ':' || path,
    34         tot_weight,
    35         tot_profit,
    36         0
    37    FROM rsf_itm
    38   UNION ALL
    39  SELECT r_i.con_id,
    40         r_i.line_no,
    41         r_c.con_path || ',' || r_i.con_id,
    42         r_c.itm_path ||  ':' || r_i.con_id || '-' || (r_i.lev + 1) || ':' || r_i.path,
    43         r_c.tot_weight + r_i.tot_weight,
    44         r_c.tot_profit + r_i.tot_profit,
    45         r_c.lev + 1
    46    FROM rsf_con r_c
    47    JOIN rsf_itm r_i
    48      ON r_i.con_id > r_c.nxt_con_id
    49   WHERE r_c.itm_path NOT LIKE '%,' || r_i.root_id || ',%'
    50     AND r_c.itm_path NOT LIKE '%,' || r_i.lev_1_id || ',%'
    51     AND r_c.itm_path NOT LIKE '%,' || r_i.nxt_id || ',%'
    52  )
    53  , paths_ranked AS (
    54  SELECT itm_path || ':' itm_path, tot_weight, tot_profit, lev + 1 n_cons,
    55         Rank () OVER (ORDER BY tot_profit DESC) rnk,
    56         Row_Number () OVER (ORDER BY tot_profit DESC) sol_id
    57    FROM rsf_con
    58  ), best_paths AS (
    59  SELECT itm_path, tot_weight, tot_profit, n_cons, sol_id
    60    FROM paths_ranked
    61   WHERE rnk = 1
    62  ), row_gen AS (
    63  SELECT LEVEL lev
    64    FROM DUAL
    65  CONNECT BY LEVEL <= (SELECT Count(*) FROM items)
    66  ), con_v AS (
    67  SELECT  b.itm_path, r.lev con_ind, b.sol_id, b.tot_weight, b.tot_profit,
    68          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev - 1) + 1,
    69            Instr (b.itm_path, ':', 1, 2*r.lev) - Instr (b.itm_path, ':', 1, 2*r.lev - 1) - 1)
    70             con_nit_id,
    71          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev) + 1,
    72            Instr (b.itm_path, ':', 1, 2*r.lev + 1) - Instr (b.itm_path, ':', 1, 2*r.lev) - 1)
    73             itm_str
    74    FROM best_paths b
    75    JOIN row_gen r
    76      ON r.lev <= b.n_cons
    77  ), con_split AS (
    78  SELECT itm_path, con_ind, sol_id, tot_weight, tot_profit,
    79         Substr (con_nit_id, 1, Instr (con_nit_id, '-', 1) - 1) con_id,
    80         Substr (con_nit_id, Instr (con_nit_id, '-', 1) + 1) n_items,
    81         itm_str
    82    FROM con_v
    83  ), itm_v AS (
    84  SELECT  c.itm_path, c.con_ind, c.sol_id, c.con_id, c.tot_weight, c.tot_profit,
    85          Substr (c.itm_str, Instr (c.itm_str, ',', 1, r.lev) + 1,
    86            Instr (c.itm_str, ',', 1, r.lev + 1) - Instr (c.itm_str, ',', 1, r.lev) - 1)
    87             itm_id
    88    FROM con_split c
    89    JOIN row_gen r
    90      ON r.lev <= c.n_items
    91  )
    92  SELECT v.sol_id,
    93         v.tot_weight s_wt, v.tot_profit s_pr, c.id c_id, c.name c_name, c.max_weight m_wt,
    94         Sum (i.item_weight) OVER (PARTITION BY v.sol_id, c.id) c_wt,
    95         i.id i_id, i.name i_name, i.item_weight i_wt, i.item_profit i_pr
    96    FROM itm_v v
    97    JOIN containers c
    98      ON c.id = To_Number (v.con_id)
    99    JOIN items i
    100      ON i.id = To_Number (v.itm_id)
    101   ORDER BY sol_id, con_id, itm_id
    102  /
        SOL_ID S_WT S_PR  C_ID C_NAME          M_WT C_WT  I_ID I_NAME     I_WT I_PR
             1  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             2  255  255     1 SEECS UG Block   100   95     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             3  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             4  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             5  255  255     1 SEECS UG Block   100   95     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             6  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             7  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             8  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             9  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            10  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            11  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            12  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            13  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            14  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
    98 rows selected.
    Elapsed: 00:00:01.42Edited by: BrendanP on 20-Jan-2013 11:25
    I found the regex needed to deduplicate:
    AND RegExp_Instr (r_c.itm_path || r_i.path, ',(\d+),.*?,\1,') = 0

  • Query for tax calculation.

    Hi All
    I want to know if it's possible to do calculation using the unit price field in Purchase Order.
    This is what I want to test
    I insert unit price then select the Taxable UDF option (Yes) then the Total(LC) Field ( Standard B1 field must display the amount plus 14% vat and when I select Not taxable it must not apply the 14 % vat.
    The reason why i'm doing this is the client is not a vat vendor ( they dont have to report for tax) so this is just a workaround that i have to expense the whole amount.
    And how to use variables when you want to write a query... like (unit price x 0.14)
    Please any suggestions are welcome.....
    Thanks
    Bongani Dlamini

    Hi Gordon
    "However, the problem start here: how will you use this query result?"
    The calculated amount must appear in the line total field as this field is used for document totaling.
    " Do you want the document total relate to your results?"
    The document total must display the total amount inclusive of VAT , the VAT field must not include any info
    Thanks
    Bongani

  • Query for mapping

    HI,
    I have three tables
    USERS -> USER_ID,NAME,ROLE
    CIRCLES -> CIRCLE_ID,NAME
    USER_CIRCLE_MAP -> USER_ID,CIRCLE_ID
    I want a SQL query that returns all contents in circles table if USERS.ROLE is not 'END_USER'. IF users.role is 'END USER' I want all the circles from USER_CIRCLE_MAP related to only this user id.
    Please help me.
    Thanks,
    Marutha

    pretty much the same thing as ttt but I did an and/or instead of the union all
    with users as
    (select 1 user_id, 'Bob' name, 'END_USER' Role from dual union
    select 2, 'Sue','TESTER'from dual),
    circles as
    (select 100 circle_id, 'circle one' name from dual union
    select 200, 'circle two' from dual union
    select 300, 'circle three' from dual
    user_circle_map as
    (select 1 user_id, 100 circle_id from dual union
      select 2, 300 from dual
    select users.user_id, users.name, role, circles.circle_id, circles.name from
    users, user_circle_map, circles
    where users.user_id = user_circle_map.user_id
    and   (
             (users.role = 'END_USER' and  circles.circle_id = user_circle_map.circle_id)
             or
             users.role != 'END_USER'
           ) Edited by: pollywog on Apr 9, 2010 12:24 PM

  • What is the best method to query for older GPIB equipment with ID? and newer with *IDN?

    Good day,
    I am writing a test executive where it needs to scan the bus for support of older (HP/Agilent 856x series) and newer (Agilent 440x and 444x series) spectrum analyzers. *NOTE* I originally posted this question in my NI Community blog. I apologize for redundancy but someone recommended I re-post here.
    The first frame looks for the newer analyzers with *IDN? then if that fails sets the boolean in the error cluster to TRUE. The next frame then uses the error cluster's boolean to decide whether an older HP analzer is connected instead using ID? query. Disclaimer: the second frame is a clone of the ID query of the 856x Initialize VI. I just want to use what already worked - no reinventing the same wheel?
    But, lo and behold, it doesn't work as expected. If I have the frames in this order and connect a HP8563E the GPIB time's out error. This code works with the newer 4407 or 4440 since the *IDN? query passes and the second frame is not executed.
    Now, when I move the second frame to become the first frame and run it with HP8563E the query works but will have a GPIB timeout if I have the 4407 or 4440 connected.
    Long story short, how do I support both older GPIB ID? and newer IDN? in my code?
    I have attached the query VI created with LV 2012.
    Many thanks!
    Aldrin
    Attachments:
    Query ID and IDN.vi ‏11 KB

    I think Michael Aivaliotis of JKI and NI have an elegant solution:
    https://decibel.ni.com/content/groups/large-labview-application-development/blog/2015/05/14/what-is-...
    Cheers!
    Aldrin

  • Query for Last page visit by user/session and get version # of current page

    Hi Guru's,
    Any have a query to retrive last page visited by user / session? Somewhere from apex view fir 3.0 or later version? Also looking for query to get version number of current page

    RequestCtx.getResponsibilityId() should return you the Responsibility Id &
    RequestCtx.getUserId() should return the User Id.
    As I understand RequestCtx values are always available in the JSP Page. Kindly check again.

  • Query for the Problem of setting up agent and scheduling a scenario

    I have setup a agent called AGENT_SCHEDULER.I can start this agent from the windows service,but when I go to Topology manager and say test Test Connection I don't get any response. My ODI hangs up and I have to manually kill
    from the task Manager. Why is this happening?
    But when I start from the command prompt using agentscheduler "-port=20910" "-name=AGENT_SCHEDULER" "-v=5 its gets started and tehn when I go to topology Manager and test connection ,it says agent test successful.
    But in the windows service it is not started though. Is this correctly behaving?
    After that when I schedule a Package Scenario and give status "active " and execution on "startup",I able to save. At this I presume the schedule must have started and ran the process. But then when I Go to Operator,it gives me error UNPARSEABLE DATE "0" and the opens up and doesn't show me anything.
    what is this error unparseable date "0"?
    I have set my ODIPARAMS with corect master and work repository and encoded ODI_SECU_ENCODED_PASS with the latest one generated?because every time I generate I get a different one.I am using java version "1.5.0_05".
    Also I have a requirement that I schedule my package after every 30 mins? What I found that we can schedule hourly?How will I be able to achieve this?

    Hi user768175
    Ref Note 783671.1 In Iassets Security by Cost Center is not Working, The Symptoms is as below :
    In iAssets, users with "Enforce Security by Cost Center" are able to see assets from different cost centers then the one where they are restricted, when using Advance Search button.
    But I still not work when using Advance Search button....
    Anyway, do u know how to setup the Cost Center/Department for employee in the HRMS module? Is't correct as below?
    I tried to set in HRMS (HRMS Manager) -> People -> Enter and Maintain --> select user--> Assignment -> Purchase Order Information -> input value in Set of Books and Default Expense Account field
    Many thanks for your help...
    SamCH

Maybe you are looking for

  • Display All Marked / Flagged for Follow Up Emails Separately

    Display All Marked / Flagged for Follow Up Emails Separately I was wondering, is there actually a way to display flagged emails in some sort of folder or separate view at least, as it is common within desktop mail applications and any other user inte

  • Cost Center and Profit Center Planning

    Hi, I have one  Co issue.  Pls Suggest me the wiseful solution. Cost Center and Profit Center Planning. For F-2008 Planning  data they have updated in the month of Aug, 07 for Profit and Loss Items and they have revised the plan data of some cost ele

  • Retrieve iPhoto 08 book file

    I was just about done creating a 20 page book, when my system crashed. Is there anyway to retrieve what I'd done, or do I have to start from scratch?

  • Attachments to pull through activty steps

    Hello, I set an activity template with IN PLACE EDITING ACTIVITY TYPE. I create a new activity in a project by retrieving it from this activity template. I upload an attahchment in activity step 1. I move the activity on to step 2. I click on "ADD/NE

  • HT4847 How can I store my photos, now mobile me is no longer

    Hi Guys Since mobile me has been scrapped, what's the best place to store a backup of your photos online Cheers Harvey