cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a RFC (BAPI), Table as INPUT Parameter

J_B
Explorer
0 Kudos

Hy All,

we want to update a single dataset in a Backend-System over a RFC-Call. The input parameter of the RFC is only a table, no additional input-fields are neccessary.

From our WebDynpro the context of the view is mapped to the CustomController. The CustController is bind to the Model. (Input -> Table)

When we debug the application, on the WebDynpro-Side the Structure (Input -> Table) is filled. The current Node-Element is ok, i Think. On the ABAP-Side the RFC is callend, but the table is empty.

// fill fields of Z_TEST_HEADER

wdContext.currentZ_TEST_HEADERElement().setTest("1234567890");

// Calls remote function module Z_TEST wdContext.currentZ_TEST_INPUTElement().modelObject().execute();

Where is our fault ?

How do i have to fill or map the context of the Controller to the model ?

by Jürgen Berndt

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

Probably the issue is with the Transation management at the abap side. Some times it so happens that the values will be there in the node but while comiting the transation the bapi is not construted to do the transation well. this is just my perception.

Arun.

PradeepBondla
Active Contributor
0 Kudos

Hi,

If your requirement is : sending table as input to BAPI and execute...

this will solve your problem

public void wdDoInit()
{
//@@begin wdDoInit()
Ybapi_Srma_Returns_Input input = new Ybapi_Srma_Returns_Input();
wdContext.nodeYbapi_Srma_Returns_Input().bind(input);

wdContext.currentYbapi_Srma_Returns_InputElement().setTable(table);
http://a setter method will come if you have a table as a importing parmater inthe model that you are using.

wdContext.currentYbapi_Srma_Returns_InputElement().modelObject().execute();

//@@end
}

check this links too..

regards,

Pradeep

Former Member
0 Kudos

Hi Jürgen,

I am currently facing the same issue you posted here, can you help me out with your solution?

Thank you,

Jonathan

Former Member
0 Kudos

Hi Jürgen,

you didn't post all the code involved, therefore I can only guess...

Probably, you have not added the modelObject "Z_TEST_HEADER" of the newly created element to the modelObject of the Input Element "Z_TEST_INPUT".

Try the following:

wdContext.currentZ_TEST_INPUTElement().modelObject().setZ_TEST_HEADER(wdContext.currentZ_TEST_HEADERElement().modelObject)

This is only to see if it solves your problem.

In general, I would recommend creating, adding, and deleting objects directly in the model layer, and not in the context layer. The code is shorter and easier to understand. In addition, you must look at the context as being a view into the model. Keeping the context synchronized with the model is not always automated. Whenever you change relations (add an element in a table or add a structure) you must notify the context, that the model has been changed:

wdContext.nodeZ_TEST_HEADER().invalidate();

Ciao, Markus

PS: I'm not sure where a Table comes into play. The code you posted is only a single structure (1:1) not a table (1:N). Perhaps I misunderstood?