Skip to Content

During a development of a SAP interactive form, I noticed it isn’t that easy to retrieve multiple lines of similar data (a.k.a. ‘a table’) from a webservice and dynamically populate a table from them on your Interactive form.  I thought it would be worth sharing the solution I used with other Interactive forms developers.

The webservice I used was created from a remote enabled function module that uses multiple ‘tables’-parameters. When calling the webservice, the function module in the SAP back-end system is filling these tables with multiple records. On the interactive form, these records should automatically populate multiple lines in a table on the form.

This is where the problem occurs: only one record of each table is populated! Afterwards trying to read the rest of the data via scripting doesn’t work. All data is gone except for this one record per table. For populating listboxes, dropdown boxes etc, it is working fine if you bind them to the tables using the dynamic properties of these objects. However, a table on a form is build out of dynamically repeating subforms. Since subforms don’t have these dynamic properties, you cannot use this functionality.

After searching for a while on the internet, I ran into some documentation about an event I haven’t heard of before and which offered a solution to my problem: PostExecute.  The strange thing about this event is that you cannot select it in the scripting editor. You can only implement it directly in the XML source.  So you probably haven’t heard of it, unless you have studied the XFA reference, studied the Livecycle Designer help or already read this blog 🙂 .

To report this post you need to login first.

11 Comments

You must be Logged on to comment or reply to a post.

    1. Rudy Clement Post author
      Hi Guillaume,

      Thanks for your reply!

      I don’t know the ins and outs about performance. But in my form, about 15 tables containing about 50 records each are passed. I don’t have any performance issues…

      Basically the data is passed to the form anyway, it’s just a matter of reading it and handling it in a script.

      Kind regards,

      Rudy.

      (0) 
  1. Juergen Hauser
    Hi Rudy,

    Tables and web services work also without scripting. You need to bind to repeated data, i.e. the ‘[*]’ in the binding expression (for web services import or export binding).

    There’s a short comment regarding this in the following blog:
    The specified item was not found.

    And the SAP Interactive Forms by Adobe book (from SAP Press) has a chapter on using web services tat uses a web service returning a table.

    Cheers,
    Juergen

    (0) 
    1. Rudy Clement Post author
      Hi Juergen,

      Thanks for your reply. You are totally right! I was aware of this functionality and have also read your blog a while ago.
      The disadvantage of populating tables via binding is that you need to re-merge your form data after calling the webservice.
      This was something we didn’t want in our case. I’m not sure why we didn’t want this (it has been a while) but I think it had something to do with saving our selections. We had several listboxes on our form and, after remerging the form, the lines that were selected in these listboxes got deselected (right?). There probably is another way to save the selections but we choose to not use the re-merge form data option. I should have mentioned this in my blog…

      Kind regards,

      Rudy.

      (0) 
  2. Scott Stefanich
    Hello Rudy,

    I was unsure of a couple while defining the postExecute event in the XML Source,

    1. Location in XML Source: Based on the Adobe LiveCycle Desiner Help you referenced, I added it immediately following

    2. Function for further processing rootXml: Do you use additional script in the XML Source to populate a subform wrapped table in the form hierarchy or perhaps populate data view tables which are defined in the data context?

    Thank you for the interesting & clever blog!
    — Scott

    (0) 
      1. Scott Stefanich
        Your explanations & example more than answer my questions, especially the key points of the event applying to the form model and utilizing the instanceManager to create new instances of subforms within tables.

        Thank you very much!

        (0) 
  3. Ramesh Kotagiri
    Hi Rudy,
             We have the same scenario like need to generate table rows dynamially in the Adobe Interactive form populating the rows with the table data returned by an ABAP webservice. We are trying to use the event you mentioned and the code posted by you as follows

    if (rootXml)

    {

    //Read number of entries in response table for roles to be deleted

    var oDelNodes = rootXml.ZauthReqCreateSummaryResponse.TaRolesDelete.nodes;

    var DelNodesLength = oDelNodes.length;

    if(DelNodesLength > 0)

    {

    // Show roles to be deleted Subform1.Summary.Delete.Table.Line.instanceManager.setInstances(1);

    for(var i = 0 ; i<DelNodesLength; i++)

    {

    var oDelItem = Subform1.Summary.Delete.Table.Line.instanceManager.addInstance(1);

    oDelItem.AgrName.rawValue = oDelNodes.item(i).AgrName.value;

    }

    Subform1.variables.ShowHide.setSummary(true);

    }

    }

    else if (soapFault)

    {

    app.alert(“soapFault”);

    }

    Could you please explain the hierarchy you are following in the line “Subform1.Summary.Delete.Table.Line.instanceManager.addInstance(1);
    “. Is Summary, Delete, Table, Line, Nodes  etc.. are keywords OR the hierarchy of nodes in your Form ?

    Also in the line “var oDelNodes = rootXml.ZauthReqCreateSummaryResponse.TaRolesDelete.nodes;” what is TaRolesDelete and nodes ?

    The node hierarchy in our form is as below….

    DataConnection–>ZgetDetailsResponse—>MessageBody—->ZgetDetailsResponse—>ItPlmk—>item. Under this “item” node we have the fields for the table row.

    Please help us how to write the code for creating instance and dynamically populating the table row data keeping in view our form hierarchy.

    Regards
    Ramesh.

    (0) 
    1. Rudy Clement Post author
      Hi Ramesh,

      Thanks for your reply! And sorry for my late reply!
      To answer your questions:
      -Summary, Delete, Table, Line, Nodes represent the hierarchy of nodes (subforms) in our form. These are the subforms we are sending the data to for displaying them in the form.
      -rootXml.ZauthReqCreateSummaryResponse.TaRolesDelete.nodes represents the data we retrieve from our webservice.

      In your case, I guess this has to be replaced by rootXML.ZgetDetailsResponse.ItPlmk.nodes

      I hope these answers are still helpfull to you. If not, I hope my has been of any help.

      Regards,

      Rudy.

      (0) 

Leave a Reply