Select-options for date field.
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.
Similar Messages
-
i want give default values in select option for date (for a period)
I used
SELECT-OPTIONS y_s_mnth FOR y_v_dt_month default first to last OPTION BT.
first and last are dates.
I am getting error dialog box....specify ranges...
Please give sample code..Hi Suhas,
I hope this code will help you. Reward me if it is helpful.
select-options : y_s_mnth FOR sy-datum.
initialization.
y_s_mnth-sign = 'I'.
y_s_mnth-option = 'BT'.
y_s_mnth-low = sy-datum - 30. "first_day
y_s_mnth-high = sy-datum. "last_day
append y_s_mnth.
clear y_s_mnth.
Regards,
Sagar -
Search Help in Select - Options for Time field
Hi,
I have a select option which is a time field.
For date field the F4 help is automatically generated.
How to get F4 help for time field.
Regards,
RemoSelection-Options or normal field - it doesn't matter. There is no system delivered value help for a time field. This is documented in the online help:
There is no automatic F4 help for data element TIMS.
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/9f724642314aabe10000000a42189b/frameset.htm
You would have to create your freely programmed value help if you want something like the time value help available in the SAPGUI. -
Validation of Select Options for a field
Hi All,
I need to write a validation logic for a select option for VTWEG (Distribution Channel).
select-options: s_vtweg for komg-vtweg.
I need to check whether the user has entered the correct value based on the search help. The check table of this particular field is TVTW.
Following is the code i wrote under the AT SELECTION-SCREEN block:
IF NOT S_VTWEG-LOW IS INITIAL.
SELECT SINGLE VTWEG INTO KOMG-VTWEG FROM TVTW
WHERE VTWEG IN S_VTWEG.
IF SY-SUBRC NE 0.
CONCATENATE ' Please enter the correct
Distribution Channel '
Z_MSG INTO Z_MSG.
SET CURSOR FIELD 'S_VTWEG-LOW'.
MESSAGE E000 WITH Z_MSG.
ENDIF.
ENDIF.
It works fine when the user enters a wrong value in the S_VTWEG-LOW field, where as if i gives more than one wrong value in the range or giving individual values its not working. Let me know how to do the validation check for multiple values entered individually or in ranges.
Could you please suggest how to resolve this problem.
Thank You,
SureshYou could do something like this.....here looping at the select-option table and check the values for low and high.
report zrich_0003.
tables: komg.
data: z_msg(100) type c.
select-options: s_vtweg for komg-vtweg.
at selection-screen.
loop at s_vtweg.
if not s_vtweg-low is initial.
select single vtweg into komg-vtweg from tvtw
where vtweg = s_vtweg-low.
if sy-subrc ne 0.
concatenate ' Please enter the correct
distribution channel '
z_msg into z_msg.
set cursor field 'S_VTWEG-LOW'.
message e001(00) with z_msg.
endif.
endif.
if not s_vtweg-high is initial.
select single vtweg into komg-vtweg from tvtw
where vtweg = s_vtweg-high.
if sy-subrc ne 0.
concatenate ' Please enter the correct
distribution channel '
z_msg into z_msg.
set cursor field 'S_VTWEG-HIGH'.
message e001(00) with z_msg.
endif.
endif.
endloop.
Regards,
Rich Heilman -
How to create select-options for 3 fields out of 5 by FREE_SELECTIONS_INIT
Hi Experts,
I am using the Function Modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG to create the select-options dynamically on the selection screen.
My problem is that I am passing a field list of 10 fields in the FIELDS_TAB of the function.
Now it creates the select-options for all 10 fields. I want to create select-options for only 5 fields initially and let the user select out of the remaining 5 fields to create the select-options.
How to achieve this.?
I tried by passing the 5 fields in FIELDS_NOT_SELECTED table but they get hidden and once hidden I am not able to get them back in my field list.
Please help me out.
Useful answers will be suitably rewarded.
Thanks in advance.
Regards,
HimanshuHi Experts,
I am using the Function Modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG to create the select-options dynamically on the selection screen.
My problem is that I am passing a field list of 10 fields in the FIELDS_TAB of the function.
Now it creates the select-options for all 10 fields. I want to create select-options for only 5 fields initially and let the user select out of the remaining 5 fields to create the select-options.
How to achieve this.?
I tried by passing the 5 fields in FIELDS_NOT_SELECTED table but they get hidden and once hidden I am not able to get them back in my field list.
Please help me out.
Useful answers will be suitably rewarded.
Thanks in advance.
Regards,
Himanshu -
Select-options for input field
hi,
Is it possible to use 'Select-options' in web dynpro for the input field like we use in abap?
Ex. material is the input field. i want to select range also for this input field using 'Select-options'
I have tried only with ovs(f4 help) for the input field. can u pls tel me how to use if it is possible ?
Thanks,
Aishwarya.DATA: LT_RANGE_TABLE TYPE REF TO DATA,
RT_RANGE_TABLE TYPE REF TO DATA,
READ_ONLY TYPE ABAP_BOOL,
TYPENAME TYPE STRING. DATA: LR_COMPONENTCONTROLLER TYPE REF
TO IG_COMPONENTCONTROLLER,
L_REF_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
create the used component
L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).
IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
L_REF_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).
init the select screen
WD_THIS->M_HANDLER =
WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).
WD_THIS->M_HANDLER->SET_GLOBAL_OPTIONS(
I_DISPLAY_BTN_CANCEL = ABAP_FALSE
I_DISPLAY_BTN_CHECK = ABAP_FALSE
I_DISPLAY_BTN_RESET = ABAP_FALSE
I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).
*create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE(
I_TYPENAME = 'matnr' ).
add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(
I_ID = 'matnr'
IT_RESULT = LT_RANGE_TABLE
I_READ_ONLY = READ_ONLY ).
This is my code followed by saptechnical. but when i exec, am getting err like the type matnr is invalid. -
Reg:how disaplay selection range for date field
hi all
can you please let me know how to write the code in wdabap to display a date field with range option.i mean in abap we use at selection screen ,but coming to wdabap can you help how to write the code in wdabap.
Thanks in advance
DeepikaTo simplify the requirement, let me consider the followign understanding:
1. You need few fields in the selection screen. They need to be select options and some parameter fields.
2. The user clicks the button. You need to read teh user entered data.
Once, you have teh data in your code, assign it to the context node - attributes. later, you need to decide what you shoudl do with that data.
Sol: 1. To obtain fields into selection screen, use the component "wdr_select_options" and *** the interface view into your window. Make the view as default.
Now, you need to build the select options. Firstly create a method or insert the code in init().
DATA: lr_componentcontroller TYPE REF TO ig_componentcontroller,
l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
create the used component
l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
init the select screen
wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
wd_this->m_handler->set_global_options(
i_display_btn_cancel = abap_false
i_display_btn_check = abap_false
i_display_btn_reset = abap_true
i_display_btn_execute = abap_false ).
Adding a block (type Tray) to the select-options
wd_this->m_handler->add_block(
i_id = `BSC01`
i_block_type = if_wd_select_options=>mc_block_type_tray
i_title = `Selection Screen` ).
Adding a parameter field to the created block
Create a reference to the type of customer number KUNNR
CREATE DATA lr_field TYPE kunnr.
Sets the airline code initial value
ASSIGN lr_field->* TO <fs_field>.
Add the parameter to the group
wd_this->m_handler->add_parameter_field(
i_id = `KUNNR`
i_within_block = `BSC01`
i_obligatory = abap_true
i_value = lr_field ).
FREE lr_field.
Adding a select-options field to the created block
Create a reference to the material number range table
lr_field = wd_this->m_handler->create_range_table( `MATNR` ).
Add the select-option to the group
wd_this->m_handler->add_selection_field(
i_id = `MATNR`
i_within_block = `BSC01`
it_result = lr_field ).
FREE lr_field.
The code with method "set_global_options" is used to make the buttons visible or disappear.
Its convinient to create your own button with an action instead or subscribing to the action of exceute button.
Sol. 2: Read the data.
FIELD-SYMBOLS:
<fs_sel_item> LIKE LINE OF lt_sel_item,
<fs_kunnr> TYPE kunnr,
<fs_matnr> TYPE ranges_matnr.
wd_this->m_handler->get_value_of_parameter_field(
EXPORTING i_id = 'KUNNR'
RECEIVING r_value = p_kunnr ).
Get the selection-screen items
wd_this->m_handler->get_selection_fields(
IMPORTING et_fields = lt_sel_item ).
Retrieve the values from the select-options items
LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.
CASE <fs_sel_item>-m_id.
WHEN `MATNR`.
ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_matnr>.
WHEN < Other sel-option'
ENDCASE.
ENDLOOP.
Obtain a reference to your context node and assign the field symbols to the attributes.
Finally, you would have the data in your nodes. Now, you need to handle the coe as per your req.
Regards,
Sharath
Edited by: Sharath M G on Aug 27, 2010 9:45 AM -
Multiple select options for an input field
Hi All,
We have a requirement where in we need to provide multiple select options for an input field in a BSP application and get output relevant to all the given inputs(do not require range).
Please do let me know how to solve this.
Thanks & Regards,
Lavanya .Hi,
The requirement is : Suppose there is a input field PLANT.
If we give input for plant it gives related output.
Now if it is required to give 5 or 6 inputs..like plant1,plant2...plant6 and get the output related to all 6 inputs.
(Like we implement in ABAP)
Please do let me know how can this be implemented in BSP.
Thanks & Regards,
Lavanya. -
Restrict Select-Options for Logical Database field
The way we restrict select options for custom defined select option fields on selection screen.. can we restrict select options for standard Logical Database fields?
i.e. report uses PNPCE logical database and has field called PERNR. I want to restrict select options for this PERNR field so that it has options for 'Select single values' only.
Thanks,
Falguni
Edited by: Falguni V on Nov 13, 2010 6:42 AMYou can user AT SELECTION-SCREEN event, and check whether any record is having high value for PNPPERNR.
-
Selection options for field display text instead of key
Hi All,
In the selection screen in my reports, when the user clicks on the selection options for one the fields to display the possible values they can use. Instead of the key the pop up box only displays the text for that field. This is an issue because one of the fields is equipment number and the user needs to be able to see the key not the descriptions. This is occurring in multiple reports and for multiple fields. I haven't been able to find anything in the infoobject properties or the query properties to change this.
Please help!
Edited by: Anthony Loh on Sep 29, 2010 10:57 PMHi Anthony,
Cud u pls check in backend how it is created ...
RSA1>Mdeling>IO Properties>Second tab BEx properties>Display-->it shud be Key and not text...
Check this and come back ..
Rgds
SVU123 -
Select option for selection valid and invalid data.
Hi All,
Any one pleas help in validating following case :-
In the selection screen there is a select option for equipment number like EQUI-EQUNR
if any user will give wrong equipment no. It will generate an error message from the range of equipment no.
and put it to an internal table it error.
and if any value in between the select option(equipment no) is correct then that value I need to proceed for some other logic.
Iu2019d appreciate if some one help me in generation code for the above case or logic.
ThanksHi,
Use FM 'RS_REFRESH_FROM_SELECTOPTIONS'
DATA: RSPAR TYPE STANDARD TABLE OF RSPARAMS.
REFRESH RSPAR.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = 'prog name'
IMPORTING
SP =
TABLES
SELECTION_TABLE = RSPAR
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000.
ENDIF.
In table parameter you ll get the all entries entered .
Check out the values with respective tables.If value is not correct tk it into internal table
else proceed ahead. You can Remove incorrect entries this way.
regards,
ajit. -
Any ideas on which data element to be used for select-options for timestamp on the screen so that a user is able to f4 help too.
i am using data element 'tzntstmps' but i am not getting f4 help for it.Hello Trivenn
I do not think it makes sense to search for any other timestamp data element which might be part of a search help.
TZNTSTMPS = UTC Time Stamp in Short Form (YYYYMMDDhhmmss)
How could such a search help look like? A calendar control combined with some kind of "time control"?
You may facilitate the entry of time stamps in such a way that if the user enters only a date in the LOW field (e.g. 20080422 without time) you change it AT SELECTION-SCREEN (PBO of your selection screen to 20080422000000).
Correspondingly, you change a date value (e.g. 20080422) at the HIGH field into 20080422235959).
If, however, the user enters already a complete timestamp you do not change anything.
Regards
Uwe -
Requirement to maintain select-options for multiple fileds in webdynpro aba
Hello Gurus,
We have a requirement to maintain select-options for multiple fileds in webdynpro abap.
now we are able to create select-options for a single field using wdr_select_options componet usage.
how can we achive this select-options feature for multiple fields.
Could anyone please suggest solutions?
and if possible send me the sample code for this requirement.
Thanks in Advance for your replies.
Regards,
ShyamHi,
Nothing different for more fields, same. some declaration changes.
For example code i am using.. in WDDOINIT method.
TYPES:
fiscal_year TYPE RANGE OF GJAHR,
S_KUNNR TYPE RANGE OF J_3RS_KUNNR,
S_VKORG TYPE RANGE OF VKORG_RAN,
status type PVWTY-RETPA,
ty_r_date TYPE RANGE OF s_date,
ty_s_date TYPE LINE OF ty_r_date.
DATA lo_interfacecontroller TYPE REF TO iwci_wdr_select_options .
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_cmp_sel_opt( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* Reference variable used instantiate the select-options component
DATA
lr_cmp_usage TYPE REF TO if_wd_component_usage.
* Variables used to create the select-options fields and
* define its initial values
DATA:
lr_field TYPE REF TO data,
ls_date TYPE ty_s_date.
FIELD-SYMBOLS:
<fs_field> TYPE ANY,
<fs_range> TYPE INDEX TABLE.
* Instantiate the select-options component
lr_cmp_usage = wd_this->wd_cpuse_cmp_sel_opt( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_cmp_sel_opt( ).
wd_this->m_sel_opt = lo_interfacecontroller->init_selection_screen( ).
data : vhelp type wdy_md_value_help_mode_enum .
* Sets the helper reference
wd_this->m_sel_opt1 = wd_this->wd_cpifc_cmp_sel_opt( ).
wd_this->m_helper = wd_this->m_sel_opt1->init_selection_screen( ).
* Hide the standard select-options components.
wd_this->m_helper->set_global_options(
i_display_btn_cancel = abap_false
i_display_btn_check = abap_false
i_display_btn_reset = abap_false
i_display_btn_execute = abap_false
lr_field = wd_this->m_helper->create_range_table( `KUNNR` ).
wd_this->m_helper->add_selection_field(
i_id = `KUNNR`
I_DESCRIPTION = 'Customer Code'
* i_within_block = `BL01`
it_result = lr_field ).
FREE lr_field.
lr_field = wd_this->m_helper->create_range_table( `VKORG` ).
wd_this->m_helper->add_selection_field(
i_id = `VKORG`
I_DESCRIPTION = 'Sales Organization'
* i_within_block = `BL01`
it_result = lr_field ).
FREE lr_field.
Go through this..
http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-Complexselect-optionscomponent+usages
Cheers,
Kris. -
When we give wildcard for date field
can we give wild card for date field in range table.
my code is this
RAnges r_erdat for mara-erdat
r_erdat-sign = 'I'.
r_erda-option = 'CP'.
r_erdat-low = '2009'.*
append r_erdat.
select erdat from mara
INTO CORRESPONDING FIELDS OF TABLE itab
where erdat
in
r_erdat.
Moderator Message: Basic date questions are not allowed.
Edited by: kishan P on Oct 5, 2010 10:46 AM<<Don't answer questions that break the rules. Date questions are not permitted>>
Hi,
Instead you can take the entire range for that particular year.
r_erdat-sign = 'I'.
r_erda-option = 'BT'.
r_erdat-low = '20090101'. <- begin date
r_erdat-high = '20091231'. <- end date
append r_erdat.
Regards,
Srini.
Edited by: Matt on Oct 5, 2010 12:46 PM -
How to make select-option for one inner table
Hi,
Who can teach me to make select-option for a inner table, which let select-option display data from this inner table.
Thanks in advance.Is this what you are looking for?
report zrich_0002.
data: begin of itab occurs 0,
matnr type mara-matnr,
spras type makt-spras,
maktx type makt-maktx,
end of itab.
select-options: s_matnr for itab-matnr.
select-options: s_spras for itab-spras.
start-of-selection.
select mara~matnr makt~spras makt~maktx
into corresponding fields of table itab
from mara
inner join makt
on mara~matnr = makt~matnr
where mara~matnr in s_matnr
and makt~spras in s_spras.
check sy-subrc = 0.
Regards,
Rich Heilman
Maybe you are looking for
-
K7N2 Delta-ILSR - USB to Serial Adapter Doesn't Work!
Is anyone aware of an error such as the follows with the K7N2 Delta-ILSR? I am trying the use a USB to Serial Adapter, namely the a Prolific PL-2303. However, my PC does not seem to like it, nor does it what to cooperate with it at all. On one occasi
-
Ipod recognized by windows, not in itunes (multiple computers)
4th gen ipod click wheel + windows 2003 server w/ firewire and/or Vista notebook w/ USB + itunes 7.1. Both of my Windows machines see the ipod fine. I made sure there are no drive letter conflicts. Itunes just never recognizes the ipod. Strangely, if
-
Export datas to Excel (Using Web Utilities)
Hi, This is the procedure to export the datas from Data Block to the excel sheet. It woks fine in the client-server arch (by replaceing CLIENT_OLE2 with OLE2). But i need to execute in Appication Server Arch. so I prefixed "CLIENT_" , but it is not w
-
Dear Gurus, I created a Master Data (MD)u2018testmrtu2019 via MM01 in our DEV environment. Now I want to transfer it into QAS environment via ALE mode. (The ALE configuration work was done.) The MD was successfully sent from DEV via BD10. (The light
-
D800 Timelapse Problem in Aperture
I just shot my first in camera timelapses using a D800. I imported them into Aperture 3.4.3 and everything was fine. I even exported one with no problems. Then I backuped to my vault, and when it was finished, all my timelapses and a ver of the vi