SAPbobsCOM.GeneralService oGeneralService = null;
SAPbobsCOM.GeneralData oGeneralData = null;
SAPbobsCOM.GeneralDataParams oGeneralParams = null;
SAPbobsCOM.CompanyService sCmp = null;
SAPbobsCOM.GeneralData oChild = null;
SAPbobsCOM.GeneralDataCollection oChildren = null;
sCmp = Main.Mahi_Company.GetCompanyService();
oRs = ((SAPbobsCOM.Recordset)(Main.Mahi_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
string selquery = "select " + '"' + "DocEntry" + '"' + ",'1' as " + '"' + "LineId" + '"' + ",'0' as " + '"' + "VisOrder" + '"' + ",'SQ_AC' as " + '"' + "Object" + '"' + ",null as " + '"' + "LogInst" + '"' + ",'Y' as " + '"' + "U_Checked" + '"' + "," + '"' + "U_DocNum" + '"' + "," + '"' + "U_SQSeries" + '"' + "," + '"' + "U_SQLineId" + '"' + "," + '"' + "U_iCode" + '"' + "," + '"' + "U_iName" + '"' + "," + '"' + "U_LineId" + '"' + " from " + '"' + "@SQAC_H" + '"';
oRs.DoQuery(selquery);
try
{
oGeneralService = sCmp.GetGeneralService("Mahi_H"); // Main UDO Name
for (int i = 1; i <= 6; i++)
{
// Get UDO record
oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
oGeneralParams.SetProperty("DocEntry", oRs.Fields.Item("DocEntry").Value); //Primary Key
oGeneralData = oGeneralService.GetByParams(oGeneralParams);
// Add lines on UDO Child Table
oChildren = oGeneralData.Child("Mahi_D1"); // Child Table Of Main UDO
// Create data for rows in the child table
oChild = oChildren.Add(); // Adds Blank Line in Child Table
oChild.SetProperty("U_SQLineId", oRs.Fields.Item("U_SQLineId").Value);
//oChild.SetProperty("VisOrder", oRs.Fields.Item("VisOrder").Value);
oChild.SetProperty("U_Checked", oRs.Fields.Item("U_Checked").Value);
oChild.SetProperty("U_DocNum", oRs.Fields.Item("U_DocNum").Value);
oChild.SetProperty("U_SQSeries", oRs.Fields.Item("U_SQSeries").Value);
oChild.SetProperty("U_SQLineId", oRs.Fields.Item("U_SQLineId").Value);
oChild.SetProperty("U_iCode", oRs.Fields.Item("U_iCode").Value);
oChild.SetProperty("U_iName", oRs.Fields.Item("U_iName").Value);
//Update the UDO Record
oGeneralService.Update(oGeneralData); // If Child Table doesnot have any record it will create else update the existing one
oRs.MoveNext();
}
}
catch (Exception ex)
{
Main.Mahi_Application.MessageBox(ex.Message, 1, "OK", null, null);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |