on 02-08-2005 12:39 PM
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Frank.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amudha,
WHen you run the company with "Continuous Stock", a stock transfer will always cause a journal entry to be posted because this is the process in SAP Business One. Search for "continuous stock" in the SAP Business One help and see and when you can change this.
In addition, I would like to draw your attention to the "Education" section in the SMB Portal on SAP ServiceMarketplace (http://service.sap.com/smb/education)!
There's a lot of information tied to the curricula you should go through to get the full picture of what you are dealing with - though you might think you would just use the SDK...
E.g. there's an "Online Learning Map" and much more!
HTH,
Frank
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.