Hi,
I have a composite application, that is basically a number of imported SAP RFC function modules. This composite application is used in various ways and has been performing well for many years.
I now have to import a new RFC into the composite application.
I connect to the NWDI and create the project in my workspace from the source control.
I now have the nice, working version with it's 10 imported function models.
The problem starts if I try to generate this application.
If I look at the bean for one of the function function models in the EJB (under the navgator window in the Composite Application prespective).
I see the connection code for the service and and it looks like below (this is pre generation)
recordFactory = sapConnectionFactory.getRecordFactory("R3_SVC");
try { // Try creating a connection with the language of the current user first.
IUser user = UMFactory.getAuthenticator().getLoggedInUser();
if (user != null && user.getLocale() != null) {
ConnectionSpec spec = sapConnectionFactory.createConnectionSpec("R3_SVC", null, user.getLocale().getLanguage());
connection = sapConnectionFactory.getConnection(spec);
}
} catch (ResourceException e) { // $JL-EXC$ Probably the R/3 system does not support the user language. The language from the destination will be retried below.
}
if (connection == null) {
connection = sapConnectionFactory.getConnection("R3_SVC");
}
As stated this is fine and has worked for years.
As soon as I try to generate the Application (I have made no changes, same as when imported from the source control, this is a simple generate). The code changes to the below;
try { // Try creating a connection with the language of the current user first.
IUser user = UMFactory.getAuthenticator().getLoggedInUser();
if (user != null && user.getLocale() != null) {
Map<SAPConnectionFactory.CustomDestinationProperty, String> props = new HashMap<SAPConnectionFactory.CustomDestinationProperty, String>();
props.put(SAPConnectionFactory.CustomDestinationProperty.LANG, user.getLocale().getLanguage());
connection =sapConnectionFactory.getConnection("R3_SVC", props);
}
} catch (ResourceException e) { // $JL-EXC$ Probably the R/3 system does not support the user language. The language from the destination will be retried below.
}
if (connection == null) {
connection = sapConnectionFactory.getConnection("R3_SVC");
}
The generateion has added the lines
Map<SAPConnectionFactory.CustomDestinationProperty, String> props = new HashMap<SAPConnectionFactory.CustomDestinationProperty, String>();
props.put(SAPConnectionFactory.CustomDestinationProperty.LANG, user.getLocale().getLanguage());
This throws up a "SAPConnectionFactory.CustomDestinationProperty cannot be resolved to a type" and I cannot do anything with the class anymore.
Obviuosly, this is code generated by NWDS on the back of a function model import. I cannot change this code. It's automatic.
I've raised the meesage on OSS but they are currently claiming they can't help with custom code!!! I have tried to exaplain it's their tool generating it.
Has anyone seen this before? I don't have a clue where to stop it happening.
Cheers