Skip to Content
author's profile photo Former Member
Former Member

DI - Export/Import JournalEntries to XML

Hi,

I want to export all JournalEntries, with their JournalEntries_Lines, using SaveXML, and them import, loading the XML file, using the Company GetBusinessObjectFromXML function.

To export just one, I use

Dim oJE As SAPbobsCOM.JournalEntries

oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)

If oJE.GetByKey(23) Then

oCA.SaveXML("c:MyJE23.xml")

End If

but, how to export all? I tried with a recordset but it saves a XML file that after doesn´t work with the GetBusinessObjectFromXML function.

What is the XML format to import several JournalEntries with their JournalEntries_Lines, using GetBusinessObjectFromXML, or the JournalEntries.Browser.ReadXml method? Or, if there is another way to do that?

Could someone help me?

Thanks a lot,

Ribeiro Santos

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 13, 2005 at 09:26 AM

    Hi,

    There's no option to export more than one object at a time; you will have to handle it by yourself:

    1) Export each object separately

    <?xml version="1.0" encoding="UTF-16"?>

    <BOM>

    <BO>

    .... here are the data of a single Business Object...

    </BO>

    </BOM>

    2) Add them to one XML that is structured like this:

    <?xml version="1.0" encoding="UTF-16"?>

    <BOM>

    <BO>

    .... here comes the first Business Object...

    </BO>

    <BO>

    .... here comes the second Business Object...

    </BO>

    </BOM>

    3) For import you can use both: GetBusinessObjectFromXML or GetBusinessObject + afterwards use .Browser.ReadXML.

    In both cases you should use exception handling (in case there are errors in the XML) + you will have to call "Add" and determine whether or not it succeeded.

    Please note that there has been a post ("DI: Import XML") regarding the XmlExportType property of the Company object that is also featured in the developer area...

    HTH,

    Frank

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      Besides the fact that the start tag (<JournalEntries>) does not match the end tag (<Journal_Entries>) - and that is what the exception says, didn't you save a journal entry to XML first?

      The tag for the journal entry header data is either <JDT1> or <JournalEntries_Lines> depending on what you set XmlExportType to.

      xet_AllNodes - the default value - will generate a XML you cannot read in in any case. You will have to use one of the other options (see DI API 2004 helpfile).

      Unfortunately there seems currently to be some bug so that only xet_ExportImportMode works (for both) ReadXML + BetBusinessObjectFromXML - at least without any need to modify anything.

      HTH,

      Frank

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.