cancel
Showing results for 
Search instead for 
Did you mean: 

Add Sales Order Using B1WS

Former Member
0 Kudos

Hi experts,

I am stuck at an error while adding Sales order using B1WS. Find the below attached code. Also attached the screenshot for the error.

Plz help me out asap. any suggestions will be helpful.

I have tried using Doc total and doc total specified true but still the system shows the document total needs to be zero or greater then zero.

kindly help.

CODE:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using ItemService;

using OrdersService;

using BusinessPartnersService;

public partial class SalesOrderDemo : System.Web.UI.Page

{

    LoginService.LoginService lgvsrv = new LoginService.LoginService(); 

    OrdersService.OrdersService ordsrv = new OrdersService.OrdersService();  

    BusinessPartnersService.BusinessPartnersService bpservice = new BusinessPartnersService.BusinessPartnersService();

    ItemService.ItemsService iservice = new ItemService.ItemsService();

    string licenceServer = "192.168.100.205:30000";

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void btnLogin_Click(object sender, EventArgs e)

    {

        login();

        MySample.GlbData.Sessionid = txtLoginSessionID.Text;

    }

   

    protected void btnSalesOrder_Click(object sender, EventArgs e)

    {

        OrdersService.MsgHeader oHeader = new OrdersService.MsgHeader();

        oHeader.SessionID = MySample.GlbData.Sessionid;

        oHeader.ServiceName = OrdersService.MsgHeaderServiceName.OrdersService;

        oHeader.ServiceNameSpecified = true;

        ordsrv.MsgHeaderValue = oHeader;

        BusinessPartnersService.MsgHeader oheader = new BusinessPartnersService.MsgHeader();

        oheader.SessionID = MySample.GlbData.Sessionid;

        oheader.ServiceName = BusinessPartnersService.MsgHeaderServiceName.BusinessPartnersService;

        oheader.ServiceNameSpecified = true;

        bpservice.MsgHeaderValue = oheader;

    

        OrdersService.OrdersService myso = new OrdersService.OrdersService();       

        BusinessPartnersService.BusinessPartner mybp = new BusinessPartnersService.BusinessPartner();

        OrdersService.DocumentParams docparams = new OrdersService.DocumentParams();

       // docparams.DocEntry = 656;

       //docparams.DocEntrySpecified = true;          

        OrdersService.Document dcc = new OrdersService.Document();

        DateTime dt = DateTime.Now;

        dcc.DocDueDate = dt;

        dcc.DocDueDateSpecified = true;

   

      

        dcc.CardCode = txtBPCode.Text;

      

      

       // dcc.DocTotal = 20;

       //  dcc.DocTotalSpecified = true;     

       

       

        OrdersService.DocumentDocumentLine dline = new OrdersService.DocumentDocumentLine();

        dline.ItemCode = txtItemCode.Text;     

      

        dline.Quantity = 2;

        dline.QuantitySpecified = true;

        //  dline.UnitPrice = 10;

      //  dline.UnitPriceSpecified = true;      

          

         ordsrv.Add(dcc);                         

    }

    protected void login()

    {

        string SessionID;

        lgvsrv = new LoginService.LoginService();

        SessionID = lgvsrv.Login

(txtDBServer.Text,txtDBName.Text,LoginService.LoginDatabaseType.dst_MSSQL2008,true,txtCompanyUserName.Text,txtCompanyPassword.Text,LoginService.LoginLanguage.ln_English,true,licenceServer);

        txtLoginSessionID.Text = SessionID;

    }

}

Snap :

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

Hi Nikunj,

Are you adding the document line to the document?

...

dcc.DocumentLines = new DocumentDocumentLine[] { dline };

ordsrv.Add(dcc);

...


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

thank you so much .. it solved the issue. but if you can please let me know what function it is? Is it a kind of Array or something?

Also we are trying to insert an image into a UDF in SAP. If you can plz help.

I referred to a  thread here, which says that I need to regenerate the wsdl file and then use it again. But while generating the wsdl file I am facing the error. I have pasted the error below.

kindly help.

Please correct me if I am doing any wrong thing.

thanks,

Ravi.

pedro_magueija
Active Contributor
0 Kudos

Hi Ravi,

What that is doing is creating an array with all the lines in it and attaching that array to your document. Simply put it is adding the rows of the document.

Your second question should be made in a separate thread according to SCN Rules of Engagement. I'll answer it, but next time please open a new thread.

I don't know why that error is coming up, but it's complaining that the Recordset.xsd could not be found because part of it's path couldn't be found. Check that the file is in the directory you pointed out, and sometimes it helps not having any spaces in the directories.

Please close this thread when possible.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

We solved the wsdl generator error by pasting the Recordset.xsd file to the main folder where the B1WS is installed.

Thank you for all the help.

Thanks and regards,

Ravi Sheth.


Former Member
0 Kudos

Hi Ravi,

I have same issue.

But where is the Recordset.xsd i have a xml file,and where paste it???

Thanks and Regards,

Rahul Jadhav

Former Member
0 Kudos

Hi Rahul, sorry for late reply but I didn't got your question. if you can plz clarify.

thanks,

Ravi.


Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Nikunj,

Is there any need of Setting the DocTotal when you are already setting the Quantity and Unit Price ?

Also Can you check with setting the G/L account code ?

Check this:

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

We don't need DocTotal as well as also set the G/L account code but facing same issue which shown above.

Thanks,

Nikunj

  View Nikunj Mehta's profile on LinkedIn           

Former Member
0 Kudos

Hi Ankit,

using G//L Account Code is not helping to get the error solved.

Kindly help.

Any other suggestions will be helpful.

thanks,

Ravi.