cancel
Showing results for 
Search instead for 
Did you mean: 

CC07 - Change number-> How to get node value

Former Member
0 Kudos

Hi.
Im back...

Can someone help me here again?
Im doing some macros for seeking part numbers in sap database and examine they if they are in "collision" for change. When you want change part number step by step manufacturing recipe, you have to put part number in change (so the PN musnt be in other change, therefore collision) and make report. change is for everyone, who work with PN, report is for us... maybe you know all of this...
Now change and report are bonded via document flow. ... what I need. I have change number and need some macro for fast search for report.
Im using trsction cc07 - insert change number - list shows. I can expand nodes - twice do it and there is my report. When I click on it and do ctrl+ c it works - I can paste it in excel and work with it. With macro it doesnt work. When I end the macro with sendkeys ("^c") and then manualy paste in excel, it paste the sap script.

So I think of another route>


session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "cc07"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtG_CHG_NR-LOW").text = "500001684513"
session.findById("wnd[0]/usr/ctxtG_CHG_NR-LOW").caretPosition = 12
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").hierarchyHeaderWidth = 116
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          1"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          2"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectNode "          4"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").doubleClickNode "          4"

So Now I just need some like this:

Sheet1.Range("A1").Value = session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectedNode.Value/Text/Line/.....

If I use:
Sheet1.Range("J41").Value = session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectedNode
Then in A1 will be "4".... its the node number, now I need the value....

Do someone know the end code?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

script_man
Active Contributor
0 Kudos

Hi Miroslav,

unfortunately I have no access to the transaction CC07. But perhaps you will find the required help at the links below. I was able to do much in any case. Thanks again to the authors !

http://www.advancedqtp.com/old_forums/viewtopic.php?t=3502&p=13168

http://pic.dhe.ibm.com/infocenter/rfthelp/v8r0m0/index.jsp?topic=%2Fcom.rational.test.ft.api.help%2F...

Regards,

ScriptMan

Former Member
0 Kudos

Hello.

Thanks for your reply.

Its quite difficult to understand the code for me. Its complicated. But the second link you posted might be helpful.

The selected node will be always the same. In fact all the script will be always the same. In the IBM link I found somethink like getNodeTextByKey and Path, getItemText, getFocusedNodeKey. Maybe there is some combination of those parameters with which I can copy the one line of the node. Unfortunatelly I cannot use them. I think somethink like this:

. ..
....

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectNode "          4"

SAP knows, what I need, so just tell it to give me given node text...Its so frustrating.

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").getFocusedNodeKey - now SAP knows the key of the node then:

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").getNodeTextByKey..

Is it possible? - I dont know how to use parameters of given functions.

Or other way for me - If you have access to trsctn CC02 or 03 - theres document flow. Here it will be very simple. But I cannot overcome one screen - its like relations in MS Access.  2i - image hosting, image upload, pictures upload, bbcode - I need doubleclick on Quality Notification, next step I know what to do. But when I record Script:

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "cc02"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/tbar[1]/btn[45]").press

session.findById("wnd[0]/usr/shell[1]").sendData "CDBCL\&\Cn\&\C1\&\Cs\&\Cd"

'Its the click on QN

session.findById("wnd[0]").sendVKey 2

session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB02/ssubSUB_GROUP_10:SAPLIQS0:7235/subCUSTOM_SCREEN:SAPLIQS0:7212/subSUBSCREEN_2:SAPLIQS0:7715/cntlTEXT/shellcont/shell").setSelectionIndexes 0,0

Excel stops on the bold line with cannot be found by id.

Thanks everyone for advices.

script_man
Active Contributor
0 Kudos

Hi Miroslav,

You could try the following:

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "cc07"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtG_CHG_NR-LOW").text = "500001684513"

session.findById("wnd[0]/usr/ctxtG_CHG_NR-LOW").caretPosition = 12

session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").hierarchyHeaderWidth = 116

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          2"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectNode "          4"

myText = session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").getNodeTextByPath ("1\1\2")

msgbox myText

Regards,

ScriptMan

Former Member
0 Kudos

So NOW we getting somewhere...

It will put the change number in msgbox. Whats the hierarchy in the tree?. I trying some combinations of 1/2/4, 1/1/4... it shows change number or nothing.

When I expand all the nodes like this:

2i - image hosting, image upload, pictures upload, bbcode

Code is:

session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").hierarchyHeaderWidth = 116

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          2"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          4"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").expandNode "          5"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").topNode = "          1"

session.findById("wnd[0]/shellcont").dockerPixelSize = 443

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").hierarchyHeaderWidth = 250

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectNode "          6"

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").doubleClickNode "          6"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").unselectNode "          6"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").selectNode "          5"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").doubleClickNode "          5"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").unselectNode "          5"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").selectNode "          4"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").doubleClickNode "          4"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").unselectNode "          4"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").selectNode "          2"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").doubleClickNode "          2"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").unselectNode "          2"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").selectNode "          1"

session.findById("wnd[0]/shellcont[0]/shell/shellcont[1]/shell[1]").doubleClickNode "          1"

I expanded all the nodes, then clicking double on each from bottom. Iwould expect that last node would be like: 1/6 but obviously it isnt. Moreover All nodes have key 1 so I cannot find NodePathbykey. I feel that there is just smal step to be completed. Damn I dont understand the parameters for using the IBM functions like getNodeKeyByKey....Trying

Thanks for now.

Former Member
0 Kudos

Got it-

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").getNodeTextByPath ("1\1\1")

How simple...

Thanks a lot Sir Scriptman

Answers (0)