Skip to Content
avatar image
Former Member

sap personas scripting document flow and Nodes

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 02, 2017 at 05:50 PM

    Thank you clemens .

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 01, 2017 at 03:13 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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));
      }