cancel
Showing results for 
Search instead for 
Did you mean: 

Goods Receipt Cluster "chile"

martin_heigl
Participant
0 Kudos

Hi,

hi want create a goods receipt in a chile - database

(code-fragment)

...

odocument.getbusinessobject(oInventoryGenEntry )

oducument.docentry=2008/10/01

odocument.line.itemcode='9008100021'

odocument.line.price=3.44

odocument.line.quantity=5

odocument.add

...

in all other database is no error. Only in a chile-database (new database, template 'chile')

regards

Martin Heigl

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Martin ,

I think you did a typo here, docentry can't be odocument.docentry=2008/10/01. and you need not specify docentry anyway. one more thing. return your odocument.add as some integar. like


dim RetVal  as integar
RetVal = odocument.Add
                    If RetVal <> 0 Then
                        oCompany.GetLastError(ErrCode, ErrMsg)
                        MsgBox(ErrMsg)
                    End If

you will get to know the exact error message.

HTH,

Binita

Edited by: Binita Joshi on Oct 1, 2008 9:14 AM

martin_heigl
Participant
0 Kudos

Hello,

this script is ok, no errors!

odocument.getbusinessobject(oInventoryGenEntry )
odocument.line.itemcode='9008100021'
odocument.line.price=3.44
odocument.line.quantity=5
odocument.add

when i set the date, then the di-api-command "add" send a break without errors

odocument.getbusinessobject(oInventoryGenEntry )
oducument.docentry=2008/10/01
odocument.line.itemcode='9008100021'
odocument.line.price=3.44
odocument.line.quantity=5
odocument.add  <- break!

getlasterror = empty!

only in chile-database!

when i set a other propertie, then i've the same Error

odocument.getbusinessobject(oInventoryGenEntry )
oducument.comments='hello'
odocument.line.itemcode='9008100021'
odocument.line.price=3.44
odocument.line.quantity=5
odocument.add <- break!

getlasterror = empty!

After the break the api is demage. The application must be restartet.

Former Member
0 Kudos

Hi Martin,

There seem to be a sections in your code that may be causing this issue:

- You are using the DocEntry property which is not used for the document date, therefore it will not accept the date you enter. Use DocDate instead

- You are not treating the date 2008/10/01 as a string which it should be.

- You perform getbusinessobject on the document object when this should be done on the company object

I would advise using Try-Catch statements to catch exceptions to prevent crashes. Please see the following sample, which I tested on a Chile database using Business One 2007 A PL42:

Try
    Dim odocument As SAPbobsCOM.Documents
    
    Set odocument = oCompany.GetBusinessObject(oInventoryGenEntry)
    
    odocument.DocDate = "2008/9/29"
    odocument.Lines.ItemCode = "test"
    odocument.Lines.Price = 3.44
    odocument.Lines.Quantity = 5
            
            oReturn = odocument.Add
            
            If oReturn <> 0 Then
                oCompany.GetLastError oError, errMsg
                MsgBox (errMsg)
            Else
                MsgBox "Goods Receipt Added"
            End If
Catch ex As Exception
msgBox(ex.toString())
End Try

Hope this is useful,

Regards,

Niall

SAP Business One Forums

martin_heigl
Participant
0 Kudos

Hello,

thanks for the answers.

the message of the catch is: Process can't be proceded

* You are using the DocEntry property which is not used for the document date, therefore it will not accept the date you enter. Use DocDate instead ==> is ok

* You are not treating the date 2008/10/01 as a string which it should be. ==> this is not the reason. same error without date (comments, ref2...). i've no errors in other database.

* You perform getbusinessobject on the document object when this should be done on the company object -> i've made a new companyobject for the example.

but the errors are sporadic. i think, is a demage in the database.

Have you a idea how i can test this?

in sap i can create good receipt

without properties on document (comments, date, ref2) i can create good receipt

only with properties on document i can't create a good receipt.

regards

Martin Heigl

Former Member
0 Kudos

Then try on a fresh db and check.

Vasu Natari.

Former Member
0 Kudos

Hi Martin,

To test if it is the database which is the issue, the easiest way is the following

- Create a new database or restore a demo database to the same server as the problematic database

- Connect to this database using the same project, same machine and user

- Run the code to add the goods receipt

If you find that your code works on other databases, you will have isolated it to this single company database and should contact support.

If you find the error on all databases, could you please post your full code sample so we can test it on our machines?

Regards,

Niall

SAP Business One Forums

martin_heigl
Participant
0 Kudos

Hi all,

thank you for the very fast answer.

The database was demaged.

regards

Martin Heigl

Answers (1)

Answers (1)

Former Member
0 Kudos

Whats the error that ur getting.. ?

Vasu Natari.