脚本MB51

2020-08-18 00:38发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我无法在MB51屏幕上创建脚本,...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我无法在MB51屏幕上创建脚本,代码看起来像这样:

 Sub gerar_contagem()






 设置会话= GetObject(" SAPGUI")。GetScriptingEngine.Children(0).Children(0)
 session.findById(" wnd [0]")。maximize
 session.findById(" wnd [0]/tbar [0]/okcd")。Text ="/img/NMB51"
 session.findById(" wnd [0]")。sendVKey 0
 session.findById(" wnd [0]/tbar [1]/btn [17]")。按
 session.findById(" wnd [1]/usr/txtENAME-LOW")。Text =" w890230"
 session.findById(" wnd [1]/usr/txtENAME-LOW")。SetFocus
 session.findById(" wnd [1]/usr/txtENAME-LOW")。caretPosition = 7
 session.findById(" wnd [1]/tbar [0]/btn [8]")。按
 session.findById(" wnd [1]/usr/cntlALV_CONTAINER_1/shellcont/shell")。currentCellColumn =" TEXT"
 session.findById(" wnd [1]/usr/cntlALV_CONTAINER_1/shellcont/shell")。selectedRows =" 0"
 session.findById(" wnd [1]/usr/cntlALV_CONTAINER_1/shellcont/shell")。doubleClickCurrentCell
 session.findById(" wnd [0]/usr/ctxtBUDAT-LOW")。SetFocus
 session.findById(" wnd [0]/usr/ctxtBUDAT-LOW")。caretPosition = 0
 session.findById(" wnd [0]")。sendVKey 4


 昏暗的objExcel
 昏暗的objSheet,intRow,我
 设置objExcel = GetObject(," Excel.Application")
 设置objSheet = objExcel.ActiveWorkbook.ActiveSheet(1)


 对于i = 2到objSheet.UsedRange.Rows.Count
 G8 = Trim(CStr(objSheet.Cells(i,7).Value))‘G8
 I8 = Trim(CStr(objSheet.Cells(i,7).Value))‘I8


 session.findById(" wnd [1]/usr/cntlCONTAINER/shellcont/shell")。focusDate = G8
 session.findById(" wnd [1]/tbar [0]/btn [0]")。按
 session.findById(" wnd [0]/usr/ctxtBUDAT-HIGH")。SetFocus
 session.findById(" wnd [0]/usr/ctxtBUDAT-HIGH")。caretPosition = 0
 session.findById(" wnd [0]")。sendVKey 4
 session.findById(" wnd [1]/usr/cntlCONTAINER/shellcont/shell")。focusDate = I8
 session.findById(" wnd [1]/tbar [0]/btn [0]")。按
 session.findById(" wnd [0]/tbar [1]/btn [8]")。按
 session.findById(" wnd [0]/tbar [1]/btn [48]")。按
 session.findById(" wnd [0]/mbar/menu [3]/menu [2]/menu [1]")。选择
 session.findById(" wnd [1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")。setCurrentCell 27," TEXT"
 session.findById(" wnd [1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")。firstVisibleRow = 18
 session.findById(" wnd [1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")。selectedRows =" 27"
 session.findById(" wnd [1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")。clickCurrentCell
 session.findById(" wnd [0]/mbar/menu [0]/menu [1]/menu [1]")。选择
 session.findById(" wnd [1]/tbar [0]/btn [11]")。按




 结束子
 

问题在于这些行的目的是将电子表格的单元格G8和I8中的信息插入屏幕MB51的日期字段中::

昏暗objExcel
 昏暗的objSheet,intRow,我
 设置objExcel = GetObject(," Excel.Application")
 设置objSheet = objExcel.ActiveWorkbook.ActiveSheet(1)


 对于i = 2到objSheet.UsedRange.Rows.Count
 G8 = Trim(CStr(objSheet.Cells(i,7).Value))‘G8
 I8 = Trim(CStr(objSheet.Cells(i,7).Value))‘I8
 

有人可以帮我解决这个问题吗?