Update Current Stock levels

Hi i am currenlty having a problem with some pl/sql and wondere if somebody could help me. Im trying to write a trigger so that when a client chooses their product it deducts the amount the client has chosen from the products stock list. Here is what i have so far:
CREATE OR REPLACE TRIGGER "STOCK"
AFTER
insert or update on "ORDERLINE"
begin
update products p set product_stock =
(select sum(p.product_stock - ol.quantity) from products p, orderline ol
where p.product_id = ol.product_id);
end;
currently this seems to be adding high numbers to the stock level for all products and setting them the same i need to have it do the calculation on seperate products
Thanx in advanced Chris

user11967314 wrote:
Ok the trigger works wondefullyNo it does not. It only works "wonderfully" in a single session mode. In multi-session mode it is a recipie for a deadlock. Assume user1 orders product1 and then product2 while user2 orders product2 and then product1. Both users order first item at the same time. So trigger in user1 session updates and therefore locks product1 row in table products while user2 session updates and therefore locks product2 row in table products. Now user1 orders product2 and since user2 has product2 row in table products locked, user1 session waits for that lock to be relased. Meawhile user2 orders product1 and since user1 has product1 row in table products locked he waits for that lock to be relased. Voila, we have a deadlock.
SY.

Similar Messages

  • SAP Query: Current Stock and Stock Sold

    Hi,
    As SAP no longer supports XLReporter with SQL 2012 I am in the pain staking process of trying the same data as near to the previous XLReporter reports as possible. Crystal is not an option for all reports as mt co-workers like to manipulate reported data in excel.
    I have one report (which I thought would be simple) that is to show the current stock level of all  item codes with a chosen prefix and then to also show of those item codes which have been sold between a given date range.
    The version below shows all the important information but the way I am requesting the data suppresses some item rows where they have not been sold in the given date range:
    SELECT T0.[ItemCode], T0.[ItemName], SUM(T3.[Quantity]) AS ' Qty Sold', T2.[OnHand]
    FROM OITM T0
    INNER JOIN OITW T2 on T0.ItemCode = T2.ItemCode
    LEFT JOIN INV1 T3 ON T0.ItemCode = T3.ItemCode
    WHERE (T2.[WhsCode] = '01' OR  T2.[WhsCode] = '01A') AND T0.ItemCode Like '[%0]%%' AND T3.DocDate > '[%1]' AND T3.DocDate < '[%2]'
    GROUP BY T0.[ItemCode], T0.[ItemName], T2.[OnHand]
    Order BY T0.[ItemCode]
    I know I need to move all references to INV1 into a sub query of some description but my attempts this afternoon have made no progress.

    Hi David...
    Try This
    SELECT T0.[ItemCode], T0.[ItemName], SUM(T3.[Quantity]) AS ' Qty Sold', T2.[OnHand]
    FROM OITM T0
    INNER JOIN OITW T2 on T0.ItemCode = T2.ItemCode
    Inner JOIN INV1 T3 ON T0.ItemCode = T3.ItemCode
    WHERE (T2.[WhsCode] = '01' OR  T2.[WhsCode] = '01A') AND T0.ItemCode Like '[%0]%%' AND T3.DocDate > '[%1]' AND T3.DocDate < '[%2]'
    GROUP BY T0.[ItemCode], T0.[ItemName], T2.[OnHand]
    Order BY T0.[ItemCode]
    Regards,
    Kennedy

  • Customer consignment stock- REPORTING stock level & goods depatched

    Hi all
    I'm looking for a report (or reports) which shows the following (bare in mind that this will all be customer consignment stock):
    - the delivery numbers
    - the previous month's stock level
    - the quantity of goods despatched the following month with a rolling calculation
    - monthly invoice values
    - remaining stock levels (after current months goods have been issued and invoiced)
    I'm aware that MMBE/ MB58 shows the current stock levels, however I'm hoping there is a report in SE16 which shows it as a report structure.
    I understand that this is a lot of info requested by myself however any information would be appreciated.
    Thanks
    / Vicky

    Dear tortyv,
    As per my understanding of the requirement,
    You please check the "VL06" report if it satisfies your requirement you enter the execution parameters and execute.
    System will give the list of out bound deliveries. Select one of those and click the details icon (ctrlshiftf3) according to the item view or headder view.
    If it does't suit you have to go for z report.
    I f you want that please provide the input fields in order to fetch the required data for the report.
    Thanks&Regards
    Raghu.k

  • Extracting current stock from LiveCache using ABAP

    Hi,
    We are trying to develop a number of reports for displaying calculated key figures from SNP. One of the macros that is used in calculations uses function INITIAL_STOCK(), which apparently reads the current stock level directly from LiveCache. I've found two function modules (/SAPAPO/DM_STOCK_GET and /SAPAPO/DM_STOCK_GET_BY_PEGID) that are somehow used in extracting of stock levels but I have'nt been able to figure out how they should be used, ie. what are the correct parameter values etc. Has anyone else tried to read current stock levels with ABAP?
    Cheers,
    Ran-Dom

    Hi,
    Thank you for your answer. However, I was'nt able to extract stock levels with that function. I did not find any documentation about that particular function, so I don't know which parameters are essential in my case. I've tried giving material and location ID:s as parameters, but it does'nt seem to work.
    Regards,
    Ran-Dom

  • Warehouse Stock levels

    Forum,
    When we process a sales order, the current stock level for an item is displayed. This is currently the total of all warehouses.
    Is it possible to display the stock quantity of a single warehouse on the sales order entry screen?
    Regards,
    Juan

    Dear Juan,
    At the time of creation of sales order in warehouse column press Ctrl+TAB system show you actual stock position of your warehouse.
    Dear All,
    Please first suggest system function if its not fulfill the user requirement than definitely try to MAP system through UDF & FMS.
    Regards
    MANGESH PAGHDHARE

  • Inventory Report for current stock and Safety, Minimum etc stock levels

    Hi,
    Is there any report available to view the current stock against the minimum, safety stock levels so that the user can plan further actions accordingly.  Can anyone please guide me on this.
    Thanks in Advance.
    Regards,
    Laxmi

    Hi Shailesh,
    Is there any way we can include some extra fields into this MC.9 report - i tried but could not find anything.  Can you please help.
    Regards,
    Laxmi

  • Report on current stock and safety stock

    Hi,
    I want to have the report on current stock and safety stock.
    In MC.9 it gives wrong safety stock. When I go to cross check the safety stock in material master & in MC.9 I see differences.
    Thanks,
    Kiran

    You can user tcode MC.9 or MC.5 to know valuated stock available at given plant. Stock lying in Returns (MB52) will not be a part of this report as it non-valuated stock.
    The stock in the accounting view of the material master considers stock at plant level including stock in Transit (Intra & Inter plant stock trasnfers) & special stock like stock issued to vendor , consigment stock etc which is valuated at plant level.
    whereas and stock in the plant stock view of the material master does not consider such special stocks hence there will always difference in both veiws.
    For Physical stock as on particular date you can consider MB5B report with radio button "Storage location/Batch Stock" wherein you will get Quantity issued & Qunatity received in those SLOC along with Opening stock & Closing stock for the specified period.
    use tcode
    MBLB to know stock at vendor.
    MB54 - Consignment Stock.

  • Error: Current patch level of database is unknown. Use latest dbpatch build

    hi,
    I am applying EP6SP2 CM&COLL patch 5 DBPATCH.
    current portal version: version=6.0.2.29.0
    current C&COLL version: CM_COLL version=60 SP2 Patch 5
    Before applying this patch, i applied CM&COLL patch 4 hotfix 8 and the DBPATCH included in tht. Now, after applying CM&COLL patch 5, i tried to apply DBPATCH which comes with CMOLL patch5 SAR file. My database is oracle database. While applying this patch i encountred following error:
    <i>
    Current database version: SP2.CM.SPs
    ERROR: Error: Current patch level of database is unknown. Use the latest dbpatch build
    java.lang.Exception: Error: Current patch level of database is unknown. Use the latest dbp
    atch build.
            at com.sapportals.wcm.tool.dbpatch.Database.getPatchList(Database.java:48)
            at com.sapportals.wcm.tool.dbpatch.DBPatch.patch(DBPatch.java:66)
            at com.sapportals.wcm.tool.dbpatch.DBPatch.main(DBPatch.java:26)
    </i>
    Now according to SAP Note 761224, they asked us to use updated DBPATCH attached to this note. But currently there are only 3 files attached of MSSQL. I want the updated ORACLE_DBPATCH files.
    rgds,
    Nilz

    Hi,
    i m thru. i raised the question in OSS. They rectified the mistake and attached dbpatch_oracle.zip to SAP note 761224.
    rgds,
    Nilz

  • DSC Alarms: how to get the current alarm levels / setpoints

    I have a VI that can get the alarm levels for shared variables as they are set in the project library.
    But I have programmatically changed the values for the alarm levels, so the Distributed System Manager shows different levels as compared to what my VI displays.  I want the updated or current alarm levels - the ones that are retrieved by Read Alarms (called setpoints).
    I could use Read Alarms, but that only shows the shared variables that are in alarm.  I want all the shared variables in a process that is currently deployed.
    Any suggestions?
    BTW, is Distributed System Manager the same tool as Shared Variable Monitor?  I can't find the Shared Variable Monitor on my system.
    G

    Hi Gretchen,
    To answer your second question first, Shared Variable Monitor was the old name for what became Distributed System Manager. There was also some added functionality beyond just shared variables with DSM, so the name got changed. 
    As for suggestions regarding your application, I could use a little bit of clarification. I understand you're programmatically changing the alarm values and you want to display the values of your shared variables and their respective alarm states, correct? Also, when you're running your VI DSM does not update with the new alarm values (what happens when you hit the refresh button?). 
    I found a couple examples that may be useful moving forward Example 1, Example 2. These cover using shared variables and DSC's alarming features.
    Tim W.
    Applications Engineering
    National Instruments
    http://www.ni.com/support 

  • Inventory - Historical load from BF to 0IC_C03 changes current stock qty

    Loaded 0IC_C03 from 2LIS_03_BX to create opening balance.
    Compressed with "Marker Update" (Unchecked). Ran a report to display opening stock (0TOTALSTOCK).
    Report matches perfectly with MMBE in source system.
    Next, I loaded historical movements from 2LIS_03_BF. Compressed without "Marker Update" (Checked).
    Ran the stock overview report. The stock balances are now changed. Historical movements
    should not change current stock positions.
    Steps leading upto this issue (ECC/BI 7.0):
    1. Loaded data from BX setup to PSA and then to cube using a DTP with the "Initial Non-cumm for Non-cumm" option. Compressed with "Marker Update".
    2. Init BF without "Data Transfer" to create my delta pointer and then loaded BF setup table data to the PSA using "Full Repair request". Created 1 request per year based on posting date year.
    3. Then pushed data from PSA to cube using "Delta" DTP. Compressed all historical requests WITHOUT "Marker Update" (checkbox ticked).
    Any suggestions ? I have some sort of a workaround for now - the BX records in the cube do not contain values for the Material Document Number (MBLNR). I can put a charateristic filter in the query to display only records that have a null value for Mat Doc Number. In that case the report seems to be correct as I am eliminating the records from BF.
    Regards,
    Ash

    HI,
    Are you trying to install something which does not have their corresponding Infoarea, Infoproviders etc..? This might be the reason for those errors.
    Also You should use Collect objects automatically.
    Regards,
    Rahul S

  • Getting Current  Stock Prices in a Numbers 08 spreadsheet

    Can anybody give me detailed instructions to get different data regarding stock market values into a Numbers 08 spreadsheet in a way that the data can be updated by a query? I searched the forum for this but could not find anything. I am looking for data like current stock value, p/e, yield , 52 week range etc.
    I can put the stock values on the dash board and that seems to be linked to Yahoo Finance but I can find no link or help articles on how to do that in Numbers 08 and to refresh the query in Numbers to get current values.
    Thanks in advance.

    Barry is right, my script was written for Numbers '09 which offer some scriptable features.
    None of them are available in Numbers '08.
    So if you really need it and have no plan to upgrade (not to iWork '09 but to its highly wished successor) I may drop the code dedicated to Numbers '09 and stop the process with the datas stored in the clipboard so that you would be able to paste them in a table by yourself.
    Let me know if you are interested by such a stripped version;
    I'm very busy so I don't wish to spent time on a project which is not clearly useful.
    Yvan KOENIG (VALLAURIS, France) lundi 24 janvier 2011 15:16:29

  • PDF goto named destination link with current zoom level

    Hi,
    I am created PDF file from 3b2 software with many links and bookmarks, The links with in documents are created with named destination bookmark names.
    When I am click the link to navigate with in document it will goto the bookmarked location and zoom level will changed into “FIT TO WIDTH” but I am want to navigate over the document with current zoom level from the link where I am clicked.
    For this process I am tried one method that is javascript action in link.
    Using link properties
    Action -> Add Action -> Select Action  (Run Javascript)
    Script
    main()
    function main()
    var zoom = this.zoom;
    this.gotonameddest(“bk1”);
    this.zoom = zoom;
    By this method I am get what I am looking but I am having one problem,
    First I will goto that book marked page with and after only it will fit to the current zoom level, so when I am go for previous view it will goback to "FIT TO WIDTH" zoom level, so this method failed.
    And also I am unable to edit all the links in my PDF document by Manually.
    So please advice me what is right way to navigate over the document with current zoom level from link where I am clicked.
    Note:
    The output PDF document will contain 100 number of links so I want to update all the links with my requirement by automation.
    Is there is any way to handle this process by Acrobat SDK with C# , .NET
    Regard
    Thirusanguraja V

    Thank you Very much,
    If you do't mind could you give me sample PS file with,
    Destinations specify a particular location in a file, and a zoom factor.
    The zoom level must be current zoom level of the page where i am link click.
    Sample PS syntax i am tryed:
    [/Dest /bmkaff1 /Rect [2000 3062 2100 2886] /View [/XYZ 0 0 0] /LNK pdfmark
    Reference I am used for this:
    pdfmark Reference
    © 2006 Adobe Systems Incorporated. All rights reserved.
    Adobe® Acrobat® SDK 8.0 pdfmark Reference for Microsoft® Windows®, Mac OS®, Linux®, and UNIX®
    Edition 1.0, November 2006
    Chapter 3 : 3 Actions and Destinations................44

  • Stock Level over time

    I would like to build a query that reports the stock level for each posting period over time.  I found these two tables that appear to have a structure for this data, but when I look at these tables I see that they are empty:
    S197 Periodic storage location stock
    S198 Periodic plant stock
    Is there a better place to get this information?
    Thanks,
    Kent

    MMBE tells the current stock at this time.  I want to get historical stock information over time.  I am looking for a table that holds this information versus a TCODE.  I know many TCODES to get the data, I just can't find a table that stores the data.
    Thanks,
    Kent

  • Sun openssl is updated to what level?

    We are receiving IAVAs that need addressed, specifically that Openssl needs be updated to version 1.0 or later. The version bundled with Solaris 10 is .9.7d, but says it covers some IAVAs up to 2011:
    OpenSSL 0.9.7d 17 Mar 2004 (+ security fixes for: CVE-2005-2969 CVE-2006-2937 CVE-2006-2940 CVE-2006-3738 CVE-2006-4339 CVE-2006-4343 CVE-2006-7250 CVE-2007-5135 CVE-2007-3108 CVE-2008-5077 CVE-2008-7270 CVE-2009-0590 CVE-2009-2409 CVE-2009-3555 CVE-2010-4180 CVE-2011-4576 CVE-2011-4619)
    Does anyone know what the current patch level is to satisfy these requirements to cover IAVAs issued in 2012?
    Our systems are Solaris 10 10/09 s10s_u8wos_08a SPARC, patch level Generic_147440-12.
    Would upgrading entail new SUNWopensslr packages, a particular patch, moving to a higher update of Solaris 10, or moving to Solaris 11?
    Any information appreciated. I'm in a government/military secure environment, so updating with open source packages is not possible.

    That was very helpful - thanks. Looks like our last patch was for -04 even though we have done the last several recommended patch clusters. Can you tell me how one would determine by a file name what patches should be applied for it? I have another unrelated file that has been patched in the past year that needs updating but I don't know how to figure out what patch would apply to it ( I know it has been updated because some systems have a newer version while those that have just had the package installed have an older version).
    I should have added that since these systems are restricted in scope, we don't have any web gui capability on them. I used to use the Sun patch manager gui on my other systems and it found updates for me, but I don't have that capability here. I'm trying to find out what patches upgraded the SUNWlxsl package.
    Edited by: 942145 on Jun 22, 2012 2:18 PM
    NM - I answered my own question.
    Do this:
    pkgchk -l -p /path/to/file
    This will give you what package it belongs to.
    showrev -p | grep SUNWlxsl (or whatever package you are looking for)
    Patch: 125731-05 Obsoletes: Requires: Incompatibles: Packages: SUNWlxml, SUNWlxsl
    This will show the last patch applied to that package. From there you can search for future versions of the patch. In my case, it is -07. However, I never had the SUNWlxsl package installed (only the SUNWlxml), so that last patch applied didn't update the files since they didn't exist. I need to apply -07 to bring it up to date.
    Edited by: 942145 on Jun 22, 2012 2:35 PM

  • Tracking Stock levels

    Hello,
    We have multiple plants around the U.S. and we are having trouble tracking the sales of parts out of the distribution center.
    My company currently use MB51 to determine stocking levels.  The only problem is if Plant A orders from our distribution center. MB51 will show a sale under our distribution center instead of a sale for plant A.
    Does SAP have a t-code that is used similar to MB51 but will capture sales orders through other plants?
    Thanks in advance for any help.
    Elton

    We do limit our movement in MB51 to only show sales.  But the problem is that this also picks up sales that Plant A sends to our distribution center.  So our distribution center will show history on the part and plant A shows none.
    We use MRP but I was told that we cant get this to show sales that Plant A send over to our distribution center. I dont know much about SAP, can MRP do what I'm asking for?

Maybe you are looking for

  • Why is Calendar Location not a Link?!

    Love the iPhone! However... I can't help but be incredibly annoyed by the following. Maybe I'm doing something wrong... but why in the world is the following feature not available? When I plug something in as a calendar appointment, I make sure to pl

  • 2lis_04_p_arbpl datasource expand

    Dear all, I add WEMNG (GR QTY) and MEINS( Uom) from LBWE to 2lis_04_p_arbpl  ,now when i see the data in RSA3,it does not show me data for these two fileds though it has data I remove unhide fileds also.

  • Reading XML from JavaScript

    Dear All, I am in need of reading an XML file data and to do some manupulation in Javascript. I am using "Microsoft.XMLDOM" parser and I have problem in accessing the child node. I am able to locate a node thru var x= xmlDoc.getElementsByTagName("nam

  • Plz send me this code

    my requrement is on run time how to call all tables in dropdownlist 2)if i select particular table on 2nd dropdown display all the columns of that table 3)if i select particular column in grid show the data 4)plz give me replay on  [email protected]

  • Quicktime references and register not showing up

    long story short, my windows installation corrupted, had to re-install windows had my key in my notepad i saved, as this problem occured before... installed itunes/quicktime, open quicktime, when i click register or preferences, nothing happens.. i'v