HI @DenyChristi
Please excuse late response. The solution here is pretty simple and very well-known. I have covered this issue of “Purchase order transactions” such as ME21n, ME22n, ME23n in my SAP training. See the link below.
The challenge is: when you are opening&closing Header, Item Overview and Items section. The IDs of elements are changing. When you open the transaction next time, the ID is different. It causes all troubles for automation.
The solution is straight forward. Use Select Item Activity, and in selector replace the part, which is dynamic with the wildcard, see green box. All other numbers are stable and not changing.
Here a comparison, between different runs:
Learn more here:
Completely new SAP Academy course , to help you to learn the automation techniques and the best practices for SAP WinGUI automation
Mark as solution if it works for you
Best regards, Lev