on 02-06-2020 11:01 PM
I have been working on a Macro in Excel that connects to SAP and so far I've been able to manage (NOT super familiar with coding at all). My goal and strategy so far has been the following:
I am trying to automate a fairly standard task that we carry out very often in SAP by pulling some info from Excel. In order to get the SAP script, I recorded a basic example of this task in SAP and have been using that script to try and complete what I need to do.
My latest roadblock is the following: I need to be able to fill in the short text for certain tasks (in "Item Tasks" of QM02 transaction) that are entered in by other people. So, I tried using the following code from my recording:
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03").Select
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-MATXT[4,8]").Text = "See tab"
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-MATXT[4,9]").Text = "See tab"
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-MATXT[4,10]").Text = "See tab"
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-MATXT[4,11]").SetFocus
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB03/ssubSUB_GROUP_20:SAPLIQS0:7125/tblSAPLIQS0MASSNAH_VIEWER2/txtVIQMSM-MATXT[4,11]").caretPosition = 0
session.findById("wnd[0]").sendVKey 0
Of course, I realized when I tried to run this that it will input the "See tab" text into the specific rows in the short text column from my recording, but the tasks that I need this short text for will not always be in the same row, and may not be entered in at all. So I am hoping there is a way to possibly have the code recognize whether the task is there or not, and then fill in the short text in the appropriate place, I'm guessing with some if-then statement, but again I am NOT confident in coding at all, let alone SAP coding, so I would not even know where to begin.
Any guidance would be really appreciated!!!
Thank you
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.