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

How to get CardCode from Purchase Order

Hello Forum,

I have developed an Addin that has to retrieve the CardCode from a Purchase Order. My code worke under B1 9.1, but not with B1 9.0. I have debugged with Visual Studio 2013 the code, but CardCode is empty, no exception is thrown, no LastErrors. Does someone know what could be the problem? I know this is Coresuite code, but the code is in most cases similar to the normal SDK code. The DocNum exits, I have added it to the DB.

public static void GetCardCodeFromPurchaseOrder(int DocNum) {

    SwissAddonFramework.B1Connector oB1Connector = SwissAddonFramework.B1Connector.GetB1Connector();
    SAPbobsCOM.Documents Order = oB1Connector.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders) as SAPbobsCOM.Documents;
    
    bool Retval = Order.GetByKey(DocNum); // But the object doesnt seemed to be filled!
    
    string CardCode = Order.CardCode;
    GetLastSAPError(); // No errors!

Thanks in advance

Mark

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 11, 2015 at 05:42 PM

    Hi Mark,

    what value has Retval ?

    Apart from that : Normally GetByKey needs the DocEntry not the DocNum.

    Sometimes they are equal, but not always.

    regards,

    Maik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 11, 2015 at 04:36 PM

    Hi Mark,

    Verifiy the version of your sap sdk. Follow this explanation:

    DI API version should be equal to the company version or smaller than that. (For example: If the company version is 8.8 than the DI API version can be 2007 or 8.8)  Maximum = the company version

    In detail (if the referenced version of DI API is installed on the client PC):

    An Add-On application using DI API 2007 can connect to any company database of version 2007 or 8.8

    An Add-On application using DI API 8.8 can connect to any company database of version 8.8, but not of version 2007

    Regards,

    Diego

    Add a comment
    10|10000 characters needed characters exceeded

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.