cancel
Showing results for 
Search instead for 
Did you mean: 

Code To Update the Table in ECC from Webdynpro

Former Member
0 Kudos

Hi All,

I want to know, the table is dispalyed in the webdynpro browser when we calls the Adaptive RFC Model.

after i want to add one more row in the webdynpro and just clicking on add button the row will be updated in the ECC server(backend) for that how can i write the coding, regarding this issue can you please help me.

ThanX All,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sriram,

If I am not mistaken, on loading of the Web Dynpro screen, you need to make an Adaptive RFC call to the backend to get the table structure along with the existing values within. Now you have an ADD button next to your table on click of which you need to add a row in the table on the screen and at the same time in the backend as well. Which doesn't seem to be very proper as multiple RFC calls to backend server with do nothing but hamper the performance of the application badly. Moreover on click of the Add button you are simply adding a row in the backend table with either null or predefined entries.

So, I would suggest you to have two buttons instead, say Add and Update. On click of add just add a new row to the table (add new element to tabe node). Let the user enter values for the new row and then let him click on Update button. On click of Update button, make an RFC call and update the backend table with the new one (Better if you could delete all the table rows and add the current rows on the screen). This will reduce the number of calls to the backend and improve the overall performance.

In case you are not very sure of how to make the RFC call then follow the below mentioned link.

http://help.sap.com/saphelp_47x200/helpdata/en/d5/1558bfa6aa80499113983e738b1b21/frameset.htm

Hope it helps.

Regards,

Tushar SInha

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sriram,

Assuming you have a table filled with records by adding one by one, If you want to update a table in SAP ECC, follow these steps.. i think already you are triggering the action for the button in view(for table updation) to method in controller or created a custom controller and mapped the model node.

1. Initialize the main model node and bind the model node with the intialised object like

Zbapi_MainModelNode_Input input = new Zbapi_MainModelNode_Input();

wdContext.nodeZbapi_MainModelNode_Input ().bind(input);

2. Now loop the table node and set the values with corresponding class in the generated model (from webdynpro explorer) and initialize like

IPrivateControllerName.ITableElement myTab = null;

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

{

myTab = this.wdContext.nodeTable().getTableElementAt(i);

Bapi_structname name = new Bapi_structname();

name.setFieldName1(myTab.getFieldName1);

name.setFieldName2(myTab.getFieldName2);

input.addT_Bapi_(name);

}

Finally execute the BAPI..

wdContext.currentZbapi_MainModelNode_Input tElement().modelObject().execute();

Hope this solves your issue - Update the Table in ECC from Webdynpro.

Regards,

Manjunath

Edited by: Manjunath Subramani on Nov 20, 2009 4:26 PM

Edited by: Manjunath Subramani on Nov 20, 2009 4:27 PM

former_member214651
Active Contributor
0 Kudos

Hi Sriram,

After you click on the Add button in WebDynpro call the method which executes the RFC and in the methid perform the following activities:

1 Instantiate the model node where the table needs to be updated (InputNode)

2. Bind the object created to the Node.

3. Create the object of the Table which needs to be updated

4. Get the current number of rows from the table and add it to table in ECC (get the individual values by using a for loop)

execute the RFC.

Regards,

Poojith MV

Former Member
0 Kudos

Hi,

you can get the current element from the node you bind to the table. From the element,you can pass the values to the RFC.

Kind regards,

Saravanan K