Skip to Content
Context as we all know is the heart of Web Dynpro-ABAP programming. With its various properties as Singleton, Cardinality, Input Element , Interface Node etc the context, wheather it be of a component, Interface, window or a view ,it becomes a very powerful tool. The properties may sound to be every simple but the significance they play in WD-ABAP programming is tremendous. In this blog I would not be discussing about all of them. We already have some good blogs posted by our WD gurus . In this blog I would be discussing the importance of Input Element Property of a Context Node. When we talk about the context, the first thing that comes in the mind is context mapping.Context Mappingallows a controller to access data that has been pre-processed by some other controller. Since the mapping relationship has been defined once, it allows a direct reference to be made to data in another controller, and there is no need of data to be moved or copied whatsoever. In a layman language I would say, it’s the only way to pass data from one view to another view for processing. Here I assume that we all know how to do the context mapping.

So I directly go ahead and discuss the Context Mapping types:
Internal Mapping:It is the Context Mapping that is done between different controllers of the same component. Here please note the controllers can be any one among the component controller, configuration controller, window controller, view controller, custom controller but not the interfacecontroller.
External Mapping:Context Mapping done between the controllers of different components to share data. Here the interface controller comes into picture.
External Mapping is further of two types:
Direct Context Mapping:Passing data from the child component to the parent component, which normally is the reason in which we use other components in our component. In this case mapping origin( the data source )is the Interface Controller of the child component.

Note: Here I am using the terminology as child component and parent component, just to make it a bit simple. By child component I mean the component that is being reused, or component whose component usage has been declared in some other component. Parent component is one which has the usage defined in itself, or which uses the other component. In this case the lifetime of the instance of the child component is of importance, as it should be present to transfer the data to the parent.Deleting the instance means that the mapping origin would not be available.

Reverse Context Mapping:Passing data from the parent component to the child component. In this case mapping origin is the ComponentController of the parent component.

Now by setting up the basic platform, I would like to share some knowledge across regarding the reverse context mapping or in a way to transfer data from parent to child.>In the child component I want the data to come from the parent in the node CUSTOMER of the child.

image

This picture below displays us the layout of the child which has just one view embedded in the window.

image

Below displayed screenshot, shows the context of the component controller of the parent component. Notice here also we have a node CUSTOMER, and there is NO need to check the Interface Node property or either the Input Element property of the node.

image

After declaring the usage of the child component in the parent component and defining the navigation( Inbound and Outbound Plugs along with the Navigation links) we fill the node CUSTOMER. The screen shot below shows the usage of the child component declared. Since it is required to navigate from the parent component to child component , so the window of the child component has to be embedded in the parent comp window, along with the necessary plugs. Screen shot below displays that.

image

image

The condition to fill the node may vary from program to program. In this case on changing the lead selection of the Bookings Table I am calling an action handler method through which I am calling a component controller method CUSTOMER_FILL to fill the node CUSTOMER. (this is done to segregate the business logic from the User Interface, MVC Concept, No business logic in View Controller)

image

As you integrate the child component, something known as Component Usages is created in the left hand side of the window as depicted in the screen shot. Now under the usage of the child component the usage of the interface controller of the child component has to be declared, as it has the node, methods, events to be shared across the components. Once this is done, then it must be told that which is the controller with which the data is to be shared, or in other words the controller used has to be declared. In the screen shot below Component controller of the parent component is the controller used in the interface controller usage and acts as the mapping origin. Now the mapping is defined for the Interface controller node ( CUSTOMER ) with the Component Controller Node ( Customer ), which is this happens to be known as Reverse Context Maping.

image

In the screen shot below the data of the node CUSTOMER is read in the wddoinit method of the component controller, just to check that wheather the data is coming or not.

image

image

This screenshot above displays that the child has the dataa and can now process the data and diplay it. Since the child’s window is embedded in parent and window has customer view as default view, it is dispayed. The final output is displayed as follows.The customer view comes below the bookings table data as the view has been embedded in the ViewElementUiCcontainer

image

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Ivan Mirisola
    Hi,

    Should we expect the same principles in WD for Java as stated on ABAP?
    It would be nice to read the same topic for the java community.

    Good work though, especially for the explanation on External Mappings and Parent/Child model.

    Best regards,
    Ivan

    (0) 

Leave a Reply