Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question