cancel
Showing results for 
Search instead for 
Did you mean: 

How to get CardCode from Purchase Order

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

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

Former Member
0 Kudos

This was the error: The DocNum and the DocEntry are in my 9.1 Testsystem equal, but on the 9.0 productive system there is a difference. Thank you very much for the hint )))

Answers (1)

Answers (1)

former_member185682
Active Contributor
0 Kudos

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