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

Link Purchase Order to Sales Order

Hey All,

I am trying to link a purchase order created via the DI API to a sales order in the B1 system.

I set the following fields:

B1Document.oDocument.Lines.BaseEntry = B1Detail.BaseDocEntry;
B1Document.oDocument.Lines.BaseLine = B1Detail.BaseDocLine;
//set base type to sales order = 17
B1Document.oDocument.Lines.BaseType = 17;

When I add the purchase order I get this error message:

Unable to Create Document. Error: Base document card and target document card do not match. [POR1.VatGroup][line: 1]. -

After searching for this error I found forum posts relating this to mismatched cardcodes when adding invoices based on sales orders etc.. But the PO will always have a different cardcode then the sales order. I can link the purchase order using the B1 client using the PO checkbox on the sales order form with no problems.

Am I doing something wrong or is this not possible to do via SDK?

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jan 29, 2008 at 03:22 PM

    Hi Curtis,

    sorry i made a mistake 😊

    anyway. my last information is that you can't link the purchase order and sales order via diapi.

    but when you find a way please post it

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member David Nussböck, Ing.

      OK I even tried setting this in XML:

      xmltemplate.InnerXml.Replace("<BaseCard></BaseCard>", "<BaseCard>C20000</BaseCard>");

      I then used that xml to load the purchase order object via GetBusinessObjectFromXML and it still gets the same error. Is there anyone who has figured out a way to do this?

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 01:22 PM

    Anyone else have problems with this?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 05:46 PM

    I found that because the cardcode on the po and the cardcode on the sales order do not match I could not perform the link.

    ultimately I created my own linking mechanism by putting a hidden smart navigation arrow on the form (because I can't get it in the matrix).

    Then capturing the double click event on a line level udf I called Target doc num.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for that information John. That's what I figured we would have to do. I also opened a support ticket for this with SAP as I don't understand why this can be completed in the client but not in the API.

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.