on 04-02-2008 6:44 AM
Hi all,
i need to give select options for Date field.How can i give that.
Thanks & Regards
Ravi.
Hi Ravi,
Use the Component WDR_SELECT_OPTIONS to include select options in Web Dynpro ABAP. Follow these steps:
1. In your Component , "Used Componet" tab add Component WDR_SELECT_OPTIONS . Component Use can be any name that you want to give, eg SELECT_OPTIONS
2. Go to the View where you want to include the Date Select Options. I am assuming that you already have an Attribute of Type DATS in your context.
3. View: Properties Tab:Create Controller Usage and select
SELECT_OPTIONS WDR_SELECT_OPTIONS
SELECT_OPTIONS WDR_SELECT_OPTIONS INTERFACECONTROLLER
4. View Layout Tab:Include a View Container. In this view container we will show the Date Select Options.
5. View Attributes Tab: Create Following two attributes:
M_HANDLER type IF_WD_SELECT_OPTIONS
M_WD_SELECT_OPTIONS type IWCI_WDR_SELECT_OPTIONS
6: View Methods Tab: Create a method eg CREATE_SELECTION_SCREEN. Call this method in the WDDOINIT of the view.
7:CREATE_SELECTION_SCREEN: Write following Code:
* Data Declaration
data:
lt_range_table TYPE REF TO DATA.
data:
lr_componentcontroller TYPE REF TO IG_COMPONENTCONTROLLER,
lr_componentusage TYPE REF TO IF_WD_COMPONENT_USAGE.
* Execution
* Create Used Component
lr_componentusage = wd_this->wd_cpuse_select_options( ).
if LR_COMPONENTUSAGE->HAS_ACTIVE_COMPONENT( ) is initial.
lr_componentusage->create_component( ).
endif.
* Get pointer to interface controller of select options
wd_this->M_WD_SELECT_OPTIONS = wd_this->wd_cpifc_select_options( ).
* initialize selction screen
wd_this->M_HANDLER = wd_this->M_WD_SELECT_OPTIONS->init_selection_screen( ).
* Create Range Table for: Date
CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
EXPORTING
I_TYPENAME = 'DATS'
RECEIVING
RT_RANGE_TABLE = lt_range_table.
* Add Selection Field for: Date
CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
EXPORTING
I_ID = '<name of date attribute in the context>'
* I_WITHIN_BLOCK = MC_ID_MAIN_BLOCK
* I_DESCRIPTION =
* I_IS_AUTO_DESCRIPTION = ABAP_TRUE
IT_RESULT = lt_range_table
* I_OBLIGATORY = ABAP_FALSE
* I_COMPLEX_RESTRICTIONS =
* I_USE_COMPLEX_RESTRICTION = ABAP_FALSE
* I_NO_COMPLEX_RESTRICTIONS = ABAP_FALSE
* I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
* I_VALUE_HELP_ID =
* I_VALUE_HELP_MODE =
* I_VALUE_HELP_STRUCTURE =
* I_VALUE_HELP_STRUCTURE_FIELD =
* I_HELP_REQUEST_HANDLER =
* I_LOWER_CASE =
* I_MEMORY_ID =
* I_NO_EXTENSION = ABAP_FALSE
* I_NO_INTERVALS = ABAP_FALSE
* I_AS_CHECKBOX = ABAP_FALSE
* I_AS_DROPDOWN = ABAP_FALSE
* IT_VALUE_SET =
* I_READ_ONLY = ABAP_FALSE
* I_DONT_CARE_VALUE =
* I_EXPLANATION =
I_TOOLTIP = 'Select Date'.
8: To Fetch Data entered in the selection field, write following code on action of button click:
data:
lt_date type REF TO DATA.
FIELD-SYMBOLS:
<fs_date> TYPE table.
* retrieve Date from Select Options
CALL METHOD WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
EXPORTING
I_ID = '<attrib_name>'
RECEIVING
RT_RANGE_TABLE = lt_date.
* assign Date Field Symbol
ASSIGN lt_date->* to <fs_date>.
9: Windows Window Tab: In the View Conatiner, embed the WND_SELECTION_SCREEN view from SELECT_OPTIONS component Usage of WDR_SELECT_OPTIONS component.
Regards,
Reema.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.