cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add Business Partner using XML (DI Server)

Former Member
0 Kudos

Hello Experts,

I am stuck at a place and need your guidance.

I need to add a business partner into SBO using XML(DI Server).

have a look at the code given below.

Plz let me know what is the issue, or where i am wrong.

Any inputs will be helpful.

private void ADDBP_Click(object sender, EventArgs e)

        {

            this.CreateSession();

            try

            {

                string sCmd = @"<?xml version=""1.0"" encoding=""UTF-16""?>";

                sCmd += @"<Envelopes>";

                sCmd += @"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">";

                sCmd += @"<env:Header><SessionID>" + this.sessionId + "</SessionID></env:Header>";

                sCmd += @"<env:Body>";

                sCmd += @"<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"" CommandID=""Add BP"">";

                sCmd += @"<BOM>";

                sCmd += @"<BO>";

                sCmd += @"<AdmInfo>";

                sCmd += @"<Object>oBusinessPartners</Object>";

                sCmd += @"</AdmInfo>";

                sCmd += @"<BusinessPartners>";

                sCmd += @"<row>";

                sCmd += @"<CardCode>" + bpcode.Text + "</CardCode>";

                sCmd += @"</row>";

                sCmd += @"<row>";

                sCmd += @"<CardName>" + bpname.Text + "</CardName>";

                sCmd += @"</row>";

                sCmd += @"<row>";

                sCmd += @"<CardType>" + bptype.Text + "</CardType>";

                sCmd += @"</row>";

                sCmd += @"</BusinessPartners>";

                sCmd += @"<Document_Lines>";

                sCmd += @"<row>";

                sCmd += @"<TaxLiable>" + "tNO" + "</TaxLiable>";   

                sCmd += @"</row>";

                sCmd += @"<row>";

                sCmd += @"<WTLiable>" + "tNO" + "</WTLiable>";

                sCmd += @"</row>";

                sCmd += @"</Document_Lines>";

                sCmd += @"</BO>";

                sCmd += @"</BOM>";

                sCmd += @"</dis:AddObject>";

                sCmd += @"</env:Body></env:Envelope>";

                sCmd += @"</Envelopes>";

                //MessageBox.Show(sCmd);

                string itemData = node.BatchInteract(sCmd);

                MessageBox.Show(itemData);

                MessageBox.Show("Businees partner Susscesfully Add In SAP Business One");

                this.DisconnectSession();

            }

       

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

i attach snap which give me error...

Thanks

Nikunj

View Entire Topic
Former Member
0 Kudos

Hi Nikunj,

What Pedro Told You should Follow it once.

Also if you want to use it in the same code then you need to use the below code.

                sCmd += @"<BusinessPartners>";

                sCmd += @"<row>";

                sCmd += @"<CardCode>" + bpcode.Text + "</CardCode>";

                sCmd += @"<CardName>" + bpname.Text + "</CardName>";

                sCmd += @"<CardType>" + bptype.Text + "</CardType>";

                sCmd += @"<SubjectToWithholdingTax>" + "N" + "</SubjectToWithholdingTax>";

                sCmd += @"</row>";

                sCmd += @"</BusinessPartners>";

I am sure this will work for you.

Thanks,

Amit.