cancel
Showing results for 
Search instead for 
Did you mean: 

sap personas scripting document flow and Nodes

Former Member
0 Kudos

Hi SAP personas team,

I have to capture multiple deliveries for a sales order . In SAP when i go to document flow i can see the nodes and once i expand nodes i can see the respective delivery numbers .

how do i script the nodes and capture the list of deliveries .

Kindly suggest .

Best regards,

pradeep.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you clemens .

clemens_gantert
Active Participant
0 Kudos

Hello Pradeep,

The document flow page of sales order is a GuiTree.
We can expand the node and get item text of the column required.

var o = session.findById("wnd[0]/usr/cntlTREE1/shellcont/shell/shellcont[1]/shell[1]");
o.expandNode(" 1");
o.expandNode(" 2");
o.clickLink(" 3", "C 3");
var _ITEMTEXT = o.getItemText(" 3", "C 3");

Use getSubNodes() to get all nodes and them loop through them:

var o = session.findById("wnd[0]/usr/cntlTREE1/shellcont/shell/shellcont[1]/shell[1]");
var subNode= o.getSubNodes(" 2");
var length = subNode.length;
for (i = 3; i < length; i++) {
var data = o.getItemText(" "+i, "C 3");
session.utils.log(data);
}

Best Regards,

Clemens

Former Member
0 Kudos

Hi Clemens ,

When i try to execute i am getting the following error .

UnidentifiedControl - There is no control with id 'wnd[0]/usr/cntlTREE1/shellcont/shell/shellcont[1]/shell[1]' in the current

there is a control.

wnd[0]/usr/cntlTREE1/shellcont/shell/shellcont[1]/shell[1]"

But when i tried to use this ,it does not work

Kindly suggest .

Best regards,

pradeep.

clemens_gantert
Active Participant
0 Kudos

Hello Pradeep,

my scripts are examples on how to deal with the control type GuiTree. It's not a ready-to-go script, but you have to adjust it to your specific needs.

Best Regards,

Clemens

former_member182659
Participant
0 Kudos

Hello Clemens,

In the request:

getItemText(String nodeKey, String itemName);

How to know what to put in the String itemName?

I try to play with your script.

I can now figure what to put in the Sting NodeKey, but for the Sting itemName, I'm stuck.

If I put :

getItemText("          "+i, "C          3");

I get the date, but how to get the document number?

What is C?

Thanks,

Emmanuel.

former_member182659
Participant
0 Kudos

Hello Clemens,

In the request:

getItemText(String nodeKey, String itemName);

How to know what to put in the String itemName?

I try to play with your script.

I can now figure what to put in the Sting NodeKey, but for the Sting itemName, I'm stuck.

If I put :

getItemText("          "+i, "C          3");

I get the date, but how to get the document number?

What is C?

Thanks,

Emmanuel.

clemens_gantert
Active Participant
0 Kudos

Hello Emmanuel,

roughly speaking, nodeKey is row key and item name is the column.

The node key often can be figured out by recording the selection of the line in question or by looping over all the entries delivered by method getNodes() or getSubNodes().

The item names can be accessed through the columnNames property. The following script logs the item (=column) names of a table and the values of their top node (unfortunately there is not scripting method to access the column's title):

var itemName;
var tree = session.findById("wnd[0]/usr/cntlTREE1/shellcont/shell/shellcont[1]/shell[1]");
var items= tree.columnNames;
for(var i=0; i<items.length; i++){
itemName = items.elementAt(i);
session.utils.log(">"+itemName+"<:"+tree.getItemText(tree.topNode, itemName));
}