cancel
Showing results for 
Search instead for 
Did you mean: 

insert/copy by xml

Former Member
0 Kudos

I want to insert a new quotation by xml.

I save an existing quotation as a xml file, change the DocNum to the next free number manually. Then I want to save this xml file but I get the following error:

-5002

Can't assign to line total property [QUT1.LineTotal][line: 1]

Here is the code for saving to xml:

Dim quotation As SAPbobsCOM.Documents

oDI.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode

quotation = oDI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQuotations)

quotation.GetByKey("23")

quotation.SaveXML("c:\xml\quotation.xml")

' manually change DocNum in xml to the next free DocNum

The code for reading xml

Dim quotation As SAPbobsCOM.Documents

oDI.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode

quotation = oDI.GetBusinessObjectFromXML("c:\xml\quotation.xml", 0)

quotation.add()

When I look at the value of total line, I get "100" (quotation.Lines.LineTotal.ToString).

Who has a solution?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I found the solution:

In the xml import file I delete the property <LineTotal>...</LineTotal> and it works

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Have you tried to remove the docnum tag on your xml file? DocNum is automatically created by B1, it is better to work without it in xml.

In my B1 2005A version (6.80.120 SP:00 PL:01) it works even fine by setting the docnum with the following free docnum. Which version are you using?

I'm using also the same export mode as you:

pCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode

If removing the DocEntry property on your xml file does not change anything I propose you to create a message for the SDK support.

Regards

Trinidad.

jaccomoolenaar
Participant
0 Kudos

Hi Johann,

I think the problem is that you only change the docnum. You should also change the docentry of the document sinces this is the key of the record.

Hope this helps....

Jacco