Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Get the return value of an RFC function / BAPI

Hello,

I'm a Web Dynpro Java beginner and I try to get the return value (domain: NUMC6) of an RFC function without success.

Here is what I do, could you please tell me what is wrong?

First, here is my context:

Context
|
|---- ZMy_Bapi
	|
	|---- MyOutputResult
	|	|
	|	|---- MyReturnValue
	|
	|---- MyInput

My model:

MyModel
|
|---- ZMy_Bapi_Input
	|
	|---- Output
	|	|
	|	|---- ZMy_Bapi_Output
	|		|
	|		|---- Return_Value
	|
	|---- Input_Value

The mapping between them:

- MyInput is mapped to Input_Value

- MyReturnValue is mapped to Return_Value

And my code:

ZMy_Bapi_Input bapiInput = new ZMy_Bapi_Input();
wdContext.nodeZMy_Bapi().bind(bapiInput);

bapiInput.setInput_Value("A value");

executeZMy_Bapi();

ZMy_Bapi_Output bapiOutput = new ZMy_Bapi_Output();
wdContext.nodeMyOutputResult().bind(bapiOutput);
IMyOutputResultElement outputElement = wdContext.nodeMyOutputResult().currentMyOutputResultElement();

String result = outputElement.getMyReturnValue();

Finally, here is the code of the executeZMy_Bapi() function:

try {
	wdContext.currentZMy_BapiElement().modelObject().execute();
	wdContext.nodeMyOutputResult().invalidate();
} catch (Exception ex) {
	ex.printStackTrace();
}

My problem is that "result" keeps being empty

Thanks in advance for your help!

Former Member
Not what you were looking for? View more on this topic or Ask a question