cancel
Showing results for 
Search instead for 
Did you mean: 

How To Pass Data To The Back-End.

Former Member
0 Kudos

Hi All,

I want to send data to the back-end from a view,I have inputed the data in different rows of a table & I want to send the data to the back-end on the event of a click of a button tables respective of their columns in the back-end table.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

For sending data to back end on click of button you can use this peace of code

Here Test is a value node which we can bind with Table.

int valueNodeSize=wdContext.nodeTest().size();

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

IPrivateCheckView.ITestElement valueEle=wdContext.nodeTest().getTestElementAt(i);

//=================Create Model Node Element===================

IPrivateCheckView.IModelElement modelEle=wdContext.nodeModel().createModelElement();

modelEle.setAddress(valueEle.getAddress());

modelEle.setName(valueEle.getName());

wdContext.nodeModel().addElement(modelEle);

}

Regards

Trilochan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Please find sample code to interate table values and to send data to backend RFC on click of a button.

Bapi_Mat_Dispach_Input dispach_Input = new Bapi_Mat_Dispach_Input();
    	
    ZStr_Mat_List mat_List;
    
    //iterate the table datasouce node and set the values to RFC	
    for(int i=0;i<wdContext.nodeMaterialDetails().size();i++)
    {
	mat_List = new ZStr_Mat_List();

	mat_List.setChallan_Date(wdContext.nodeMaterialDetails().getMaterialDetailsElementAt(i).getChallan_Date());
        mat_List.setDeliveryQty(WdContext.nodeMaterialDetails().getMaterialDetailsElementAt(i).getDelivery());
                                . . .
                                . . .
        dispach_Input.addIt_Details(mat_List);
    }

   wdContext.nodeBapi_Mat_Dispach_Input().bind(dispach_Input);
    	
    //executing RFC 
    wdContext.currentZpps_Bapi_Cspd_Mat_Req_Dispach_InputElement().modelObject().execute();

Call the RFC execution code on click of Button to send the data to RFC.

Regards,

Bala Baskaran.S

p330068
Active Contributor
0 Kudos

Hi Anurag,

If you want to send table data to backend system then you need to execute the model node(RFC/BAPI).

before executing need to iterate the table data from context node and set to backend table for your RFC/BAPI.

Then exeute you model. find the code to saving table data to backend system. refer to the link and find the tutorials

https://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-Adaptive+RFC

Hope it helps

Regards

Arun