<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP GUI Scripting select active row in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749069#M212635</link>
    <description>&lt;P&gt;glad you got it working the way you wanted. Still, I tested Stefans suggestion in CS02&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;For i = 0 To session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").VisibleRowCount - 1
  If session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-POSNR[0," &amp;amp; CStr(i) &amp;amp; "]").text = test Then
    session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").GetAbsoluteRow(i).Selected = True
  End If
Next&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;which works as expected. Only additional logic would be if you don't find it within the visible rows &amp;amp; have to page down. &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Obviously replace txtRC29P-POSNR with the cell of your choice.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 07:53:42 GMT</pubDate>
    <dc:creator>daniel_mccollum</dc:creator>
    <dc:date>2018-09-18T07:53:42Z</dc:date>
    <item>
      <title>SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaq-p/749064</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I'm trying to automate some SAP actions with Excel.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I Recorded some Script from SAP an most is working just fine, I only have a problem selecting the active row in CS02 after positioning the right RowID.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Recording results in:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").getAbsoluteRow(39).selected = true&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;But I can't select a row with the AbsoluteRow number since I don't know that number.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Any ideas how to select the entire line so it can be deleted?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 14:04:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaq-p/749064</guid>
      <dc:creator>wkn</dc:creator>
      <dc:date>2018-09-07T14:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749065#M212631</link>
      <description>&lt;P&gt;Hello Wim,&lt;/P&gt;
  &lt;P&gt;welcome in the SAP Community.&lt;/P&gt;
  &lt;P&gt;I am not sure that I understand your question correctly. I would to loop over the table control to get the correct entry via its description and select it.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;For i = 0 To session.findById("wnd[0]/usr/tblSAPMBIBSTC537").VisibleRowCount - 1
  If session.findById("wnd[0]/usr/tblSAPMBIBSTC537/txtLOOP410-TEXT[0," &amp;amp; CStr(i) &amp;amp; "]").Text = "Familie" Then
    session.findById("wnd[0]/usr/tblSAPMBIBSTC537").getAbsoluteRow(i).selected = true
  End If
Next
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/211782-guibibs.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;Let us know your results.&lt;/P&gt;
  &lt;P&gt;Cheers&lt;BR /&gt;Stefan&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 13:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749065#M212631</guid>
      <dc:creator>Stefan-Schnell</dc:creator>
      <dc:date>2018-09-10T13:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749066#M212632</link>
      <description>&lt;P&gt;Hi Stefan,&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Thank you for your help, but this isn't what I'm looking for.&lt;/P&gt;
  &lt;P&gt;CS02 is the Bill of Materials.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/211828-cs02.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I use the scripting to select the right "Pos." code and then I want to select the entire row.&lt;/P&gt;
  &lt;P&gt;Manually you can highlight (select) the entire row by clicking on the grey square in front of it. I want to do this so I can delete the line.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Any other thoughts?&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Wim&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 13:41:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749066#M212632</guid>
      <dc:creator>wkn</dc:creator>
      <dc:date>2018-09-11T13:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749067#M212633</link>
      <description>&lt;P&gt;I think Stefan has a reliable solution for your problem statement. &lt;/P&gt;
  &lt;P&gt; In your script, you have tblSAPLCSDITCMAT. Stefan has given a snippet referencing tblSAPMBIBSTC537&lt;/P&gt;
  &lt;P&gt; Based on the tests you want to perform, you would loop as Stefan has, &amp;amp; once you find the row that meets your test criteria, you could select absolute row i. &lt;/P&gt;
  &lt;P&gt;You simply need to map your test, to Stefan's pattern. &lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 00:26:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749067#M212633</guid>
      <dc:creator>daniel_mccollum</dc:creator>
      <dc:date>2018-09-18T00:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749068#M212634</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;I tried that but I didn't work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;However, in the meantime I tried some other possible tactics and finally got it to work as I wanted.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;objSess.FindById("wnd[0]/mbar/menu[1]/menu[10]").Select
            objSess.FindById("wnd[1]/usr/subPOS_SETP:SAPLCSDI:0710/txtRC29P-SELPO").Text = &amp;lt;searchValue&amp;gt;
            objSess.FindById("wnd[1]/tbar[0]/btn[0]").press
            numrRow = objSess.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").VerticalScrollbar.Position
            objSess.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").VerticalScrollbar.Position = numrRow + 1
            objSess.FindById("wnd[0]").sendVKey 9
            objSess.FindById("wnd[0]/tbar[1]/btn[14]").press
            objSess.FindById("wnd[0]").sendVKey 0
            objSess.FindById("wnd[1]/usr/btnSPOP-OPTION1").press&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;first 3 lines is positioning to the line I wanted to find.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;then get the Vertical scrollbar position.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;add 1 to that value (ie. scroll down one line so the line to be selected is just outside the visible window&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;then press F9 to select the line (for some reasons the line that get selected is the line which is outside the visible window, above the top visible line)&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;and then 3 lines to delete the selected line as I wanted to do.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Issue is solved with this solution.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Thanks to everybody who tried to help.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 05:55:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749068#M212634</guid>
      <dc:creator>wkn</dc:creator>
      <dc:date>2018-09-18T05:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749069#M212635</link>
      <description>&lt;P&gt;glad you got it working the way you wanted. Still, I tested Stefans suggestion in CS02&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;For i = 0 To session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").VisibleRowCount - 1
  If session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-POSNR[0," &amp;amp; CStr(i) &amp;amp; "]").text = test Then
    session.FindById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").GetAbsoluteRow(i).Selected = True
  End If
Next&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;which works as expected. Only additional logic would be if you don't find it within the visible rows &amp;amp; have to page down. &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Obviously replace txtRC29P-POSNR with the cell of your choice.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 07:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749069#M212635</guid>
      <dc:creator>daniel_mccollum</dc:creator>
      <dc:date>2018-09-18T07:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAP GUI Scripting select active row</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749070#M212636</link>
      <description>&lt;P&gt;Hi Stefan&lt;/P&gt;&lt;P&gt;I searched a long time how select an item in CS02.&lt;BR /&gt;The problem with 'getAbsoluteRow().selected = true' and 'VisibleRowCount' is that it does not work proprely and I had to use 'on error resume next'. Now I could find the row number after use menu 'edit\Position'.&lt;/P&gt;&lt;P&gt;You can find the position on field RC29P-ENTAC, example select pos. 305&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/tbar[0]/okcd").text = "/ncs02"&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtRC29N-MATNR").text = "material number"&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtRC29N-WERKS").text = "plant"&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtRC29N-STLAN").text = "1"&lt;BR /&gt;session.findById("wnd[0]/tbar[1]/btn[5]").press&lt;BR /&gt;session.findById("wnd[0]/mbar/menu[1]/menu[11]").select&lt;BR /&gt;session.findById("wnd[1]/usr/subPOS_SETP:SAPLCSDI:0710/txtRC29P-SELPO").text = "0305"&lt;BR /&gt;session.findById("wnd[1]/tbar[0]/btn[0]").press&lt;BR /&gt;Pos_nb = (session.findById("wnd[0]/usr/txtRC29P-ENTAC").text)&lt;BR /&gt;session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").getAbsoluteRow(Pos_nb - 1).selected = True&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Jean-Luc&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 14:26:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-gui-scripting-select-active-row/qaa-p/749070#M212636</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-04-17T14:26:57Z</dc:date>
    </item>
  </channel>
</rss>

