cancel
Showing results for 
Search instead for 
Did you mean: 

Data in dynamic table not pass to webdynpro java

Former Member
0 Kudos
102

Hi Experts,

I am new in adobe interactive form. I am creating an online interactive form using webdynpro java application. The form has a dynamic table where row can be add or delete.

I followed the instruction in () to create the dynamic table and done the data binding to the fields of the table. The data are able to save in the local disk successfully.

But the problem is when i try to submit the data (via Submit button) back to webdynpro application, all the data are able to transfer back to the webdynpro application except those data in the dynamic table.

Can anybody gives me a solution?

Regards,

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ravi,

When you add a row in the table, it doesn't create an instance in the web dynpro. So one of the solution is that you create instances of the table in the wdInit() method of the application.

After creating instances, you can loop at the node and read the table using getNodeElementAt(int index) method.

Hope this helps,

Amit

Former Member
0 Kudos

Hi Amit,

Sorry, I am also very new in webdynpro application. I tried creating table instances in the wdDoInit() using the following codes

IPrivateAdobeView.ITableNode tableNode = wdContext.nodeTable();

IPrivateAdobeView.ITableElement tableEle = tableNode.createTableElement();

But when i pressed the submit button, the tableNode and tableEle in the "onActionSubmitPressed" event seems to be empty. In the debugging mode, it is showing <error(s) during the evaluation>. I created tableNode and tableEle in the wdDoInit() only, do i need to declare elsewhere in order to see the values in "onActionSubmitPressed" event?

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

After creating the element, you have to add it in the Node.

wdContext.tableNode.addElement(tableEle);

And for onActionSubmitPressed event, I would suggest to check the values of any text field . Whether the data is getting passed from Form to WD Context.

Hope this helps,

Amit

Former Member
0 Kudos

Hi Amit,

Appreciate your quick response. I added your code into the wdDoInit():

wdContext.nodeTable.addElement(tableEle);

but seems like there is no value pass from the adobe form to the webdynpro application.

I subsequently included the following code after the add element for the table.

IPrivateAdobeView.IWrapperNode wrapperNode = wdContext.nodeWrapper();

IPrivateAdobeView.IWrapperElement wrapperEle = wrapperNode.createWrapperElement();

wdContext.nodeWrapper.addElement(wrapperEle);

IPrivateAdobeView.IDataNode dataNode = wdContext.nodeData();

IPrivateAdobeView.IDataElement dataEle = dataNode.createDateElement();

wdContext.nodeData.addElement(dataEle);

And the form managed to return the 1st record but the rest of the table records are not returning.

I tried adding another new wrapper element into the nodeWrapper but it is returning as null.

The context that i created is as follows:

PDFDataSource (cardinality = 1..1, selection = 0..1, singleton = true)

|---Name (value attribute)

|---IssueDate (value attribute)

|---Table (cardinality = 1..1, selection = 0..1, singleton = true)

|--|-Wrapper (cardinality = 0..n, selection = 0..1, singleton = true)

|--


|- Data (cardinality = 0..1, selection = 0..1, singleton = false)

|--


|- ID (value attribute)

|--


|- Desc (value attribute)

Former Member
0 Kudos

Hi Ravi,

no need to create such a complex hierarchy.

I am using a table with following hierarchy in context:

DataSource(Cardinality 1..1)

--> Table (Cardinality 0..n)

--> Id

--> Desc

ANd in the form, I have taken two Subforms

Table (binding = Normal, Repeat Subform = Checked)

--> Data (binding = None , Repeat Subform = Checked, Min Count = 1)

Then I have written following code in init():

IPrivateDropDownAppView.ITableNode node = wdContext.nodeTable();

IPrivateDropDownAppView.ITableElement tableele;

for (int i = 0; i < 5; i++) {

tableele = node.createTableElement();

node.addElement(tableele);

}

And below code in Show method:

for (int i = 0; i < wdContext.nodeTable().size(); i++) {

wdComponentAPI.getMessageManager().reportSuccess(

"Id: " + wdContext.nodeTable().getTableElementAt(i).getId());

wdComponentAPI.getMessageManager().reportSuccess(

"Desc: "

+ wdContext.nodeTable().getTableElementAt(i).getDesc());

}

And I am able to see the data, filled in the table.

Hope this helps you.

Amit

Former Member
0 Kudos

Hi Amit,

I followed your method and data are successfully transfer to the webdynpro application. But when i tried to add new row into the table using javascript, a new row is created but with the same data in the previous row. If i try to change any data in any of the row, it will reflects in all the rows.

Do you have any solution for this?

Regards,

Ravi

Former Member
0 Kudos

Hi Amit,

The coding in the wdDoInit(), you also declared number of rows to appear in the dynamic table. But if the table's row is going to be dynamic, how do you declare it upfront in the web dynpro java application?

Regards,

Ravi

Former Member
0 Kudos

Hi

If you create some elements, say 5, in the wdDoInit(), I think you will have 5 empty rows in the dynamic table in Adobe Form.

I have two solutions for taking back the values in a dynamic table to back to the WebDynpro context.

Solution 1:

Have the button 'Add' ( and 'Remove' too) as Activex Submit button, which will submit the data to the SAP (WebDynpro). Whenever the user clicks 'Add', it will create an empty element in the WebDynpro context, and a row in Dynamic Table too.(You need not have to script for this).

The problem here is that, each time the user clicks 'Add' or 'Remove' button, there will be a server round trip, ad the Adobe form renders each time, which will sure affect the performance.

And also if you have any script in the 'initialize' or 'docready' events that will also get executed.

Solution 2:

To avoid the drawback in Solution1, we can have the dynamic table with normal buttons, and scripts for adding and removing the rows. The 'Submit' button should be a 'ActiveX Submit button'. There should be a Text field(invisible) which will have the total number of rows( say n) in the Table. In the Submit action(WebDynpro) you have to get the XML of the Adobe Form, and parse the values from the XML contet. Then, create 'n' number of elements to the Node, and populate the parsed table rows to the node.

This solution seems to be a bit complex( getting XML content and parsing values from it), but I think this will be better than any other solution.

Note: If ActiveX Submit button doesn't work, see that you have 'SAP Active components Framework' installed, if not insatall it.

Also visit these links:

If any one has a solution better than these, Please share it here.

Thanks,

Prabhakar.

Former Member
0 Kudos

thanks to Amit and Prabhakar.

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

Thanks for your appreciation.

If you are using Solution2,

-> For getting XML content, there are some WebDynpro APIs which can be used.

-> For parsing, the values from XML, you can use SAX parsing or DOM parsing.

Thanks,

Prabhakar.

Answers (0)