on 07-10-2010 9:06 AM
Hi,
We have an addon which will insert a record into a particular UDT on creation of GRPO, Goods Receipt, and Inventory Transfers. The add on works perfectly when used in a Single User enviornment. But when multiple users create the document from different locations, some entries are not created in the UDT. ie; On an average 2-3 entries are missing per day. The UDT updation is done by using DI API.
Note: The issue happens only randomly.ie; We guess, when two users create document exactly the same instance of time this happens.
Is there any way to resolve this issue?.
Hello
You transactions to update the complete processes in your code.
This issue happens when 2 users would like to access to the same data (table) and 1ts user is started a transaction, and the second user cannot access to any data during the transaction is processed. Please note: company transaction can handle this situation, but slows done the performance.
Tip: Use statusbar.Settext method to save the error messages into the system log for more analisys: the SetText method is writing the system log, which can be readed later on from SAP B1. in 2007 version.
for transactions read the following thread:
Regards
János
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Could you share us your code how the insert is made. When working with recordsets in SAP SDK it is important to drop the object and clear memory when you're done with the transaction. This should be coded. If you do not do this properly this can cause memory allocation problems which can occur on an irregular basis.
In my opinion the failure of insert into a table because of a locking table is less likely as it is handled by SQL server: SQL server will automatically lock and unlock tables. If this happens you maybe find some errors in the SQL server logs.
Kind regards,
Winfried Tiemessen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If (BOInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD) And BOInfo.FormTypeEx = "143" And BOInfo.ActionSuccess = True Then
'// Goods Receipt PO
Try
Dim oGRN As SAPbobsCOM.UserTable
oGRN = oCompany.UserTables.Item("RG23MASTER")
Dim DocEntry As Int32
Dim Rg23 As Int32
Dim err As Int32
Dim Code As String
Dim Name As String
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.Item(BOInfo.FormUID)
'// Code And Name for UDTs
oRSet.DoQuery("Select Convert(varchar(8), Isnull(Max(Convert(Numeric,Code))+1,1) ) From [@RG23MASTER] Where Code is not NULL And Code <>''")
oRSet.MoveFirst()
Code = oRSet.Fields.Item(0).Value
Name = oRSet.Fields.Item(0).Value
oRSet.DoQuery(" Select Distinct A.ItemCode, B.DocNum, B.TaxDate, C.BatchNum , " & _
"( Select Location From OLCT Where Code = (Select Location From OWHS Where WhsCode = A.WhsCode) ) ,A.WhsCode, B.DocEntry " & _
" From PDN1 A, OPDN B, IBT1 C Where A.Itemcode in (select Distinct Itemcode from oitm where manbtchnum ='y') " & _
" And A.DocEntry = B.DocEntry And B.DocEntry = '" + DocEntry.ToString + "' " & _
" And C.BaseType=20 And C.BaseNum = B.DocNum And C.ItemCode = A.ItemCode And C.BaseLinNum = A.LineNum " & _
" group by A.Itemcode,C.Batchnum,B.DocNum,B.Docentry, B.TaxDate,A.WhsCode ")
oRSet.MoveFirst()
Dim ItBatch As String
While Not oRSet.EoF
oTempRSet2.DoQuery(" select max(Isnull(U_rg23,0)) from [@RG23MASTER] " & _
" Where U_Location = '" + oRSet.Fields.Item(4).Value.ToString + "'")
oTempRSet2.MoveFirst()
Rg23 = oTempRSet2.Fields.Item(0).Value
Rg23 = Rg23 + 1
oGRN.Code = Code
oGRN.Name = Name
oGRN.UserFields.Fields.Item("U_Rg23").Value = Rg23
oGRN.UserFields.Fields.Item("U_Item").Value = oRSet.Fields.Item(0).Value
oGRN.UserFields.Fields.Item("U_Doc_Num").Value = oRSet.Fields.Item(1).Value.ToString
oGRN.UserFields.Fields.Item("U_Doc_Type").Value = "Goods Receipt PO"
oGRN.UserFields.Fields.Item("U_Doc_Type_Code").Value = "20"
oGRN.UserFields.Fields.Item("U_Date").Value = oRSet.Fields.Item(2).Value
oGRN.UserFields.Fields.Item("U_Batch").Value = oRSet.Fields.Item(3).Value
oGRN.UserFields.Fields.Item("U_Location").Value = oRSet.Fields.Item(4).Value
oGRN.UserFields.Fields.Item("U_Doc_Entry").Value = oRSet.Fields.Item(6).Value
err = oGRN.Add()
If err <> 0 Then
SBO_Application.MessageBox(oCompany.GetLastErrorDescription.ToString)
End If
Code = Code + 1
Name = Name + 1
oRSet.MoveNext()
End While
Catch ex As Exception
SBO_Application.MessageBox(ex.Message.ToString)
End Try
End If
Hi,
if it is an issue with DI API object as Winfried assumed, you have to release and clear the object.
I have created a small method for this procedure when creating tables. Just put your Recordset object in the parameter sapObjectMD.
private void releaseObjectMD(object sapObjectMD)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(sapObjectMD);
sapObjectMD = null;
GC.Collect();
}
Regards
Sebastian
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.