Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 2169

SAP Script recording and play back error - unterminated string constant

$
0
0

Hello All ,

 

I am trying to upload source list records with ME01.

 

I know I can utilize LSMW to do so....but I am trying with SAP script and recording.

 

Below is the VB code for the same, and getting error while execution such as "unterminated string constant"

 

I am not able to rectify the error, I checked the code if I missed any quotation mark in the string but not the case.

 

Kindly suggest if you have faced similar issues before....

 

I reffered the document created by Mariano Cabalen

-----------------------------------------------------------------------------------------------------------------------------------------------

If Not IsObject(application) Then

   Set SapGuiAuto  = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

   Set connection = application.Children(0)

End If

If Not IsObject(session) Then

   Set session    = connection.Children(0)

End If

If IsObject(WScript) Then

   WScript.ConnectObject session,     "on"

   WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

REM ADDED BY EXCEL *************************************

Dim objExcel

Dim objSheet, intRow, i

Set objExcel = GetObject(,"Excel.Application")

Set objSheet = objExcel.ActiveWorkbook.ActiveSheet

For i = 2 to objSheet.UsedRange.Rows.Count

COL1 = Trim(CStr(objSheet.Cells(i, 1).Value)) 'Column1

COL2 = Trim(CStr(objSheet.Cells(i, 2).Value)) 'Column2

COL3 = Trim(CStr(objSheet.Cells(i, 3).Value)) 'Column3

COL4 = Trim(CStr(objSheet.Cells(i, 4).Value)) 'Column4

COL5 = Trim(CStr(objSheet.Cells(i, 5).Value)) 'Column5

COL6 = Trim(CStr(objSheet.Cells(i, 6).Value)) 'Column6

COL7 = Trim(CStr(objSheet.Cells(i, 7).Value)) 'Column7

REM ADDED BY EXCEL *************************************

session.findById("wnd[0]/tbar[0]/okcd").text = "/nME01"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtEORD-MATNR").text = COL1

session.findById("wnd[0]/usr/ctxtEORD-WERKS").text = COL2

session.findById("wnd[0]/usr/ctxtEORD-WERKS").setFocus

session.findById("wnd[0]/usr/ctxtEORD-WERKS").caretPosition = 4

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-VDATU[0,0]").text = COL3

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-BDATU[1,0]").text = COL4

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-LIFNR[2,0]").text = COL5

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-EKORG[3,0]").text = COL6

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-AUTET[10,0]").text = COL7

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-AUTET[10,0]").setFocus

session.findById("wnd[0]/usr/tblSAPLMEORTC_0205/ctxtEORD-AUTET[10,0]").caretPosition = 1

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/tbar[0]/btn[11]").press

REM FINALIZATION CONTROL CHECK ************************

aux=col1 & " " & col2 & " " & col3 & " " & col4 & " " & col5 & " " & col6 & " " & col7

CreateObject("WScript.Shell").run("cmd /c @echo %date% %time% " & aux & " >> C:\SCRIPT

\PlOrCreationLog.txt")

next

msgbox "Process Completed"

REM FINALIZATION CONTROL CHECK ************************


Viewing all articles
Browse latest Browse all 2169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>