on 06-30-2008 7:58 AM
Dear Sap Guru's
I have a Problem that i have created a PLD and i have exported there data to Excel sheet , now i want to Transfer this Excel data to UDT.. So how will i do it...
Please give some solution immidiately
Hi. This code, after a little alteration, can work.
A well notice is: before you pick up values in the Collection, and later, with the cycle, do insert.
Best Regards
Sierdna S
P.S. Use with try catch.
Private Sub XlsReader()
Dim sConnStr As String = "Provider= Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sXlsFile & ";" & "Extended Properties=Excel 8.0;"
Dim oConnection As New OleDbConnection(sConnStr)
oConn.Open()
' Rename Sheet1 to name of your sheet in the Excel workbook
Dim sSql As String = "SELECT * FROM [Sheet1$] ORDER BY 1"
Dim oCmdP As New OleDbCommand(sSql, oConnection)
oCmd.CommandType = CommandType.Text
Dim oDR As OleDbDataReader
oDR = oCmdP.ExecuteReader(CommandBehavior.CloseConnection)
While oDRP.Read
Dim sb As StringBuilder ' Costruct your insert statment with StringBuilder
sb.Append(" INSERT INTO [tabname] (col1, col2, ...) VALUES (")
' Use for every data type various functions to read value
sb.Append(oDR.GetDouble(0)) ' for double
sb.Append(",'" & oDR.GetString(1)) ' for string
... other columns
sb.Append("')")
' Call your insert function ... it nice to use transaction.
Call DoInsert(sb.ToString)
End While
'
oDR.Close()
oDR = Nothing
End Sub
Private Sub DoInsert(sSql As String)
' search on SDK forum some like "TRANSACTION"... for insert
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U can migrate the data thru data transfer workbench.
UDT also display in Business Object List. Select UDT from that list and attach the excel file
Regards
Mathi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.