Importing adaptive RFC Model-Steps and tricks to resolve some issues
I would like to share my experience while developing Web Dynpro based applications. So, i thought of writing down about model importing
in which i faced a lot of issues in my initial days.Model importing comes into usage if an application makes use of BAPI’s for sending data
to backend system. In short, one can say model import is a bridge that establishes connection between application and database.
Now, the question arises how to import model in to your application.Below are the basic steps one should follow for importing model:
Steps to re import model:
- Go to your Development component -> Web Dynpro and expand its structure.
- Select Model and right click on it and select Create Model option as shown in figure below.
Fig. 1 Creation of model
- Select one of the options in the next window.For importing BAPI”s choose “Import adaptive RFC Model” and click on next.
- Give the logical system names for model instances and click on Next Button.
Fig. 2 Configuration Details with backend
- On the next window, provide the login details for connecting to backend system and click on Next button
Fig. 3 Login Details
- Next window helps you to search for BAPI’s. Click on search button to search BAPI’s.
Fig. 4 Search window for RFC’s
- Select the BAPI’s as per your requirement and click on Finish.
Fig. 5 Model context after import
Note: Please get your J2EE server re started after every import.
After completing all the steps, you can start mapping model nodes to your component controller context as per your requirement.
This is all about importing model. Next thing I would like to share is a common issue faced after re importing existing model in your applications. If you
are developing a large web based application, there may be a case wherein your existing web service model has been changed .This change may
be addition/deletion of new attributes or change in attribute type or addition of new structure/table in a BAPI so you need to reflect the changes in
your model. For this, you need to re import model by following almost the same steps you did while creating it.
Fig.6 Web Dynpro Explorer
In case of model re-import, it will search for any new changes in the existing BAPI’s inside your model in addition to above mentioned steps.This may
take some time and after search is complete, it will list down all the changes (if any) in the RFC’s. These changes are termed as “deltas” .This will help
you to verify the changes before reflecting them into your model. Till this step, the new changes are not imported unless Finish button is clicked.
Fig. 7 List of deltas
Some of the common issues faced after re-importing model are listed below:
1. Getting Null pointer exception despite data being returned by RFC:
If there is a change in a particular attribute or structure of a BAPI, then we can do re-mapping of changed atribute/Structure by deleting it
without touching the mappings of remaining attributes/structure but doing so results in null pointer exception once you start using this BAPI for transferring
data from backend to view. After debugging code, you will find that data is coming to model node but it’s not coming to view .Reason for this is that even
though mappings for rest of the attributes are there, they get broken once there is a change in model node due to re import of model. To avoid such
a situation, it is always better to delete entire structure (model node) of changed BAPI and remap entire node to controller context.To clarify this scenario
more, suppose we have a parent node A and X,Y,Z are child nodes and there is change in stucture of node X due to model import,then in that case
we need to delete the entire structure of parent node A and re map it again from scratch. An example of this is shown by mean of figures:
- Delete the entire structure of model node
Fig. 8 Context of controller
- Remap it to model node again
Fig. 9 Context of controller
Next window will guide you to re map the deleted node
Fig. 10 Re-Mapping of node
Re mapping model node to component controller’s context will resolve the problem of null pointer exception.
2. Time consuming-Response of data modeller diagram view too slow:
This problem is faced if your application is making use of minimum 20 BAPI’s. In that case re-importing a new BAPI to existing model
is really a tedious task. If any new development is required in a exsting application having a model structure of this type, then mapping of
newly added RFC takes a very long time since the response time of graphical based window (shown below) in this case is too long.Every click on
this window takes a minimum of 2-3 mins.There is no workaround to avoid this situation as of now but i will surely update this blog in case i find any.
Fig. 11 Model Binding Diagram
P.S: Being aware of above mentioned scenario, try to use a simpler design for model.