Hi,
Iam creating a manual journal for stock transfer between warehouses. I want the transfer details to be updated as it in SBO and the journal entry im adding thru code. i dont want the SBO journal to be created.
Kindly can anyone suggest on how to proceed.
im new to SAP
my mail id is amudha_mn@hotmail.com
Thanks & Regards
Amudha M.
Hi,
You must capture the Item Event "et_ITEM_PRESSED" of the Add button corresponding to the form you want to modify its behavior (for example the Stock Transfer form UID = 940 and usually add buton has UID = "1").
If at the reception of this event you want to do your own treatment you must then set BubbleEvent = False. Then B1 will not do anything and you must do the creation of the Stock Transfer and all the actions you want to link with by code.
It is a short description, I haven't tested it. Try to develop this idea and do a small sample to confirm everything.
You can use the tool called EventSpy, it is shipped with the SDK version 2004 into SAP Business One SDK/Samples/Utility Projects. With it you can see all events thrown by B1.
Hope it helps
Trinidad.
HI trinidad
Thanks for your reply. I have used the same idea to code. Im capturing the ITEM_PRESSED even tof the add button and have set the BubbleEvent to false. Now i have to add the transaction to Stock transfer and a respective journal is also to be added. i have written this code so let me know where im going wrong...im notable to add the journal as well as stock transfer.
*******Stock Trnasfer*******************
Public Sub StockTransfer()
Dim oST As SAPbobsCOM.StockTransfer
Dim ostLines As SAPbobsCOM.StockTransfer_Lines
Dim oEdit1 As SAPbouiCOM.EditText
Dim oEdit2 As SAPbouiCOM.EditText
Dim ostXML As SAPbobsCOM.StockTransfer
Dim ost1 As SAPbobsCOM.StockTransfer
Dim docnum As Integer
Dim strcode As String
oST = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)
ost1 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)
ostLines = oST.Lines
oItem = frmInvJE.Items.Item("11")
oEdit1 = oItem.Specific
docnum = oEdit1.String
oItem = frmInvJE.Items.Item("16")
oEdit2 = oItem.Specific
oST.TaxDate = oEdit2.String
oItem = frmInvJE.Items.Item("14")
oEdit2 = oItem.Specific
oST.DocDate = oEdit2.String
oItem = frmInvJE.Items.Item("18")
oEdit1 = oItem.Specific
oST.FromWarehouse = oEdit1.String
oST.PriceList = "10"
oST.Series = 32
oST.Lines.ItemCode = "A00001"
oST.Lines.WarehouseCode = "02"
oST.Lines.Price = "500"
oST.Lines.Quantity = "1"
oST.Lines.Add()
oST.Add()
oST.SaveXML("st2.xml")
Try
ostXML = oCompany.GetBusinessObjectFromXML("E:\SAP\Sample\07Feb05\InvtJE\InvtJE\bin\st2.xml", 0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try
MsgBox(oST.GetByKey(oST.DocNum))
If oST.GetByKey(oST.DocNum) <> docnum Then
ost1.DocDate = ostXML.DocDate
ost1.TaxDate = ostXML.TaxDate
ost1.Series = ostXML.Series
ost1.FromWarehouse = ostXML.FromWarehouse
ost1.Lines.ItemCode = ostXML.Lines.ItemCode
ost1.PriceList = ostXML.PriceList
'oST.Lines.ItemDescription = ostXML.Lines.ItemDescription
ost1.Lines.Quantity = ostXML.Lines.Quantity
ost1.Lines.Price = ostXML.Lines.Price
ost1.Lines.WarehouseCode = ostXML.Lines.WarehouseCode
ost1.Lines.Add()
ost1.Add()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
oCompany.GetNewObjectCode(strcode)
MsgBox(strcode)
End Sub
******************************************
****************Journal**********************
Public Sub CreateJournal(ByVal WHPriceFrom As Double, ByVal WHPriceTo As Double)
'Dim oCmpny As SAPbobsCOM.Company
Dim oJE As SAPbobsCOM.JournalEntries
Dim oJL As SAPbobsCOM.JournalEntries_Lines
oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
oJl = oJE.Lines
oJl.AccountCode = ""
oJl.Debit = WHPriceTo
oJl.Add()
oJl.AccountCode = ""
oJl.Credit = WHPriceFrom
oJl.Add()
If WHPriceFrom < WHPriceTo Then
oJl.AccountCode = ""
oJl.Credit = WHPriceTo - WHPriceFrom
Else
oJl.AccountCode = ""
oJl.Debit = WHPriceFrom - WHPriceTo
End If
oJl.Add()
oJE.Add()
***********************************************
Regards
Amudha
Add a comment