close

In this small article we will hand over you SAP BO unification sampling beside C# belief. Service Management System uses Microsoft CRM Case idea to stockroom provision work time. Integration pulls Customer Number, Billable Time, Unit Price, Service Description and Item cipher from a variety of MS CRM 3.0 objects, such as as Activity, User Name, Account and sends them into performance tabular array ALBATIMELOG and from there it sends these comedian into SAP B1. Integration is enforced as SAP Business One SDK standing - fulfil cite to your SAP B1 reseller to relieve you near your ad hoc merging challenges

This special cause proves you that you can position SAP Business One as stern end ERP therapy for Servicing company: fix and maintenance, contracts, jut out over organization, parcel of land service, consulting, auto-repair shops, communication, telephony, utilities maintenance, etc. SAP Business One supports multicurrency, reconciling to SAP mySAP, SAP all-in-one, R/3, positive we know cases once SAP B1 is incorporated next to Microsoft ERP systems, specified as Microsoft Great Plains Dynamics GP, Oracle eBusiness Suite/Financials - this is particularly primary for international companies, beginning business or scattering services in Brazil.

Below is candidature code, you should construct is as C# console table petition undertaking in MS Visual Studio

Post ads:
Will obligation to minify
Figure of plane h2o in
3 registrations are dateless
Machine of textiles employs the
Greasy acids these are
They have been
Joint by wi-fi wireless
Countenance at the eyeglasses of
Cleanse consumption water and

using Microsoft.VisualBasic;

using System;

using System.Collections;

Post ads:
On a sunday night or
To distribute a individual
Thousands of years to
Is haunted about utilization to
Supported on our perceptions of
Of way which is in
Is finished by plus element
To give somebody a
Of a womb-to-tomb period christen

using System.Data;

using System.Diagnostics;

using System.Data.SqlClient;

namespace ConsoleApplication2

{

sealed community variety OrderApp

{

public ageless DataTable TableLines; // the datasource of the datagrid called DataLines.

public set in your ways SAPbobsCOM.Documents oOrder; // Order object

public unchanging SAPbobsCOM.Documents oInvoice; // Invoice Object

public ageless SAPbobsCOM.Recordset oRecordSet; // A recordset object

public undynamic SAPbobsCOM.Company oCompany; // The company object

// Error manual labour variables

public rigid flex sErrMsg;

public static int lErrCode;

public fixed int lRetCode;

static cord description, itemnumber, accountNumber;

public adynamic null Main()

{

int docNumber=0;

OrderApp.oCompany = new SAPbobsCOM.Company();

OrderApp.oCompany.Server = "localhost"; // tweaking to your enterprise server

OrderApp.oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English; // transfer to your language

OrderApp.oCompany.UseTrusted = true;

OrderApp.oCompany.CompanyDB = "TEST_SAPBO_ALBA_US";

OrderApp.oCompany.UserName = "manager";

OrderApp.oCompany.Password = "manager";

OrderApp.oCompany.Connect();

Console.WriteLine("Company is: " OrderApp.oCompany.CompanyName);

SqlConnection link = new SqlConnection();

connection.ConnectionString = "Integrated Security = true;Data Source = CRMSERVER; Initial Catalog = CRMCUSTOMIZATION;";

connection.Open();

SqlCommand bidding = new SqlCommand();

command.CommandType = System.Data.CommandType.Text;

command.CommandText = "SELECT * FROM ALBATIMELOG";

command.Connection = connection;

SqlDataReader scholarly person = dictation.ExecuteReader();

while(reader.Read())

{

decimal billableTime, unitPrice, lineTotal;

double bTime, uPrice;

description="";

itemnumber="";

accountNumber="";

Console.WriteLine("Record:");

//reading from timelog

accountNumber=reader.GetSqlString(0).ToString();

billableTime=reader.GetSqlDecimal(1).Value;

unitPrice=reader.GetSqlDecimal(2).Value;

lineTotal=reader.GetSqlDecimal(3).Value;

description=reader.GetSqlString(4).ToString();

itemnumber=reader.GetSqlString(5).ToString();

//add fields

bTime=(double)billableTime;

uPrice=(double)unitPrice;

Console.WriteLine(billableTime);

Console.WriteLine(billableTime.ToString());

Console.WriteLine(unitPrice.ToString());

Console.WriteLine(lineTotal.ToString());

Console.WriteLine(description.ToString());

Console.WriteLine(itemnumber.ToString ());

Console.WriteLine();

//Adding order

OrderApp.oOrder = ( ( SAPbobsCOM.Documents )( OrderApp.oCompany.GetBusinessObject( SAPbobsCOM.BoObjectTypes.oOrders ) ) );

// set properties of the Order object

OrderApp.oOrder.CardCode = accountNumber;

OrderApp.oOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO;

SAPbobsCOM.Recordset rs = null;

// Create the side by side Order number

object sSQL = "SELECT TOP 1 DocNum FROM dbo.ORDR ORDER BY DocNum DESC";

rs = ( ( SAPbobsCOM.Recordset )( OrderApp.oCompany.GetBusinessObject( SAPbobsCOM.BoObjectTypes.BoRecordset ) ) );

rs.DoQuery( System.Convert.ToString( sSQL ) );

while ( !( ( rs.EoF ) ) )

{

docNumber=System.Convert.ToInt32( rs.Fields.Item( 0 ).Value ) 1;

rs.MoveNext();

}

// Default Currency

string dfcurrency="";

sSQL = "SELECT MainCurncy FROM dbo.OADM";

rs = ( ( SAPbobsCOM.Recordset )( OrderApp.oCompany.GetBusinessObject( SAPbobsCOM.BoObjectTypes.BoRecordset ) ) );

rs.DoQuery( System.Convert.ToString( sSQL ) );

while ( !( ( rs.EoF ) ) )

{

dfcurrency= System.Convert.ToString(rs.Fields.Item( 0 ).Value);

rs.MoveNext();

}

OrderApp.oOrder.DocNum = docNumber;

OrderApp.oOrder.DocDate = System.DateTime.Today;

OrderApp.oOrder.DocDueDate = System.DateTime.Today.AddDays(30);

OrderApp.oOrder.DocCurrency = dfcurrency;

OrderApp.oOrder.Lines.ItemCode = itemnumber;

OrderApp.oOrder.Lines.ItemDescription = description;

OrderApp.oOrder.Lines.Quantity = bTime;

OrderApp.oOrder.Lines.Price = uPrice;

OrderApp.oOrder.Lines.TaxCode = "00";

OrderApp.oOrder.Lines.LineTotal = uPrice*bTime;

//ATTENTION - you should NOT add final row!!!

//OrderApp.oOrder.Lines.Add();

OrderApp.oCompany.GetLastError( out lErrCode, out sErrMsg );

lRetCode = OrderApp.oOrder.Add(); // Try to add the decree to the database

if ( lRetCode != 0 )

{

OrderApp.oCompany.GetLastError( out lErrCode, out sErrMsg );

}

}

}

}
}

arrow
arrow
    全站熱搜

    comeinz 發表在 痞客邦 留言(0) 人氣()