Concurent updates on a value
Hi guys,
Please help me on this. I have a problem and I want to think about it and find the best way to implement it. I will give you a simplified example but similar with what I have:
You have a stock_amt value in one table and there is a procedure that updates and substracts from this stock_amt.
lets say in a store a have a stock amount of 50 items and this procedure, for each sale is subtracting from this value and it is not allowed to go below zero. The process, beside the update, on this column (set stock_amt = stock_amt - x) is doing a lot of other updates on other tables and it total it takes like 0.5 seconds. Everything is fine till I want to execute this procedure by 50 users in parallel.
The initial implementation, to avoid some dead locks and we put a lock on that column (stock_amt) but there where to much waits. we cannot hold that lock for 0.5 seconds.
What will be the best approach for this?
For this stock amt problem, maybe the solution can be a trade like: do not update that column every time but once in a while, by another process or by a materialize view logic.
but what if my column is a critical value like a Prepay balance or bank balance and it needs to be updated in near real time. What will you do?
Thanks
To add to what Iordan posted, besides trying to ensure the same set of tables are updated in the same order you can also look to see if it is possible to place the item quantity on hand value at the end of the transaction, i.e., right before commit. This would reduce the wait for this specific row. The mention of specific row brings up another consideration. OK you have 50 concurrent transactions against the table but are all 50 against the same items? If the transactions hit different items then if you process each item number in a separate transaction the chance of having to wait is greatly reduced. So in fact the process may already be good enough as you are unlikely to have very many sesssions waiting on the same item. This does require item at a time processing.
Go through each and every query/DML statment in the process and make sure each is optimal. After all .40 is better than .50 and on a high use concurrent transaction every little bit helps.
Another consideration, do not calculate the on current on hand quantity at all , but instead read the item storage location table to calculate the value when needed. This eliminates the multiple concurrent update to a single row issue. That is you store items some where and some items will consume multipe bin locations. You pick from these locations and update the storage location bin count information on usage but do not update the item master with the current on hand quantity. You read that on demand.
As Iordan, what you can do depends on business requirements. No one solution fits all.
HTH -- Mark D Powell --
Similar Messages
-
How to update the table value in the valuechange event?
I have an input field in the datatable with the valueChangeListener
<rich:dataTable id="cart" value="#{cart.cartList}" var="item">
<h:inputText value="#{item.cost}" id="qty" valueChangeListener="#{items.updateCost}" onchange="submit()">
<h:outputText value="#{item.errorMsg}"> </h:outputText>
in the backing bean
Item item = (Item) model.getRowData();
// do some update, if the cost too larger, change to max_cost
item.setCost(max_cost);
item.setErrorMsg("Error Msg");
After calling the valuechange method, the screen output doesn't update the cost.
How to update the table value in the valuechange event?As you're misusing the valueChangeListener to set another input field, you need to skip the update model values phase. Otherwise the value set in the valueChangeListener will be overridden by the submitted value. You can do this by calling the FacesContext#renderResponse() inside the valueChangeListener method. This will shift the current phase immediately to the render response phase, hereby skipping the update model values and invoke application phases.
-
How to update excise invoice values after migo.
Hi Guru's,
I have checked the forum. but did not get exact solution.
Here im having the problem with bapi BAPI_GOODSMVT_CREATE . This bapi don't have the structure to update excise invoice values.
I have one bapi 'BAPI_EXCINV_CREATE_FROMDATA' to update the excise duty, but in that also i didn't find the structure
'J_1IEXITEM' to update the ECS value ( field is 'total_ecs').
Please help me on this,Thanks in Advance...
Regards
NarenHi Krishna
Do not do excise invoice capture during 103. At that time select the option "No excise entry". Then capture excise invoice during 105.
The system messge " No selectable items for this document" is prompted since the preceeding document is already assigned with invoice.
Try this and give feedback.
regards
sairam akundi -
How to update a string value located on the main VI
Hello
I would like, from a subVI, to update a string value located in the main VI (using References). I was trying to find examples on NI web page but it´s impossible to download them (for more than one month : Error, File Not Found), do everyone has got the same problem?
Thanks for your answer
NicolasHi,
this is from LV help file:
Complete the following steps to create a subVI that includes a control reference directly from a Property Node.
1.On the block diagram, right-click the front panel object terminal for which you want a control reference and select Create»Property Node from the shortcut menu to create a Property Node implicitly linked to the object. You can have multiple Property Nodes for multiple front panel objects.
2.Use the Positioning tool to select the new Property Node and select Edit»Create SubVI from menu. LabVIEW automatically creates a control reference to the control on the block diagram of the main VI, creates a subVI that contains a control refnum wired to a Property Node, and wires the control reference on the main VI to the
control refnum input terminal of the new subVI.
Note: Select several Property Nodes at once to create a subVI with multiple control refnums and Property Nodes.
3.Double-click the subVI to open it. Modify the Property Node and other elements of the subVI as you do in any other VI.
4. If you want to change values of control then select "Value" property in Property node.
I've attached the examples.
Good luck.
Oleg Chutko.
Attachments:
Ref.zip 11 KB -
Error while updating the forecast value in M.Master through RMDATIND
Hi All
Good Day
In my custom Program I am using the three structures bgr00,bmm00,bmmh1 & bmmh3 and through rmdatind(Direct input method) program, i am trying to update the forecast value in material master data
and i am getting error message as Specify a tracking limit and i have taken the tracking limit as 4 in my program.
Actually there are 2 fields exists for tracking limit in structure bmmh1
1.SIGGR and
2.SIGG2
I had given the input as 4 for these 2 fields but I am getting the same error message Specify a tracking limit
Can anyone please help me in this case.
Thanks in advance.
Cheers
Vallabhanenidebug your program.
Compare the field content of the value in the field you submitted with the content in field that is checked when message M3 456 is issued. -
Hi All,
I am new here . We have batch split in Delivery and 601 happens for the individual batches and billing we bill for the entire quantity . Hence the RG1 does not update the excise values for the batches and it is showing as zero (upon extraction in J2I6). Upon research through the program the latest note which i presume is patched
The latest note is N158234 which does not show in the program but seems have been patched considering we are using the Latest version of SAP .
As you see above in the billing we have billed for the whole quantity but RG1 does not update for the since the batches are zero .
My programmer says because of some note related to cancellation where it says about values H & J in vbfa table and due to which program does not go through the Note for the batch split .
Now i have checked few other projects in my company and they all seems to be following the program . So i am wondering whether my process or some customization is missing .
Sales order (no batch determination) , in delivery the batches are picked through wm to and batch split happens in the delivery . Then billling for the whole quantity . We have automatic excise invoice creation enabled so no J1IIN .
Can somebody help me .
Thank youMy programmer says because of some note related to cancellation where it says about values H & J in vbfa table and due to which program does not go through the Note for the batch split
Which field (H & J) they were referring in VBFA ?
i have checked few other projects in my company and they all seems to be following the program
How about the other projects' values in VBFA where your techinical team is guessing some issue. Have you compared this?
Since you have already the note 158234 implemented in your system, ideally, you should not face any issue.
G. Lakshmipathi -
Updation of Consumption values in material master
Dear Experts,
For a FERT ,
When I use strategy 40 , Consumption values ( PGI - Deliveries )are getting updated in MM02 in Forecast view.
whereas,
When I use strategy 50 , Consumption values are not getting updated in MM02 in Forecast view.
Is there any setting to control this updation of Consumption values in Material Master ?
Regards,
SheikHi,
Update of consumption is based on movement type, and you can decide which movement types should have or have not consumption updating.
Check in transaction OMJJ if the movement types in question have indicator "Consumption posting" (field V_156_VC-KZVBU) as marked.
If it is the case, consumption is updated, opposite for un-ticked.
Hope that helps.
Thanks. -
Problem while updating the forecast value in m.master by direct input menth
Hi All
Good Day
I am updating the forecast value in material master by direct input method.
my program is working fine when I am running it online.
but when i am runnig in back ground I am getting one error which is mentioned below
Job ZM_OPTIMIZA_UPLOAD: Data does not match the job definition; job terminated BD 078 E
Please anyone can help ne in above case.
Thanks in advance.
Cheers
VallabhaneniHi Hakim
How are you
Thanks for your valuable suggestion.
I am executing my program in background with bmv0 transaction with variant, in development I can run this job in background with out any logical errors but in QA I am getting errors.
Can you please help me in the above case.
In Bmv0 transaction first I defined the job and in program rmdatind (execute) screen first I mentioned the Max. no of logical errors as 500 and Transactions per commit unit as 500 and I run the program in background in bmv0 transaction and I am getting the message background job terminated immediately
Because of this again I changed the Max. no of logical errors 500 to 99999 and transaction per commit unit 500 to 999999 and then i scheduled my program in background.
Alomost it ran for 27 hours and then it has given the message background job terminated.
Job log entries are as follows.
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040840; material number SUJ82J8400; error gravity E
22.12.2008 11:19:46 Transaction 0000040840: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040841; material number SUJ84G3001; error gravity E
22.12.2008 11:19:46 Transaction 0000040841: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040842; material number SUJ84G3002; error gravity E
22.12.2008 11:19:46 Transaction 0000040842: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040843; material number SUJ86G0100; error gravity E
22.12.2008 11:19:46 Transaction 0000040843: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040844; material number SUJ86G0300; error gravity E
22.12.2008 11:19:46 Transaction 0000040844: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040845; material number SUJ86G0900; error gravity E
22.12.2008 11:19:46 Transaction 0000040845: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040846; material number SUJ86G9600; error gravity E
22.12.2008 11:19:46 Transaction 0000040846: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040847; material number SUJ86G9601; error gravity E
22.12.2008 11:19:46 Transaction 0000040847: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:19:46 Transaction 0000040848; material number SUJ86J0000; error gravity E
22.12.2008 11:19:46 Transaction 0000040848: Taxes for sales org. cannot be transferred
22.12.2008 11:19:46 A system error has occurred while locking
22.12.2008 11:20:54 Transaction 0000040848 completed Mat. no. No. of log. errors 0000040848
22.12.2008 11:21:30 ABAP/4 processor: TSV_TNEW_PAGE_ALLOC_FAILED
22.12.2008 11:21:30 Job cancelled
I know it has taken long time to process the job because of I changed the transactions per commit unit (500 to 999999) it kills the system
But I am supposed to provide some number < 999999 in transactions per commit unit
actually I haven't tried like I said above < 999999 because i don't have any hopes.
Please look at this problem and help me in this case.
Thanks in advance.
Vallabhaneni -
need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
here is my base attempt.
$web = Get-SPWeb site url
$list = $web.lists["List Name"]
$item = $list.items.getitembyid(select from the items.csv old)
$modifiedBy = $item["Editor"]
#Editor is the internal name of the Modified By column
$item["old"] = "new from the .csv file parsed by power sehll
$ite.Syste,Update($false);
$web.Dispose()Hi,
According to your description, my understanding is that you want to update SharePoint field value from a CSV file recursively.
We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
Here is a code snippet for your reference:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
# Destination site collection
$WebURL = "http://sp2010.contoso.com/sites/Utility/"
# Destination list name
$listName = "Inventory"
#Get the SPWeb object and save it to a variable
$web = Get-SPWeb -identity $WebURL
#Get the SPList object to retrieve the list
$list = $web.Lists[$listName]
#Get all items in this list and save them to a variable
$items = $list.items
#loop through csv file
foreach($row in $csvVariable)
#loop through SharePoint list
foreach($item in $items)
$item["ID #"]=$row."ID #"
$item.Update()
$web.Dispose()
Here are some detailed articles for your reference:
http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
Thanks
Best Regards
Jerry Guo
TechNet Community Support -
Update Excise base value in MRP based and Non-MRP based billing
Hi Gurus,
We need to update Excise Base Value for Statistical Condition type. How to configure the same ?
Sl.No Pricing Condition Type Active Statistical Passed to Accounting
1 MRP Price (Statistical)
2 Abatement (Statistical)
3 Surcharge (Active&Passed to Accounting)
4 Assessabel value (Statistical)
(No:4 This is the base for calculating Excise duties i.e Excise Base Value)
5 List Price (Statistical)
6 Customer Discount(Statistical)
7 Surcharge(Active&Passed to Accounting)
8 Net Price (Active&Passed to Accounting)
9 BED (Active&Passed to Accounting)
10 ECess (Active&Passed to Accounting)
11 SECess (Active&Passed to Accounting)
12 Total collected from Customer(Statistical)
Issue: When there is MRP Price higher than the List Price, then the Cutomer will be charged on the basis of Net Price only, but the duties amount to be paid to the government on MRP Price. so in this case I can not calculate Excise Duties on the Actual Net Price condition which is active and passed on to accounting. And always the Excise duties to be calculated on Assessable value(no:4). But that condition type if I make activate then it will pass to accounting and also getting added to the Net Value(KOMP-NETWR). How to come out of this situation.(as per the customer requirement both MRP based materials and non-MRP based materials are also considered in the same sale order i.e with the same pricing procedure).
Becasue of this EXBAS is not getting updated in the J_1IEXCDTL.
Gurus, Share your valuable experiences and suggestions.
Thanks &Regards
Sreekanth
09611147585Dear Lakshmipathi,
As per your suggestion, I have maintained Material Assessable Value and then also the duty values are calculating on the basis of Assessable value maintained in the Pricing Procedure. It is not taking the Material Assessable Value into consideration. And it is not getting updated the Excise Base Value.
In which case Material Assessable value will be taken into consideration?
How to update the Excise Base Value in J_1IEXCDTL tables?
Thanks&Regards
Sreekanth -
How to select and duplicate the records and update some column values using cursor
I have a table with 920 records, we need to update the end date to 6/30/2014 for 920 records and I need to create all 920 records with start date is 7/1/2014 and update the external value to
CCC.
Note: the table primary key is not auto increment, but I have sp to get the latest key for that.
Existing table.
ID
Source Name
Internal value
External value
Start date
End date
1
XXX
AAA
BBB
1/1/2013
6/30/2015
Create new records
ID
Source Name
Internal value
External value
Start date
End date
921
XXX
AAA
CCC
7/1/2013
12/30/2015Hi ManuGT
If I understand what you need then you ask for:
1. updating all current rows (920 rows in the table now)
2. insert new rows which are duplicates of the preiviews rows, but with value 'CCC' insteade of 'BBB'
If so, there is not reason to use a cursor and it is highly NOT RECOMMENDED to use ant type of loop.
You should work with SET and do it all in 2 simple queries:
-- first we duplicate the existing rows,
-- but we use the values 'CCC" and '20140107' for the new rows values
INSERT test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
select SourceName, 'CCC', ExternalValue, '20140107' , EndDate
from test
where
-- You can use any filter that you need if you dont want to update all rows
InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
-- Now we update the old rows (check the filter! I get only the old rows since I filter the new rown out)
UPDATE test
SET EndDate = '20140107' -- I use date in format yyyymmdd, You can use other formats as well
where
-- You can use any filter that you need if you dont want to update all rows
InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
Unfortunately you did not post DDL+DML! Therefore we cant see your table structure and the data sample and we can only guess. I used Saeid's post as the basic DDL+DML.
Please next time post DDL+DML
here is the full code with the DDL+DML that i used:
-- This is our DDL - A create table query:
create table test
( id int identity(1,1) primary key,
SourceName nvarchar(3),
InternalValue nvarchar(3),
ExternalValue nvarchar(3),
StartDate date,
EndDate date
go
-- This is our DML - A query that insert some sample data
declare @i int = 1 ;
while @i < 921
begin
insert test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
values ('XXX', 'AAA', 'BBB', '1/1/2014', '6/30/2014' ) ;
set @i += 1 ;
end ;
GO
-- Here is the solution for the problem as I understood your needs:
-- first we duplicate the existing rows,
-- but we use the values 'CCC" and '20140107' for the new rows values
INSERT test (SourceName, InternalValue, ExternalValue, StartDate, EndDate)
select SourceName, 'CCC', ExternalValue, '20140107' , EndDate
from test
where
-- You can use any filter that you need if you dont want to update all rows
InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
-- Now we update the old rows (check the filter! I get only the old rows since I filter the new rown out)
UPDATE test
SET EndDate = '20140107' -- I use date in format yyyymmdd, You can use other formats as well
where
-- You can use any filter that you need if you dont want to update all rows
InternalValue = 'AAA' and ExternalValue = 'BBB' and StartDate = '20140101' and EndDate = '20140630'
-- Here we just check how the result look like :-)
select *
from test ;
-- And since we do not realy need this table in our server... Here we clean the DDL (you probaby DO NOT WANT TO EXECUTE THIS!)
DROP table test
GO
I hope this was useful :-)
[Personal Site] [Blog] [Facebook] -
BAPI to UPDATE Payment Terms value in CONTRACT.
Hi All,
I have to update Payment Terms value under BILLING DOCUMENT TAB of CONTRACT at ITEM LEVEL.
I am using BAPI 'BAPI_CUSTOMERCONTRACT_CHANGE' but it's not updating properly...Please see below code which i was using.
LD_VBELN = '0040029839'.
LS_BAPISDH1X-UPDATEFLAG = 'U'.
LT_BAPISDITM-ITM_NUMBER = '000010'.
LT_BAPISDITM-PMNTTRMS = 'ZP90'.
APPEND LT_BAPISDITM.
CLEAR LT_BAPISDITM.
LT_BAPISDITMX-ITM_NUMBER = '000010'.
LT_BAPISDITMX-UPDATEFLAG = 'U'.
LT_BAPISDITMX-CUST_MAT35 = 'X'.
APPEND LT_BAPISDITMX.
CLEAR LT_BAPISDITMX.
*BAPI call to update the customer material number in the sales order
CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'
EXPORTING
SALESDOCUMENT = LD_VBELN
CONTRACT_HEADER_IN = LS_BAPISDH1
CONTRACT_HEADER_INX = LS_BAPISDH1X
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
NO_STATUS_BUF_INIT = ' '
TABLES
RETURN = GT_RETURN
CONTRACT_ITEM_IN = LT_BAPISDITM
CONTRACT_ITEM_INX = LT_BAPISDITMX.
*BAPI to commit the sales order update in database
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
Pls update me if any other BAPI will help me to my Requirement.Your help will be appriciated.
With rgds,
Hari...Replace the
LT_BAPISDITMX-CUST_MAT35 = 'X'.
by a
LT_BAPISDITMX-PMNTTRMS = 'X'.
Regards,
Raymond -
How do I update a bean value from an AJAX call?
Hi all,
How do I update a bean value from an AJAX call? I suppose I could write a servlet to do it. However, this seems like a common problem, so I was wondering if there was some built in solution.
Thanks,
Grae
Edited by: caalip2 on Mar 30, 2010 1:07 PMcaalip2 wrote:
Raymond
Basically, I would user the following. The first choice for IE, the second for Firefox.
new ActiveXObject("Microsoft.XMLHTTP");
new XMLHttpRequest();
GraeDon't do this to yourself. If it were that easy there wouldn't be AJAX frameworks for JSF. Find one you like and use it. I've used a4j (part of RichFaces) successfully. -
Update a filed value with powershell script with ordery by and where condition
Hi
I have below powershell script to update list columns but how i update a field value with ordery by a column and where condition
below is the part of my script
$list = $web.Lists[$listName]
$items = $list.items
$internal_counter = 1
#Go through all items
foreach($item in $items)
if($item["CourtNO"] -eq $null)
#if($item["CourtNo"] -eq '1')
$item["CaseNo"] = $internal_counter
#how to add a column ordery by Title
# and where Title field value from 1 to 10
$internal_counter++
adilHi,
You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
If so, use CAML query to get the items only match the condition.
#Build Query
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
Name="Title"/></OrderBy>'
$spQuery.Query = $query
$spQuery.RowLimit = $list.ItemCount
$items = $list.GetItems($spQuery)
Hope this help!
/Hai
Visit my blog: My Blog | Visit my forum:
SharePoint Community for Vietnamese |
Bamboo Solution Corporation -
Update Trigger: New Value
Hi, I am in a strange situation, hope some one can help me. I have a BEFORE UPDATE trigger in which I have a condtion like.
IF :new.col1 is NULL THEN
:new.col1 := 'AA';
END IF;
My aim is if col1 set to NULL or col1 is not included in update statement then value 'AA' should be assigned to col1.
This works fine in following cases
1) If UPDATE statement set col1 to NULL explicitly
2) If :old.col1 is NULL and col1 is not included in update statement
But not working when
3) :old.col1 IS NOT NULL and col1 is not included update statement.
I want value 'AA' should assigned to col1 in case 3 also. Is there any way ?
Thanks.I don't think that this can be done through the trigger alone, because the trigger cannot distinguish between the two cases where ...
i) col1 is not mentioned in the update, and ...
ii) col1 is mentioned but is updated from a non-null value to the same value.
Maybe you are looking for
-
Keynote and Hyperlinks to Webpages
I have a Keynote '08 presentation that includes several slides each with multiple hyperlinks to external, hosted web sites. The links work properly; however, when in slide show mode, I click a link, go to the external web site, then use CMD + Tab to
-
hi all , i got issue in VA01 transaction . actually my customer wants an message in VA01 transaction when quantity is not there . for example if user entering 20 quantity for material but it has got 3 quantity only even though it has got 3 quant
-
Catch-up depreciation for the Subsequent Acquisitions in later years
Dear expert, We have the following scenario: First an asset master record is created and it receives an acquistion value at the date 2013-08-09. The next year, we find there's something wrong with the acquistion value, so we make the subsequent acqui
-
I have just loaded iMovie for iPhone 4 & have built a few projects. ALL of the video is resized to smaller & by doing so, the video is cut off at the top. Any ideas??? (the original clips are full size, nothing cut off)
-
How do i recover my deleted contacts
i deleted my contacts any way to get them back