Skip to Content
0

SAP Scripting Issue with "control could not be found by id"

Nov 14, 2016 at 06:22 AM

157

avatar image
Former Member

Hello guys,

I have an issue with SAP Scripting. From time to time, the ids of my controls switch, even I query the same thing, causing my script to crash.

For example:

I have a query created in SQVI, for which I didn't modify anything in the structure, and the same field which last week had:

session.FindById("wnd[0]/usr/ctxtSP$00016-LOW").Text = "6"

now it is:

session.findById("wnd[0]/usr/ctxtSP$00007-LOW").text = "6"

Why this switch of behaviour in allocating the id of a control? In this manner, all my scripts will fail from time to time. Is there a method to prevent this?

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Stefan Schnell
Nov 16, 2016 at 08:23 AM
0

Hello John,

I assume this is not a problem of SAP GUI Scripting.

In a normal case SAP Query generates a report with select options e.g. SP$00001, SP$00002 etc. And if the report isn't change or regenerated your script should work.

To detect a changing of a query report use TAC SE16 with table REPOSRC. Type in PROGNAME *SYSTQV*[Your Query Name]* e.g. *SYSTQV*Z_TEST* for query Z_TEST. Now you can see SDATE and STIME as well as IDATE and ITIME for the generation of the selection screen as well as UDAT and UTIME for the last changing. Please observe these timestamps.

Let us know your results.

Cheers
Stefan

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 18, 2016 at 07:04 AM
0

Hi Stefan,

Thanks for taking your time to reply.

It's not a SAP GUI Scripting error, since the script worked flawlessly for 2 weeks, and only on Monday started to fail.

I've compared also SDATE,STIME with IDATE,ITIME vs UDAT,UTIME and they are all identical, in the day of the creation of the query (24.10.2016).

Do you have any other ideas?

Thanks,

John

Share
10 |10000 characters needed characters left characters exceeded