cancel
Showing results for 
Search instead for 
Did you mean: 

Data not being transported to Model in Context?

Former Member
0 Kudos

Hello Experts!

I'm trying to call a custom RFC in my WebDynpro application. No problem calling it. I can even use the return parameters. But when I try to access some EXPORTING parameters, the exceptions are triggered. I've checked that all required importing parameters are passed and that the custom RFC works correctly in R/3.

Here are the exception stacks I get:

java.lang.ArrayIndexOutOfBoundsException: -1

    at com.sap.mw.jco.JCO$Record.getString(JCO.java:12829)
    at com.sap.aii.proxy.framework.core.JcoBaseTypeData.getElementValueAsString(JcoBaseTypeData.java:669)
    at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.getAttributeValueAsString(DynamicRFCModelClass.java:427)
    at com.kaisa.mwci.models.getprojects.Zps_Fm_Get_Projects_Output.getEx_Name1(Zps_Fm_Get_Projects_Output.java:164)
    at com.kaisa.mwci.wd.wdp.IPublicVODownloadComp$IProjectsElement.wdGetObject(IPublicVODownloadComp.java:602)
    ... 53 more

and

java.lang.NullPointerException

    at com.sap.aii.proxy.framework.core.JcoBaseTypeData.getElementValueAsBigDecimal(JcoBaseTypeData.java:648)
    at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.getAttributeValueAsBigDecimal(DynamicRFCModelClass.java:259)
    at com.kaisa.mwci.models.getnetworks.Zps_Fm_Get_Network_Num_Output.getEx_Cwcost(Zps_Fm_Get_Network_Num_Output.java:164)
    at com.kaisa.mwci.wd.wdp.IPublicVODownloadComp$INetworksElement.wdGetObject(IPublicVODownloadComp.java:1206)
    at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdGetObject(MappedNodeElement.java:351)
    ... 52 more

Hoping for your expert advice on my problem. Thanks!

Cheers,

Alfonso

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Paul,

By any chance was there a change in structure of the RFC import, export or table

parameters? Any change in data type of a variable? If yes, then refresh the

meta data cache of J2ee Server. One method of refreshing is by restarting the

J2EE server. There are other method also in which I am not an expert to advice.

Best Regards,

Gopal

Former Member
0 Kudos

Hi,

As said before, I had the same problem. Took me some hours to figure out that even invalidating the Cache I still had the same error.

It fixed after a J2EE restart.

You should probably try something like that.

Regards,

Daniel

Former Member
0 Kudos

Hi

If you are using EP 7.0 and SP>=13 , there is cache invalicaion and i hope there is

no need for server re-start. Below link can help .

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10465350-b4f5-2910-61ba-a58282b3...

murali

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi All,

Thanks for all the help and suggestion. Gopal had it spot on. There was nothing wrong with my code, this was a server issue which was solved by the server reset.

Thanks for everybody's help. Points awarded.

Cheers,

Alfonso

Former Member
0 Kudos

hi

Please try to debug the applicaiton , ArrayIndexOutofBound and NullPointer may be due to the

values you are passing to the import parameters , or if you are using Values Node change the cardinality , please try to HARD CODE the values (same values that you have provided in the back end

for the RFC to get output ) , use same HARD CORDED values and debug the application .

This may either due to the values use are passing or cardinality properblem .

And even try to check the size of the output node after you have executed the RFC .

murali

Former Member
0 Kudos

Hi Ayyapparaj,

That's just it. That node is NOT empty. I can get and use the values of the other values within that node except for some.

Thanks,

Alfonso

former_member751941
Active Contributor
0 Kudos

Hi Paul,

What is the cardinality of your model node? Make sure after executing the RFC you have invalidate the output node.(wdContext.node<Output>.invalidate())

If its 0..1 Then

if(wdContext.node<ModelName>.size > 0)

wdContext.nodeCustomNode.currentCustomNodeElement.setCustomValue( wdContext.node<ModelName>.current<ModelName>Element().get<ParameterName>());

If its 0..n Then

if(wdContext.node<ModelName>.size > 0)

{

int i = wdContext.node<ModelName>.getLeadSelection(); wdContext.nodeCustomNode.currentCustomNodeElement.setCustomValue( wdContext.node<ModelName>.get<ModelName>ElementAt(i).get<ParameterName>());

}

Regards,

Mithu

Former Member
0 Kudos

Hi Yogesh,

But the exceptions occur whenever I access that Model Node. Even if I try to copy it to a Value node like so:

wdContext.nodeCustomNode.currentCustomNodeElement.setCustomValue(
  wdContext.node<ModelName>.current<ModelName>Element.get<ParameterName>());

Former Member
0 Kudos

Hi,

use as follows



//before accessing the current<ModelName>Element make sure that a valid element exists

if(!wdContext.node<ModelName>.isEmpty())
		  wdContext.nodeCustomNode.currentCustomNodeElement.setCustomValue(
				  wdContext.node<ModelName>.current<ModelName>Element.get<ParameterName>());

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Yogesh,

Which part of the code? So far, I don't really need any code since the data is directly bound to the Layout element.

Thanks.

Regards,

Alfonso

yogesh_galphade
Contributor
0 Kudos

Hi Alfonso

Did you tried with copying in valuenodes?, sometime null values or decimal values gives some problem while exporting and importing by rfc

yogesh_galphade
Contributor
0 Kudos

Hi

Please send the code, let me go through