Home > other >  VBA read table data in SAP system, how to get the table ID?
VBA read table data in SAP system, how to get the table ID?

Time:11-18


I operated by VBA and read SAP data, when open the SAP a page, the page displayed on the table, there is I need to read the data table, but can't see the table ID,

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
The Session. FindById (" WND [0] "). Maximize
Session. FindById (" WND [0]/tbar [0]/okcd "). The Text="SE23
"Session. FindById (" WND [0] "). The sendVKey 0
Session. FindById (" WND [0]/usr/tabsTAB300/tabpF01/ssubINCLUDE300: SAPMM61R: 0301/ctxtRM61R - MATNR "). The Text="45243"
Session. FindById (" WND [0]/usr/tabsTAB300/tabpF01/ssubINCLUDE300: SAPMM61R: 0301/ctxtRM61R - BERID "). The Text="4332"
Session. FindById (" WND [0]/usr/tabsTAB300/tabpF01/ssubINCLUDE300: SAPMM61R: 0301/ctxtRM61R - BERID "). The SetFocus
Session. FindById (" WND [0]/usr/tabsTAB300/tabpF01/ssubINCLUDE300: SAPMM61R: 0301/ctxtRM61R - BERID "). The caretPosition=4
Session. FindById (" WND [0] "). The sendVKey 0
The Session. FindById (" WND [0]/usr/btnBUTTON_EZ_PS "). Press
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W "). Select 'run to this step is very good, the target page has opened,

Set the Table=Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760 ") 'Table id path is wrong, here to buy method to read data

Rows=Table. The RowCount () - 1
For k=0 To Rows
XlSheetreport. Cells (I, k + 3)=Table. GetCellValue (k, 2)
Next k

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The table id is wrong, WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760
In SAP, can examine the information of the Program name: SAPMM61R and Table name: MDSU

If use SAP record the function of the script, in this table (grid) inside the mouse clicking, recorded information is as follows,

Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 4] "). The setFocus
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 4] "). The caretPosition=11
Session. FindById (" WND [0] "). The sendVKey 2
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 6] "). The setFocus
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 6] "). The caretPosition=12
Session. FindById (" WND [0] "). The sendVKey 2
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 7] "). The setFocus
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 7] "). The caretPosition=12
Session. FindById (" WND [0] "). The sendVKey 2
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS "). The columns. The elementAt (2) width=12
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS "). The columns. The elementAt (3). The width=12
Session. FindById (" WND [0]/usr/subINCLUDE1XX: SAPMM61R: 0770/tabsPS_TAB/tabpPS_W/ssubPS_SUBSCR: SAPMM61R: 0760/tblSAPMM61RTC_PS/txtMDSU - MNG02 [2, 7] "). The caretPosition=14
Session. FindById (" WND [0] "). The sendVKey 2

From the above information, to analysis the table ID?
The Session. FindById ("?" )

Thank you very much!

CodePudding user response:

Vba is how to read the data in SAP system, it makes me wonder

CodePudding user response:

The original poster to find solutions, I also suffer from this, please inform
  • Related