cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting data back from SAP

Former Member
0 Kudos

Hello,

I have two Web Dynpro apps that are sitting on our QA portal right now that we're having problems with. Both apps have to get data from an RFC from two different systems depending on a radio button they select on the form. So, if they select one radio button, they connect to the system called EQ1 and the other radio button will connect them to EQ2. I take care of this with the following snippet of code:

String selectedDestination = wdContext.currentContextElement().getJCoDestination();

try {

IWDJCOClientConnection jcoClientConn = WDSystemLandscape.getJCOClientConnection(selectedDestination);

//set the JCo connection that the model is using to the one the user has selected

ZC_DM_MIS_FETCH_DATA_model fetchModel = (ZC_DM_MIS_FETCH_DATA_model)WDModelFactory.getModelInstance(ZC_DM_MIS_FETCH_DATA_model.class);

fetchModel.setJcoClient(jcoClientConn.getClient());

//execute the model

wdContext.currentZc_Dm_Mis_Fetch_Data_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

jcoClientConn.release();

} catch (Exception e) {

e.printStackTrace();

}

This works perfectly fine locally and on the Dev portal, we've only had trouble after putting it on the QA portal. One app defaults to using EQ1, but if the radio button is selected for EQ2 and the submit button hit, we get a NullPointerException on the first line of code that tries to get something from the output node. The other app defaults to EQ2, but if the radio button is selected for EQ1 we get the same NullPointerException.

Like I said, the code works fine locally and on dev. The Jco Connections are set up fine on QA... what could possibly be the problem?

Any ideas?

I WILL reward points for helpful answers.

Thank you,

Jennifer

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I don't see the exact problem with the code however if I were you, I don't see the value in model reuse. I would consider creating two separate Adaptive RFC models with separate destinations in the Web Dynpro Content Admin. You need two destination for each connection one for meta-data the other for invoking so a total of four logical destinations. I would configure these to run against the two systems. You could then switch the model usage between the two systems, but remember that wdDoInit() is only called once on initilization of the component.

Former Member
0 Kudos

Well, I could do that. But then when creating my form, I wouldn't know which model I was going to be using to bind all my fields to, so I'd have to pick one, and then if the user selected the radio button for the other system, I'd have to essentially copy all the data from one model to the other so I could execute it.

I figured out what the problem was, though... When I created the model, I used one set of METADATA and MODELDATA connections. In my code, however I'm only switching the MODELDATA. This is causing a problem because now the meta and model connections are pointing to two different servers. It was ok with this on our dev server because we only had one server and were just using different clients.

I'm guessing there's not going to be any way for me to get around this issue.