In the previous post we have see how to create the CHIP. In the following post let us see how to use the CHIP.
In the following example I am going to use the chip to be displayed in the side panel.
Step 1: Go to the Tcode SE80 and create the webdynpro component.
Assign the component to the package or save it in the local object.
Step 2: In the context tab of the view controller create a Context node for the table SFLIGHT of cardinality 0..N.
Step 3: In the layout tab of the view controller insert the page header UI element.
Note: The name of the page header UI element should be PAGE_HEADER.
Step 4: Right click on the page header UI element and select insert title content.
Provide the ID, and type of the UI element as transparent container.
Step 5: In the layout tab of the view controller, create a table UI element and bind the context node to the table.
Step 6: Create an object reference variable for the side panel in the attributes tab of the view controller. Here we get the reference of the side panel and store it in this attribute and use it across different methods in the view controller.
Step 7: Go to the do init method of the view controller and do the following.
Initialize the values for the Context node:
Initialize the side panel.
Step 8: In the previous step we are initializing the side panel with action ‘OPEN_SIDE_PANEL’. This event handler method will be called when event occur in the side panel. Create an event handler method with the name OPEN_SIDE_PANEL and do the following.
Write the coding to open the side panel.
Step 9: Save and activate the whole component. Create the webdynpro application to test the component.
Thus far, we have created a webdynpro component with page builder and side panel. The output of the application will be displayed as above. We now need to configure the side panel to add the webdynpro chip in it.
There are two options to open the side panel configuration tool.
- Append to the URL: &sap-config-mode=X
This is for the administrator, a client dependent customizing mode
- Append to the URL: &sap-config-mode=config
This is for the programmer, a client independent customizing mode
Now in this example let us open the side panel configuration in admin mode.
In the URL of the application, add &sap-config=X and load the application.
You will now be able to see a link on the page header with the name set additional information.
Click on the link. An configuration panel will be opened on the right hand side. Enter the name for the configuration and click on create/edit.
Side panel customizing window will be opened. Enter the description and select the link chip catalog on the right hand side of the window.
In the chip catalog, choose the chip which we have created. Drag and drop the chip in the side panel.
Note: Display name we provided at the time of creation of chip will be displayed.
You will able to see the view of the chip component loaded in the panel.
Save the configuration and close the window.
Also save the additional information to open the side panel as soon as the application is started.
Now we do wanted our chip in the side panel to respond to the changes in the application.
Our next step will be wiring. Wiring in simple is nothing but transferring the data from the application component to the CHIP. When the tag name on both the side is same wiring will be done automatically by the system.
In the previous post while creating the chip component we created the tag for the inport parameter with the name carrid. If we create a tag with the same name in the webdynpro application then the data from the application to the chip component will be transferred automatically.
To configure the tag in the webdynpro application, open the webdynpro application in the &sap-config-mode=X and do the following.
Right click on the field which is to be transported and select manage tags.
Add the tag with the same name carrid to enable the auto transport.
Close the window and open the webdynpro application in normal mode to test the application.
Requirement: Create a chip that provides information about the Airplanes.
The information about the airline carrier is available in the table SCARR. We need to create a webdynpro component that supply the information about the carrier and create a CHIP for it.
Step 1: Go to the Tcode SE80 and create a webdynpro component.
Assign the component to the package or save it in the local object.
Step 2: Go to the context tab of the component controller and create a context node for the table structure scarr.
Enter the name for the node and provide the dictionary structure as scarr and click on add attributes from the structure to add attributes.
Select all the attributes and press enter.
Context node will be created as below.
Step 3: Go to the methods tab of the component controller and create a method to fill the context node. Note : Method has to be an Interface method
Create an importing parameter for the method.
Write the following code inside the method.
DATA LO_ND_CARRIER TYPE REF TO IF_WD_CONTEXT_NODE. DATA LO_EL_CARRIER TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_CARRIER TYPE WD_THIS->ELEMENT_CARRIER.
LO_ND_CARRIER = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_CARRIER ).
LO_EL_CARRIER = LO_ND_CARRIER->GET_ELEMENT( ).
SELECT SINGLE * INTO LS_CARRIER
WHERE CARRID = IS_CARRIERS-CARRID.
STATIC_ATTRIBUTES = LS_CARRIER ).
Step 4: Go to the layout tab of the view controller and create the layout to display the airline details.
In the context tab of the view controller Drag and drop the context node from the component controller to view controllers context.
In the layout tab use the code wizard to create the form. Select the form and click on continue.
Specify the context node and press enter.
Arrange the layout and activate the whole component.
Step 5: Right click on the component and create a webdynpro chip for the component.
Usually we used to create an webdynpro application to run the component, instead of creating the webdynpro application we are creating the webdynpro chip which can be integrated in other application using page builder of side panel.
Enter the name for the chip and press enter.
Enter the display name and description for the chip. Remember the display name of the chip. This will be required while adding the chip to side panel.
Create a inport for the webdynpro component.
Select the interface method created and click on enter.
Port will be created as below.
Click on create parameter to create a parameter to the port.
Select the field carrid and press enter.
Click on show tag button to add a tag to the parameter and click on create to create the tag.
Enter the name of the tag as carrid.
Save the webdynpro CHIP.
We have now created the webdynpro chip.
CHIP stands for Collaborative human interface part and is introduced as a part of Netweaver 7 enhancement package 2.
A CHIP is an encapsulated, stateful piece of software application that provides a functionality which can be used in collaboration with Page Builder page or Side Panel.
All the available CHIPs are registered in the CHIP Catalog.
The chip model describes the capability of the CHIP. Technically a chip is nothing but a webdynpro component that implements a webdynpro component interface.
Chip consists of:
Port: Communication with the chip is implemented through special interface called Ports.
There are two kinds of Ports available in a CHIP.
Inports are used to receive information from other chips. Here you specify an importing parameter in which you get the data from the other chips or page builder or side panel. Typically inports are nothing interface method with importing parameters.
Outport is used to expose the internal status of the CHIP. Basically Outports are nothing but the interface event of the component.
Using wiring we can connect CHIPs so that they can interact with each other. Wiring between the two CHIPs is established via Outport of the sending chip and inport of the Receiving CHIP.
Tags can be assigned to the port and parameters of the port. Basically a tag is a string. If a same tag is available in the application and the CHIP then they are automatically connected through wiring and data is transported between them.