cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting data from webdynpro table to backend model node tru rfc execution

Former Member
0 Kudos

Hello experts,

I have a little Problem, I hope that you can help me.

i have the following structure (in the Controller)

->Zbapi_Inquiry_Createfromdata2_Input (Model Node, from bapi, RFC)

---> Inquiry_Conditions_In (Model Node, table in the Bapi)

-


> Currency (Model Atribut, from table, in bapi)

-


> Item_Number (Model Atribut, from table, in bapi)

--->Inquiry_Items_In (Model Node, table in the Bapi)

-


> Item_Number (Model Atribut, from table, in bapi)

-


> Material (Model Atribut, from table, in bapi)

--->Inquiry_Schedule_In (Model Node, table in the Bapi)

-


> Item_Number (Model Atribut, from table, in bapi)

-


> Req_Qty (Model Atribut, from table, in bapi)

-->CTabes(node)

-->cmat(att)

-->cquant(att)

What actually my requirement is from webdynpro table UI ement I have to send the data to backend

The Table is binded to CTables.and the attributes are cmat and cquant

When single row is entered it is updated in the backend,and for multiple rows how the data is to be updated.

The code I wrote for single row is

int size=wdContext.nodeCTables().size() ;

int counter=0;

for(int i=0;i<=size-1;i++)

{

IWDNodeElement nler=wdContext.nodeCTables(). getElementAt( i);

BigDecimal bc=new BigDecimal(nler.getAttributeAsText("cquant" ));

String elmat=nler.getAttributeAsText("cmat" );

wdContext.currentInquiry_Items_InElement().setMaterial(nler.getAttributeAsText("cmat" ) ) ;

wdContext.currentInquiry_Schedules_InElement().setReq_Qty( bc);

}

If the multiple row data is given ,only the last row is updated in backend

Plz help me on this

Thanks&regards

madhu

Accepted Solutions (0)

Answers (1)

Answers (1)

p_2_5_6_9_6_0
Active Participant
0 Kudos

Hi,

Problem: I am guessing that the cardinality of your "CTables" node is 0..n. If it isin't then change it to 0..n. The reason that only one element is entered into the backend is that we need to write code so that the Model context is populated when an event occurs (like clicking a "Save" button) just before calling the BAPI. This is probably not present in your program.This would mean that you need to create the elements of this node before actually calling execute on the BAPI that will create the backend data.

Solution: Now, if you haven't already done so - create a button "Add Row" - inside the action for this button - add the code to create a new element in the CTables node using the createElement() of the node CTable. Then, if you haven't already done so - create a button "Save" - inside the action for this button - add the code to create and add each element of the view context to the controller / model context. Then call the execute() method of your BAPI.

If you are asking what is the simplest and most accurate way to populate the model context and execute the BAPI - then search for "Controller Coding Explained" - it is a very good tutorial and will explain the nuances of what objects to create and how to execute the BAPI.

Thanks.

p256960.

Former Member
0 Kudos

HI

THe CTables cardinality is 1..n

From this table i have to fetch and insert to the model nodes

Here the cmat (material) must be set to the currentInquiry_Items_InElement().

and the cquant must be set to currentInquiry_Schedules_InElement().

See the code below...

wdContext.currentInquiry_Items_InElement().setMaterial(nler.getAttributeAsText("cmat" ) ) ;

wdContext.currentInquiry_Schedules_InElement().setReq_Qty( bc);

Able to insert a single row

If i keep the same thing in the loop for multiple row insertion,the last row is inserted.The solution u have given is to upadte in CTables it seems.I have to update in the model node

waiting for ur qick resp

thanks

madhu

Former Member
0 Kudos

Hi,

Please go through this thread

Regards,

ramesh

p_2_5_6_9_6_0
Active Participant
0 Kudos

Hi,

The two places that the issue could lie are:

1.) Populating the model context: Make sure that there is an addElement() method call within the for loop that is populating the model context.

2.) An error whn capturing the data from the table into the view context. In this case again ensure that the cardinatlity is 0..n or 1..n according to requirements. Following that check during a debug if each element is added using addElement() to the view context.

Unless the actual code is posted - I dont think I can provide a more accurate solution to you.

Hope that helps.

Post the solution if you resolve the issue yourself - it will help other people with similar problems.

Thanks.

p256960.