cancel
Showing results for 
Search instead for 
Did you mean: 

MSEXCEL TO UDT TRANSFERING DATA(It's URGENT)

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Can you plijj give me code or exact procedure