cancel
Showing results for 
Search instead for 
Did you mean: 

Fill autonumber

Former Member
0 Kudos

hi you!

I want to you help me!

1:when I want to insert 1 new row,it fill auto number to column #.(1.2.3u2026).

2:when I insert 1 new child ,I want to get value EmpID of Employee Master Data form.this is help me insert empID from Employee Master Data table to child table.

3:As ,I view child form ,how inactive form Employee Master Data?

<a href="http://imageshack.us">[IMG]http://img407.imageshack.us/img407/5646/hact0.png[/IMG]</a>

<a href="http://g.imageshack.us/img407/hact0.png/1/">[IMG]http://img407.imageshack.us/img407/hact0.png/1/w930.png[/IMG]</a>

Thank you,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi , Try....

You can write this code on Employee Master Data Class---

if (pVal.ItemUID == "ItemId" )

{

oEditText1 = (SAPbouiCOM.EditText)oFormMaster.Items.Item("33").Specific;

String EmpNO = oEditText1.String.ToString().Trim();

ChidEmployees objChidEmployees = new ChidEmployees();

objChidEmployees.GetData( EmpNO, oParrentForm);

}

You can write this code on List Chid's Employees Class---Name ChidEmployees

public void GetData(string EmpID, SAPbouiCOM.Form PForm)

{

((SAPbouiCOM.EditText)PForm.Items.Item("3").Specific).Value = EmpID.Trim();

}

******************************************

Fill auto number 2 column

public int GetMaxCode(string tblname, string Fldname, SAPbobsCOM.Company company)

{

SAPbobsCOM.Recordset RS = null; //For SAP Recordset

string MaxString = null;

RS = (SAPbobsCOM.Recordset)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

string SqlStr = null;

SqlStr = "SELECT MAX(" + "Convert(int," + Fldname + ")) FROM [" + tblname + "]";

RS.DoQuery(SqlStr);

///oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners

if (!RS.EoF)

{

MaxString = (RS.Fields.Item(0).Value).ToString();

if (MaxString == "")

{

MaxString = "0";

}

}

else

{

MaxString = "0";

}

return Convert.ToInt32(MaxString);

}

string Code=1;

intCode = GetMaxCode(oDBDataSource.TableName, "Code", Zenith_SBOAddOn.SBOCompany) + 1;

Code++;

Answers (0)