Skip to Content

Scenario: Provide the freely programmed search help to the attribute CARRID. Design a webdynpro component that provides the list of possible airline ID and use that component to provide search help for the attribute CARRID.

Steps to design a Search Help component:

Step 1: Go to the TCode SE80 and create a webdynpro component.

1

Assign the component to the package or save it in the local object.

Step 2: Add the interface IWD_VALUE_HELP to the component and re-implement the interface.

2

Step 3: After re-implementing the interface a window will be created in the component with the name WD_VALUE_HELP. Main view created at the time of creation of component will be embedded in the default window created at the time of creation of component. For our main view to be displayed as the f4 help it need to be embedded to the window WD_VALUE_HELP.

3

4

Step 4: Create an attribute value_help_listener in the attributes of the component controller to get the object reference of the search help.

5

SET_VALUE_HELP_LISTENER is the method that will import the object reference of the search help interface.  Write the following code inside the method.

6

Step 5: Go to the context tab of the view controller and create a context node with cardinality 0..N as shown below.

7

Step 6: Fill the values for the context node in the doinit method of the view controller.

8

Step 7: In the layout tab of the view controller create the table UI element and bind it to the context node.

9

Step 8: Create a Button UI element Ok and create an action for it.

10

Step 9: In the event handler method created for the Button UI element. Write the following code to transport the data selected from the search help component to the component from where the F4 help is being triggered.

11

Code:

DATA : LO_LISTENER TYPE REF TO IF_WD_VALUE_HELP_LISTENER,
LV_NAME TYPE STRING,
LO_ND_SFLIGHT TYPE REF TO IF_WD_CONTEXT_NODE,
LO_EL_SFLIGHT TYPE REF TO IF_WD_CONTEXT_ELEMENT,
LS_SFLIGHT TYPE WD_THIS->ELEMENT_SFLIGHT.

* Getting the lead selected record

LO_ND_SFLIGHT = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_SFLIGHT ).

LO_EL_SFLIGHT = LO_ND_SFLIGHT->GET_ELEMENT( ).

LO_EL_SFLIGHT->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = LS_SFLIGHT ).

* Getting the object reference of interface for search help

LO_LISTENER = WD_COMP_CONTROLLER->VALUE_HELP_LISTENER.

* Gives the name of the attribute from where F4 help is triggered

LV_NAME = LO_LISTENER->F4_ATTRIBUTE_INFO-NAME.

* Set the selected value in the attribute

LO_LISTENER->F4_CONTEXT_ELEMENT->SET_ATTRIBUTE( NAME = LV_NAME
VALUE = LS_SFLIGHT-CARRID ).

* Instruct to close the Pop up window

WD_COMP_CONTROLLER->VALUE_HELP_LISTENER->CLOSE_WINDOW( ).

Save and activate the whole component.  We have now created the component that can be used to provide the search help for the carrid field.

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply