Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP SAPWindows Leading Zeros
#1
Solved: 11 Years, 4 Months ago
Using QTP 8.2 to record SAP Windows on WinXP SP2 for creation of testing data:

In creating scripts for SAP-MM, the Purchase Req is created and the number written to the DataTable. Same script then calls up the Purchase Req number from the DataTable to create a Purchase Order. Problem is, the script is writing leading zeros on the PReq number, which when read by the script as a node in the SAP TableTreeControl, is looking for Node 0010015866 instead of 10015866, creating a failure error. I have tried every kind of number formatting both inside the QTP DataTable AND outside QTP modifying the Default using Excel. How can I get QTP to not write/read the leading zeros?

Expert View Writing to DataTable:
Code:
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiStatusBar("StatusBar").Output CheckPoint("StatusBar")
0010015866 is written

Code:
Reading from DataTable into an SAP input field:
SAPGuiSession("Session").SAPGuiWindow("Purchase requisitions").SAPGuiEdit("Purchase requisition number").Set DataTable("Purch_Req_Num", dtGlobalSheet)
Reads 0010015866, SAP ignores the leading zeros, finds the correct PReq, creates it as the one item in the TableTree as 10015866

Selecting the Node:
Code:
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Order").SAPGuiTree("TableTreeControl").SelectNode DataTable("Purch_Req_Num", dtGlobalSheet)
Looks for 0010015866, cannot find it, Failure error.

(attachment: Keyword view, Working write, QTP error)
Thanks for looking/help. -Bodd


Attached Files Image(s)
           
Reply
#2
Solved: 11 Years, 4 Months ago
There are two ways I can think of...
1) Instead of using Output Value, try using GetROProperty.

2) Use the following :
' Before selecting the node,
Code:
sNum = DataTable("Purch_Req_Num", dtGlobalSheet)
sNumWithoutZero = Right(sNum, Len(sNum) - 0)
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Order").SAPGuiTree("TableTreeControl").SelectNode sNumWithoutZero

Let me know if it doesnt work out..
Reply
#3
Solved: 11 Years, 4 Months ago
Thanks Niranjan.
Neither method worked, so I added a column to the DataTable using the =ABS() formula. So now it outputs the Purchase Request number with the leading zeros, and then reads from the next column with the Absolute value of that number -zeros removed- to create the Purchase Order. -Bodd

UPDATE: I found that you can also Hide the output column in the Data Table using Excel, the scripts work fine and the user will then only see the numbers without leading zeros.
Reply
#4
Solved: 11 Years, 4 Months ago
Cool.
I am glad your problem is solved.
Reply
#5
Solved: 11 Years, 4 Months ago
Hi Guys,
I just joined this community.
I do working on QTP 9.2. on both SAP & .Net applications.

Just for your refernce use CInt(). This will solve your problem.


Regards
Raghu
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Enable Leading Zero Nana 5 9,454 06-07-2008, 04:39 AM
Last Post: niranjan

Forum Jump:


Users browsing this thread: 1 Guest(s)