We create a WD component that offers complex possibilities to search for a candidate.To be able to use these complex search possibilities,we have used the WDR_SELECT_OPTIONS component.
Figure shows the WD component structure and the usage definition.
The WD component structure
We create,in Context view,the node PERSON with the samestructure (Cardinality 0...n, dictionary structure YPERSON, Singleton, without supply function).
In View Layout,we have to insert a View Container UIElement required to integrate the interface view WND_SELECTION_SCREEN of the Select Option component.Besides this UI element, we need a Button and a Table UI element.
Context view and view layout
How to define the usage
We create two attributes: M_HANDLER type ref to IF_WD_SELECT_ OPTIONS and M_WD_SELECT_OPTIONS type ref to IWCI_WDR_SELECT_ OPTIONS.
We use the wdDoInit Hook method to instantiate the used component WDR_SELECT_OPTIONS,in order to dynamically create a range table and to add a selection screen Field.
The wdDoInit Hook methodMETHOD wddoinit .
By using the method INIT_SELECTION_SCREEN of the IWCI_WDR_SELECT_OPTIONS interface,we initialize the selection screen.After this,we use the method CREATE_RANGE_TABLE of the IF_WD_SELECT_OPTIONS
interface to dynamically create a Range Table.This method has three importingparameters: I_TYPENAME type STRING,I_LENGTH type I,I_DECIMALStype I and a returning parameter RT_RANGE_TABLE type ref to data.The I_TYPENAME is not optional;we use it to specify the data element for the LOW and HIGH component. The ID_PERSON has the data type YIDI.
Database table YPERSON
A Range Table has four components: SIGN,OPTION,LOW and SCREEN. It can be also created in the ABAP Dictionary,as special type of table types.
The method ADD_SELECTION_FIELD of the IF_WD_SELECT_OPTIONSinterface adds an additional Field to the Selection Screen. This method has many parameters, but only one is mandatory – I_ID.We have used the:
When the user presses the Search button,the Framework triggers the event handler method onactionsearch.
The onactionsearch event handler methodMETHOD onactionsearch .
The method GET_RANGE_TABLE_OF_SEL_FIELD of the IF_WD_ SELECT_OPTIONS interface has an importing parameter I_ID,of STRING type,and returns the range table for the Selection Field – rt_range_table generic type data.We define a field symbol typified as ANY TABLE and we generically dereference the data reference variable typed with data into our field symbol,through the dereferencing operator“->*”.
After this, we select all the records that correspond to our search and pass these values in the corresponding attributes of the context node PERSON.We have to embed the interface view WND_SELECTION_SCREEN into the ViewContainerUIElement.Now we are ready to run our application.
Embedding the view interface WND_SELECTION_SCREEN
In default mode,Select Option is the interval between two values,but we can also use other Select options.
As we have seen,the component WND_SELECTION_SCREEN offers four buttons to provide four functions:
We can hide one of these buttons by using the method SET_GLOBAL_OPTIONS of the IF_WD_SELECT_OPTIONS interface.
This method has four mandatory parameters of ABAP_BOOL type.
The SET_GLOBAL_OPTIONS parameters
We want to extend our example,by hiding the buttons CANCEL, RESET,COPY and using the CHECK button to trigger the event handler method on_check.In this case,we don’t use our Search button.We implement the code in the on_check event handler method.
First, we must use,in the wdDoInit Hook method,the SET_GLOBAL_OPTIONS.
The wdDoInit Hook methodMETHOD wddoinit .
After this,we create an event handler method named on_check and we register to the ON_CHECK event in the WDR_SELECT_OPTIONcomponent.This event is triggered when the user clicks the CHECK button.
Registering to the ON_CHECK event
We copy the entire coding from the onactionsearch event handler method in the on_check event handler method, and then we can run our application.
To create more than one selection screens Field,we have to create,into the wdDoInit Hook Method,as many range tables as many screen Fields we need,and then we have to extend the event handler method to be able to select the desired data.
SAP ABAP Web Dynpro Related Tutorials
|SAP ABAP Tutorial|
SAP ABAP Web Dynpro Related Interview Questions
|SAP ABAP Interview Questions||SAP ABAP Web Dynpro Interview Questions|
|Sap Abap Hr Interview Questions||SAP ABAP Dictionary Interview Questions|
|SAP ABAP Enhancement Interview Questions||SAP ABAP Module Pool Interview Questions|
|SAP ABAP Report Developer Interview Questions||SAP ABAP Data Dictionary Interview Questions|
|SAP ABAP ALV Reports Interview Questions|
Sap Abap Web Dynpro Tutorial
Sap Easy Access
Designing A Web Dynpro Component
Context Nodes And Attributes At Design Time
Data Binding, Context Mapping And Interface Methods
View Controller Methods
Layout Ui Elements
User Interface Elements (ui Elements) Static And Dynamic Programming
Messages, Exceptions And Web Dynpro Abap
Writing Multilanguage Applications
Alv And Select Options
Integrating A Web Dynpro Application Into The Sap Netweaver Portal
Web Dynpro And Authorization
Web Dynpro Mind Map
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.