Documents.GetByKey returns an invalid document

I have come across a really weird DI API problem, which seems to be related to some databases, but not specifically to any specific version of SBO or DI API. I have reproduced the problem on both SBO 6.5 and 2004.
With some databases, especially the demo databases that come along with the SBO installation package, the invoice document that is retrieved with the GetByKey method, does not contain the actual data from the invoice in question. Instead, it seems like it's totally empty. With other databases, the same code works perfectly fine.
Here is the C# code snippet:
============================
doc=(Documents)app.session.GetBusinessObject(BoObjectTypes.oInvoices);
AppData.getInstance().logDebug("Instantiating document no:"+docNo);               
doc.GetByKey(docNo);
AppData.getInstance().logDebug("DocTotal from DI API:"+doc.DocTotal);                    
AppData.getInstance().logDebug("CARDNAME from DI API:"+doc.CardName);
This is what is shown in the log:
=================================
DEBUG - Instantiating document no:105
DEBUG - DocTotal from DI API:0
DEBUG - CARDNAME from DI API:
This is what is shown in the log when using another database:
================================
DEBUG - Instantiating document no:28
DEBUG - DocTotal from DI API:2963,62
DEBUG - CARDNAME from DI API:Inex Partners Oy
...as you can see, the application works well with another database but does not work with another. Both databases are on the same server and are the same version level. In both cases, the document that is being instantiated is of type "oInvoices" and its status is open.
First I thought that this is somehow just related to the demo databases, but now I've come across a customer that is experiencing the same problem. Has anyone seen this kind of problem before?
Regards,
Henry

Hi,
Thank you for your help. This was the suggestion which I also got from the service marketplace today and it finally got me to the root of the problem. As you suggested, I was using the wrong identifier (DocNum instead of DocEntry) for retrieving the document. It worked well on those databases where the default document numbering was used for invoices (starting from 1), but naturally didn't work when a different document numbering scheme was used.
The thing that was really confusing for me was that the DI API does not throw any exception when I try to call GetByKey with a key that does not point to a document in the database.
Regards,
Henry

Similar Messages

  • How to clear accounting document for returns

    Hi Experts,
    We processed a sales return and now we need to clear the accounting document generated by the Credit memo, how can I do that?
    Also, how can I close the Returns document?

    Hi
    For accounting document its better to ask your FI guy but in my opinion I guess it is cleared with original invoice or with any other AR amount in F-32 but as I am not FI guy so I am not so sure about it and for return document you didn't have PGR that document. Just open that in VL02N and click on Post Goods Receipt. If this is not a delivery document then share what document is it.
    Thank$

  • In adobe reader app on iPad, I have a PDF document that added notes and comments to.  Once I left the document and returned to it, the notes and comments were gone.  Where are they?  I clicked "save" and "done" buttons after I entered text.

    In adobe reader app on iPad, I have a PDF document that added notes and comments to.  Once I left the document and returned to it, the notes and comments were gone.  Where are they?  I clicked "save" and "done" buttons after I entered text.

    The application auto-saves your input when you close the document.  If you left the document, as you state, the notes/comments should have been saved and should have been visible the next time you opened the document with the Mobile Reader (note that if you are opening the document with another app such as Apple's built in PDF Viewer, things like notes/comments may not be visible).  Also note that if you are doing an Open In... from another app (like Dropbox), the version of the document in Dropbox does not update; only the version of the document in the Mobile Reader is updated.
    Would it be possible to send a video of the problem you are encountering to [email protected] so that we can try to help?

  • I have Dreamweaver CS5.5 and all of a sudden I can't open it says XML parsing fatel error.  Invalid Document Structure  What do I do?  Thanks

    I have Dreamweaver CS5.5 and all of a sudden I can't open it says XML parsing fatel error.  Invalid Document Structure  What do I do?  Thanks

    You need to rename the Configuration folder to Configuration_BU.
    The folder can be found by following this http://www.dmxzone.com/go/16740/clearing-dreamweaver-s-cache/

  • Copying of freight conditions from billing document to return order

    Hi,
    I have a scenario of returns with reference to the billing document. In earlier billing documents the conditions like freight, insurance etc., are maintained. While creating the return order with reference to the preceding billing document, system is copying the freight, insurance conditions also, which I donu2019t require in case of returns scenario. Can anyone help me to come out from this problem?
    Thanks
    Srinivas

    Hi
    In VTAF choose your source billing type and target sales type and choose your item category
    In that i think in your case D is set
    You can define a new pricing procedure for your return order and make the necessary settings in OVKK by leaving out all freight conditions
    After this In VTAF choose your source billing type and target sales type and choose your item category
    In pricing type you can set it to B so that a new pricing is carried out without the unwanted condition types when you make the return order referencing the billing doc
    Alternatively you also try with pricing type H in that pricing type that is freight gets redetermined
    Regards
    Raja
    Edited by: ramanathan raja on Nov 20, 2008 8:57 PM

  • Correction Invoice and "invalid document structure" problem

    Hello!
    Can anybody explain what properties are obligatory for correction invoices? I'm trying to add() one and it always say -5002: invalid document structure.
    In the CSI1 table I see linenum has to be unique, every baseline is twice. Do I make any stupid mistake? If so - where? What's wrong? Something is ommitted?...
                                                                                    Thanks in advance!
                                                                                    This is a snippet (two loops are unnecessary, I was looking for other ways). I'm trying just to zero the invoice. Should quantity in was lines be negative? It does not matter - everytime -5002...
         @Test
         public void testSAPCorrectionInvoice() throws SBOCOMException {
              ICompany company = sapConnector.getCompany();
              // Integer srcDocEntry = 6457;
              Integer srcDocEntry = 7084;// this one has no batches
              logger.debug("Creating correction to: " + srcDocEntry);
              // source doc
              IDocuments srcDoc = SBOCOMUtil.getDocuments(company,
                        SBOCOMConstants.BoObjectTypes_Document_oInvoices, srcDocEntry);
              logger.debug("srcDoc: " + srcDoc.getDocObjectCode() + ", "
                        + srcDoc.getDocNum());
              IDocuments sapDoc = SBOCOMUtil.newDocuments(company,
                        SBOCOMConstants.BoObjectTypes_Document_oCorrectionInvoice);
              // header:
              sapDoc.setHandWritten(SBOCOMConstants.BoYesNoEnum_tNO);
              sapDoc.setSeries(317);
              sapDoc.setDocType(SBOCOMConstants.BoDocumentTypes_dDocument_Items);
              sapDoc.setCardCode(srcDoc.getCardCode());
              sapDoc.setCardName(srcDoc.getCardName());
              sapDoc.setAddress(srcDoc.getAddress());
              String federalTaxID = srcDoc.getFederalTaxID();
              if (federalTaxID.length() > 0)
                   sapDoc.setFederalTaxID(federalTaxID);
              sapDoc.setDocDate(new Date());
              sapDoc.setDocDueDate(new Date());
              sapDoc.setSalesPersonCode(srcDoc.getSalesPersonCode());
              sapDoc.setDocCurrency(srcDoc.getDocCurrency());
              sapDoc.setPaymentGroupCode(srcDoc.getPaymentGroupCode());
              sapDoc.setTransportationCode(srcDoc.getTransportationCode());
              sapDoc.setContactPersonCode(srcDoc.getContactPersonCode());
              // sapDoc.setDiscountPercent(0.0);
              sapDoc.setComments("zwrot towaru");
              // sapDoc.setDocTotal(0.0);
              sapDoc.setVatDate(srcDoc.getVatDate());
              // items
              IDocument_Lines lines = sapDoc.getLines();
              int lineno = 0;
              IDocument_Lines srcLines = srcDoc.getLines();
              for (int i = 0; i < srcLines.getCount(); i++) {
                   srcLines.setCurrentLine(i);
                   logger.debug("line " + i + ", item: " + srcLines.getItemCode());
                   if (lineno > 0)
                        lines.add();
                   lines.setCurrentLine(lineno++);
                   lines.setItemCode(srcLines.getItemCode());
                   lines.setItemDescription(srcLines.getItemDescription());
                   lines.setWarehouseCode(srcLines.getWarehouseCode());
                   lines.setPrice(srcLines.getPrice());
                   lines.setDiscountPercent(srcLines.getDiscountPercent());
                   lines.setTaxCode(srcLines.getTaxCode());
                   lines.setBaseEntry(srcDocEntry);
                   lines.setBaseType(srcDoc.getDocObjectCode());
                   lines.setBaseLine(i);
                   lines.setVatGroup(srcLines.getVatGroup());
                   lines
                             .setCorrectionInvoiceItem(SBOCOMConstants.BoCorInvItemStatus_ciis_Was);
                   double quantity_was = srcLines.getQuantity();
                   lines.setQuantity(quantity_was);
              for (int i = 0; i < srcLines.getCount(); i++) {
                   srcLines.setCurrentLine(i);
                   logger.debug("line " + i + ", item: " + srcLines.getItemCode());
                   if (lineno > 0)
                        lines.add();
                   lines.setCurrentLine(lineno++);
                   double quantity_diff = 0;
                   lines.setItemCode(srcLines.getItemCode());
                   lines.setWarehouseCode(srcLines.getWarehouseCode());
                   lines.setPrice(srcLines.getPrice());
                   lines.setDiscountPercent(srcLines.getDiscountPercent());
                   lines.setTaxCode(srcLines.getTaxCode());
                   lines.setBaseEntry(srcDocEntry);
                   lines.setBaseType(srcDoc.getDocObjectCode());
                   lines.setBaseLine(i);
                   lines.setVatGroup(srcLines.getVatGroup());
                   lines
                             .setCorrectionInvoiceItem(SBOCOMConstants.BoCorInvItemStatus_ciis_ShouldBe);
                   double quantity_was = srcLines.getQuantity();
                   double quantity_is = 0; //quantity_was - quantity_diff;
                   lines.setQuantity(quantity_is);
              int result = sapDoc.add();
              String info = company.getLastErrorDescription();
              logger.debug("res = " + result + ", info: " + info);
              if (result != 0)
                   throw new EBladKorektyNrPartii(
                             "Cannot create document: " + info);
    Edited by: WodzGalopujacySkleroz on Jul 4, 2011 5:03 PM

    Hello,
      Maybe it's an old thread, and you might have the solution or workaround for this. Nonetheless i try to answer, it might be useful for those trying to find a solution for the same problem.
      The two loops are necessary indeed. DI API expects only this structure: Start with all the "ShouldBe" lines, and follow them with all the "Was" lines. So your code is almost good, but you should have swap the two loops with each other.

  • PO_CHANGE_API1_S.UPDATE_PO Errors out with Your document ID's are invalid.

    Hi Guys
    The Code Given below is used to update an existing PO's Line Info.
    DECLARE
    l_result number;
    p_api_errors PO_API_ERRORS_REC_TYPE;
    BEGIN
    l_result:=PO_CHANGE_API1_S.UPDATE_PO(X_PO_NUMBER =>'4753',
    X_RELEASE_NUMBER =>1,
    X_REVISION_NUMBER =>0,
    X_LINE_NUMBER =>1,
    X_SHIPMENT_NUMBER =>1,
    NEW_QUANTITY =>30,
    NEW_PRICE =>600,
    NEW_PROMISED_DATE =>NULL,
    LAUNCH_APPROVALS_FLAG =>'N',
    UPDATE_SOURCE =>NULL,
    VERSION =>'1.0',
    X_OVERRIDE_DATE =>NULL,
    X_API_ERRORS =>P_API_ERRORS,
    P_BUYER_NAME =>null);
    IF (l_result <> 1) THEN
    -- Display the errors
    FOR i IN 1..p_api_errors.message_text.COUNT LOOP
    dbms_output.put_line (p_api_errors.message_text(i));
    END LOOP;
    END IF;
    END;
    I created a Blanket Purchase Order Approved the same and created a release for that Blanket PO.
    I didnt approve the Release.
    When i ran this API from Toad i am getting this error :
    Your document ID's are invalid, or could not found.
    Regards
    Nakul.V

    Original post is not a question. It's an answer.
    Message was edited by: pgn674

  • Invalid document structure?

    "add a spry xml date" in dreamweaver cs3
    when i browsed an xml file then "get schema" it
    "row element" say : invalid document structure
    but yesterday just is ok,why today... :(

    3q Don,but my XML file is OK
    <?xml version="1.0" encoding="UTF-8"?>
    <specials>
    <menu_item id="1">
    <item>Summer Salad</item>
    <description>organic butter lettuce with apples, blood
    oranges, gorgonzola, and raspberry vinaigrette.</description>
    <price>7</price>
    <url>summersalad.xml?id=1</url>
    </menu_item>
    <menu_item id="2">
    <item>Thai Noodle Salad</item>
    <description>lightly sauteed in sesame oil with baby
    bok choi, portobello mushrooms, and scallions.</description>
    <price>8</price>
    <url>thainoodles.xml</url>
    </menu_item>
    <menu_item id="3">
    <item>Grilled Pacific Salmon</item>
    <description>served with new potatoes, diced beets,
    Italian parlsey, and lemon zest.</description>
    <price>16</price>
    <url>salmon.xml</url>
    </menu_item>
    </specials>

  • I modify a document en word and saved it. I need to return to the document before the modification. How can I do it? Thank You

    I modify a document en word and saved it. I need to return to the document before the modification. How can I do it? Thank You

    Are you using Time Machine? If not, do you have a backup?
    Best of luck.

  • Querying list items of document libraries returns incorrect values.

    I have several document libraries. I am trying to get only the documents that the a selected user has however it is returning other authors documents. Attached is my code. Any help would be greatly appreciated.
    CamlQuery camlQuery = new CamlQuery();
    string query = "<View Scope='Recursive' /><ViewFields><FieldRef Name='File' /><FieldRef Name='FileLeafRef' /><FieldRef Name='LinkFilename'/><FieldRef Name='LinkFilenameNoMenu' /><FieldRef Name='Modified' /><FieldRef Name='Created' /><FieldRef Name='Author' /></ViewFields>" + "<Where><Eq><FieldRef Name='Author' LookupId='TRUE'/><Value Type='Integer'>" + user.Id + "</Value></Eq><AND><Eq><FieldRef Name='ContentType' /><Value Type='Computed'>File</Value></Eq></And></Where>" +
    "<OrderBy><FieldRef Name='Created' /><FieldRef Name='Modified' /></OrderBy><QueryOptions><RowLimit>" + count + "</RowLimit></QueryOptions></View>";
    camlQuery.ViewXml = query;
    listItems = list.GetItems(camlQuery);
    clientContext.Load(listItems);
    clientContext.ExecuteQuery();

    Hi,                                                             
    The CAML statement below can filter the documents created by a specific user,
     please test it in your environment:
    @"<View Scope='RecursiveAll'>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name='Author' />
    <Value Type='User'>Display Name</Value>
    </Eq>
    </Where>
    </Query>
    <ViewFields>
    <FieldRef Name='FileLeafRef' />
    <FieldRef Name='Author' />
    </ViewFields>
    </View>";
    Best regards
    Patrick Liang
    TechNet Community Support

  • Dreamweaver CS5 fatal error XML parsing: Invalid document structure, line:1, File: C:\User\Tyler\App

    XML parsing fatal error: Invalid document structure, line: 1, file: C:\User\Tyler\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configureation\Workspace\Classic.xml
    I have gone through older disscussion forums and have followed the steps recommended by deleting the corrupted .xml file itself (in this case "Classic.xml") but imidiatly after when i try to open Dreamweaver again, i am prompted with the same fatal error message including the file that i have just deleted. Next i deleted the entire configure file and this did not help either.
    It is also odd that when i follow the path to find the corrupted .xml file from the prompt, the path is different in that i do not find the "Classic.xml" file through th "en_US\Configuration\Weorkspace" navigation, however i do find the corrupt "Classic.xml" file in the "configure" folder of the "Adobe Dreamweaver CS5" file.
    Im not sure what to do now and i would really like Dreamweaver back up and running so please help if you can!!!
    Thanks
    -Tyler

    Step 1: Close DW, Navigate to C:\User\Tyler\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\Configureation\Workspace\ and delete that Classic.xml file
    Re-open DW. DW should auto-create your Workspace layout XML file again. See if it works fine.
    PROCEED TO STEP 2 ONLY IF STEP 1 DOESN'T SOLVE THE ISSUE
    Step 2: Navigate to C:\Users\Tyler\AppData\Roaming\Adobe\Dreamweaver CS5\en-US\Configuration and delete the entire 'CONFIGURATION' folder. Re-open DW. DW should auto-create your configuration folder based on predefined layouts and config options. This will definitely fix your issue.
    Reason for this issue: This issue would have been caused due to a malformed workspace layout configuration. That may happen due to customizations you may have done to the layout/ improper file permissions/ improper shutdown on Windows.
    See if these fixes resolve your issue and post your results here.
    Cheers,
    ST

  • Dreamweaver stopped working. XML parsing fatal error: Invalid document structure, line1  Tried reloading DW. Didn't work.

    Dreamweaver (CS5) stopped working.  The error message says - XML parsing fatal error: Invalid document structure, line: 1, I tried to reload DW. No change. I also tried to reset the computer to an earlier date before I reloaded. Also didn't work. Can anybody shed some light?

    The first thing to try is Deleting Corrupted Cache.  Be sure to turn on Hidden Files & Folders in your file manager (Win Explorer or Mac Finder).
    http://forums.adobe.com/thread/494811
    If that doesn't help, try Restore Preferences
    http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    If all else fails, use the CC Cleaner Tools below to wipe DW from your system, followed by a software re-install.
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html
    Keep us posted on your results.
    Nancy O.

  • XML parsing fatal error: Invalid document structure, line: 1, file: ... (in this case "Classic.xml"

    dreamweaver not initiating..claiming a parsing fatal cerr because classic.xml is corrupted. I tried re-installing dreamweaver... nothing

    See here Dreamweaver CS5 fatal error XML parsing: Invalid document structure, line:1, File: C:\User\Tyler\App

  • How to return the XMLDOM Document to the caller of a URL?

    Hi,
    We are using Oracle9.2 and have created applications and reports written in PL/SQL + Oracle Web Toolkit. A PL/SQL Package now generates an XML document using XMLDOM, and is invoked by calling an URL. The customer is looking for ways to create a kind if Web Service out of this Package, without using OC4J / JDeveloper to deploy it - they simply don't want to go there, yet.
    The question then is: How can they simulate a Web Service by returning the content of the XMLDOM document in the URL? Creating an XML file on disk or putting the XMLDOM document into a CLOB works fine. But how can they most easily return the XMLDOM document to the caller simply by using the URL itself?
    Please ask for clarifications if needed. Any good suggestions are highly appreciated. Thanks, Eilev.

    Hi, I can answer my own question as it turns out the answer was just as simple as I was hoping for:
    By printing the content of the XMLDOM document using HTP.PRINT it can easily be picked up and parsed by the caller.
    Have a wonderful day :-)

  • Can't open DW CS5.5  Invalid document structure line 1 - anyone know how to fix this?

    I get:
    XML parsing fatal error: Invalid document structure, line 1, file:

    The first thing to try is Deleting Corrupted Cache in DW
    http://forums.adobe.com/thread/494811
    If that doesn't help, try Restore Preferences
    http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    If all else fails, use the CC Cleaner Tools below followed by a software re-install.
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html
    Nancy O.

Maybe you are looking for