Skip to Content
0

SAP is not working (SAP Hanging Problem)

Dec 01, 2016 at 07:24 PM

98

avatar image
Former Member

hi,

friend actually i want to import data from excel sheet in to UDO Form. I write code properly and also working is done but when data is import in UDO form SAP get hang but i am not using any Form.Freez() function.please give me a solution as soon as possible.

My Code is :-

oForm = clsAddOn.KIRAN_Application.Forms.GetForm("QC_OIMD", pVal.FormTypeCount);
string DocEntryNo = oForm.Items.Item("edtCode").Specific.Value;
SAPbouiCOM.ProgressBar oPB = clsAddOn.KIRAN_Application.StatusBar.CreateProgressBar("Loading data .............", 40, false);
string ExcelPath = oForm.Items.Item("edtPath").Specific.Value;
///// Microsoft Excel sheet Object
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(ExcelPath.Trim(), 0, true, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Microsoft.Office.Interop.Excel.Worksheet excelWorksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelWorkbook.Worksheets[1];
Microsoft.Office.Interop.Excel.Range excelCell = null;
int CellCounter = 2;
string Result = "";
SAPbouiCOM.ComboBox CmbFrmName = oForm.Items.Item("cmbFrmNm").Specific;
string FormName = CmbFrmName.Selected.Description;

// Get A Cell Data
excelCell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.get_Range("A" + CellCounter.ToString(), "A" + CellCounter.ToString());
string str1 = excelCell.Value.ToString();
string str2 = excelCell.Value2.ToString();
if (excelCell.Value2.ToString() != "")
{
Result = excelCell.Value2.ToString();
}
string sourceFile = oForm.Items.Item("edtPath").Specific.Value;
string worksheetName = oForm.Items.Item("cmbSheet").Specific.Value;

System.Data.DataTable dt = new System.Data.DataTable();
string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + sourceFile + ";Extended Properties=\"Excel 12.0 Xml;HDR=No;IMEX=1\"";
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(strConn);
conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [" + worksheetName.Trim() + "$]", conn);
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
string Code = "", Name = "", ParCode = "", ParName = "", Type = "", Uom = "";
while (Result != null || Result.Trim() != "")
{

}

conn.Close();
oForm = clsAddOn.KIRAN_Application.Forms.ActiveForm;
oForm.Items.Item("1").Click(SAPbouiCOM.BoCellClickType.ct_Regular);
clsAddOn.KIRAN_Application.StatusBar.SetText("Record Imported Successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
BubbleEvent = true;
return;

here i open connection & after data import close connection but SAP is total hang i have one solution stop the Add-on or re login.

please rly me fast !!!!

waiting for better solution.

10 |10000 characters needed characters left characters exceeded
Former Member

here i can use 64 bit office & 64 bit SAP client.i have only solution on how to stop the background process which is run after data import please rly me fast.

Thanks !!!

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers