title: Error "Please enter sold to party or ship to party" while calling BAPI_SALESORDER_CREATEFROMDAT1
body: <p>I am trying to integrate SAP with .NET web application using SAP .NET connector. </p>
  
  <p>I have successfully connected to the SAP system but when I try to create a sales order in SAP using <code>BAPI_SALESORDER_CREATEFROMDAT1</code> I get following error:</p>
  
  <blockquote>
    <p>Please enter sold to party or ship to party.</p>
  </blockquote>
  
  <p>The code snippet I use:</p>
  
  <pre><code>    public class CreateSalesOrder
      {
      public string  CreateOrder(RfcDestination destination)
      {
          try
          {
              RfcRepository repo = destination.Repository;
              IRfcFunction salesDoc = repo.CreateFunction("BAPI_SALESORDER_CREATEFROMDAT1");
              IRfcFunction salesDocCommit = repo.CreateFunction("BAPI_TRANSACTION_COMMIT");
  
              IRfcStructure salesHeader = salesDoc.GetStructure("ORDER_HEADER_IN");
  
              IRfcTable salesItems = salesDoc.GetTable("ORDER_ITEMS_IN");
              IRfcTable salesPartners = salesDoc.GetTable("ORDER_PARTNERS");
  
              IRfcStructure salesItemsStruct = salesItems.Metadata.LineType.CreateStructure();
              IRfcStructure salesPartnersStruct = salesPartners.Metadata.LineType.CreateStructure();
              IRfcStructure salesPartnersStructRow2 = salesPartners.Metadata.LineType.CreateStructure();
  
              //Sales Header
              salesHeader.SetValue("DOC_TYPE", "ZDLR");
              salesHeader.SetValue("SALES_ORG", "1000");
              salesHeader.SetValue("DISTR_CHAN", "00");
              salesHeader.SetValue("DIVISION", "00");
              salesHeader.SetValue("SALES_OFF", "1001");
  
              //Sales Items
              salesItemsStruct.SetValue("ITM_NUMBER", "323");
              salesItemsStruct.SetValue("PLANT", "1001");
              salesItemsStruct.SetValue("MATERIAL", "20000206");
              salesItemsStruct.SetValue("TARGET_QTY", "200");
              salesItemsStruct.SetValue("REQ_QTY", "200");
  
              // Partner
              salesPartnersStruct.SetValue("PARTN_ROLE", "SP");
              salesPartnersStruct.SetValue("PARTN_NUMB", "102003");
  
  
              RfcSessionManager.BeginContext(destination);
              salesDoc.Invoke(destination);
              salesDocCommit.Invoke(destination);
              RfcSessionManager.EndContext(destination);
              return "";
          }
  
          catch (RfcCommunicationException e)
          {
              return e.ToString();
  
          }
          catch (RfcLogonException e)
          {
              // user could not logon...
              return e.ToString();
          }
          catch (RfcAbapRuntimeException e)
          {
              // serious problem on ABAP system side...
              return e.ToString();
          }
          catch (RfcAbapBaseException e)
          {
              return e.ToString();
              // The function module returned an ABAP exception, an ABAP message
              // or an ABAP class-based exception...
          }
  
      }
  }
  </code></pre>
  
  <p>Please, suggest what I am doing wrong in the call. I properly pass partner details in the following code snippet:</p>
  
  <pre><code>     // Partner
              salesPartnersStruct.SetValue("PARTN_ROLE", "SP");
              salesPartnersStruct.SetValue("PARTN_NUMB", "102003");
  </code></pre>
  
  <p>Thanks,
  Naveed</p>