Obtain details to a given personal number English

From Theobald Software

Jump to: navigation, search

This code shows how to get detail data to a given personal number.

Enlarge


C#

// Connect to SAP
R3Connection con = new R3Connection("Hamlet",11,"XXX","XXX","EN","800");
con.UseGui = true;
con.Open();
 
// Create function
RFCFunction func1 = con.CreateFunction("BAPI_EMPLOYEE_GETDATA");
 
// set parameters
func1.Exports["EMPLOYEE_ID"].ParamValue = this.textBox1.Text;
func1.Exports["DATE"].ParamValue = ERPConnect.ConversionUtils.NetDate2SAPDate(System.DateTime.Now);
 
// execute function module
con.SetAbabDebug(true);
func1.Execute();
 
// Is there a return message?
if (func1.Imports["RETURN"].ToStructure()["MESSAGE"].ToString().Trim() != "")
{
	MessageBox.Show(func1.Imports["RETURN"].ToStructure()["MESSAGE"].ToString());
	return;
}
 
// process tables, but only, if they are filled with at least one row
if (func1.Tables["ORG_ASSIGNMENT"].RowCount > 0)
{
	this.textBox2.Text = func1.Tables["ORG_ASSIGNMENT"].Rows[0,"NAME"].ToString();
	this.textBox3.Text = func1.Tables["ORG_ASSIGNMENT"].Rows[0,"POSTXT"].ToString();
	this.textBox4.Text = func1.Tables["ORG_ASSIGNMENT"].Rows[0,"ORGTXT"].ToString();
	this.textBox7.Text = func1.Tables["ORG_ASSIGNMENT"].Rows[0,"COSTCENTER"].ToString();
}
 
// Email
if (func1.Tables["COMMUNICATION"].RowCount > 0)
{
	this.textBox5.Text = func1.Tables["COMMUNICATION"].Rows[0,"USRID_LONG"].ToString();  
}
 
// Phone Number
if (func1.Tables["INTERNAL_CONTROL"].RowCount > 0)
{
	this.textBox6.Text = func1.Tables["INTERNAL_CONTROL"].Rows[0,"PHONENO1"].ToString();
}
DeutschEnglish
Personal tools
Navigation
XtractQL Provider
Xtract RS