cancel
Showing results for 
Search instead for 
Did you mean: 

Relationship Map for Sales Order and Invoice

Former Member
0 Kudos

Dear All Experts,

I want to ask you about a process in SAP B1 SDK.

Can I do something like when I create a A/R Invoice then a particular Sales Order should be closed and the relationship map should also maintained for these 2 documents ?

Can I do this ? Please reply me for this.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kuldeep,

Yes it can be done. I don't know what your requirement is but if you will create a Sales Invoice based on a Sales Order and that Invoice will have the reference of that particular Sales Order.

Then you can maintain the relationship map as well as the functionality same as in SAP System.

You need to use DIAPI for this.

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Can I get some sample code for how to do it ?

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Here is how to do it :

SAPbobsCOM.Documents oInvoice = default(SAPbobsCOM.Documents);

oInvoice =(SAPbobsCOM.Documents)SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

            oInvoice.CardCode = "C000003";

            oInvoice.DocDueDate = DateAndTime.Now;

            oInvoice.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oOrders);

            oInvoice.Lines.BaseEntry = Convert.ToInt32(3616);

            oInvoice.Lines.BaseLine = 1;

            oInvoice.Lines.Quantity = 3;

            oInvoice.Lines.Add();

            oInvoice.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oOrders);

            oInvoice.Lines.BaseEntry = Convert.ToInt32(3616);

            oInvoice.Lines.BaseLine = 2;

            int kth = 0;

            kth = oInvoice.Add();

            if (kth != 0)

            {

                int irrcode;

                string errmsg;

                SBO_Company.GetLastError(out irrcode, out errmsg);

                Program.oMainSAPDI.ShowMessage(errmsg, BoStatusBarMessageType.smt_Error);

            }

Hope that helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

It has solved the problem but tell me why this line is used when we are giving Base Entry and Base Line already ?


oInvoice.Lines.Quantity = 3;



Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Suppose you created a Sales Order. In that Sales Order you have an item with 5 Quantity but while making invoice against this particular Sales Order, you want to make Sales Invoice for only 3 quantities.

Then you can do this as I have provided. If you need to make full invoice then use only Base Entry and Base Line.

Hope it is clear.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Thanks.

It solved the problem.

Regards

Answers (0)