Making to-field in select-option mandatory
hi experts
I defined an OBLIGATORY select-option with no-extension option. but the user wants not only the "from" field is OBLIGATORY but also the "to" filed.
I know I can do it if I define 2 parameters in the same line. but is there any other option if using select-option
many thanks
Edited by: Thomas Zloch on Nov 4, 2010 9:54 AM - subject changed
Use the FM [SELECT_OPTIONS_RESTRICT|http://www.sdn.sap.com/irj/scn/advancedsearch?query=select_options_restrict#sdn_content_category_value_wiki] in the initialization of the report, and only allow "I/BT" records types.
FORM restrict_select.
* Local data
DATA: restrict TYPE sscr_restrict,
opt_list TYPE sscr_opt_list,
*** TYPE sscr_***.
* Create Options
* - Option ALL : any selection allowed
CLEAR opt_list.
MOVE 'ALL' TO opt_list-name.
MOVE 'X' TO: opt_list-options-bt,
opt_list-options-cp,
opt_list-options-eq,
opt_list-options-ge,
opt_list-options-gt,
opt_list-options-le,
opt_list-options-lt,
opt_list-options-nb,
opt_list-options-ne,
opt_list-options-np.
APPEND opt_list TO restrict-opt_list_tab.
* - Option RNG only ranges of values
CLEAR opt_list.
MOVE 'RNG' TO opt_list-name.
MOVE 'X' TO: opt_list-options-bt.
APPEND opt_list TO restrict-opt_list_tab.
* Affect Options to actual select-options
* - ALL by default
CLEAR ***.
MOVE: 'A' TO ***-kind,
'*' TO ***-sg_main,
'ALL' TO ***-op_main.
APPEND *** TO restrict-***_tab.
* RNG to a single select-option
CLEAR ***.
MOVE: 'S' TO ***-kind,
'SO_FIELD' TO ***-name,
'I' TO ***-sg_main,
'RNG' TO ***-op_main.
APPEND *** TO restrict-***_tab.
* Execute
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = restrict
EXCEPTIONS
OTHERS = 0.
ENDFORM. " restrict_select
Regards,
Raymond
Similar Messages
-
How to make Select Options Mandatory?
Hi Guys,
Can anybnody tell me how to Declare Selection Options for some of them mandatory.
Select-Options : v_PurOrg for EKKO-EKORG default '2000',
v_GRDate for Sy-Datum ,
v_GRPrd for MSEG-GJAHR.
In these i have to make v_PurOrg Manadatory.
Thanks,
Gopi.Hi Gopi,
In order to make select-options mandatory we add OBLIGATORY in the statement like the below.
Selection-Screen.
Select-Options : v_PurOrg for EKKO-EKORG default '2000' OBLIGATORY.
In this case, only the first option will have the default value of 2000.But if you want both the options low and high of select-options, means you have to add the below code in your program in the initialization event.
Initialization.
v_PurOrg-low = 1000.
v_PurOrg-high = 2000.
append v_PurOrg.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa -
Innput field with Select option on custom screen
Hi,
I need to create an Input field with Select Option(No interval) button on Custom dialog screen .
Is there any idea how can I create it on screen ?
Thanks
Sachincreate a normal inputfield and place an icon next to it. then in the pai on click of that button use the following code.
data: wf_tab_field like rstabfield occurs 0 with header line ,
wf_exl_opt like rsoptions .
refresh: wf_tab_field .
move: 'KOSTL' to wf_tab_field-fieldname ,
'CSKS' to wf_tab_field-tablename .
append wf_tab_field .
clear wf_tab_field .
move: 'X' to wf_exl_opt-bt ,
'X' to wf_exl_opt-cp ,
'X' to wf_exl_opt-ge ,
'X' to wf_exl_opt-gt ,
'X' to wf_exl_opt-le ,
'X' to wf_exl_opt-lt ,
'X' to wf_exl_opt-nb ,
'X' to wf_exl_opt-np .
call function 'COMPLEX_SELECTIONS_DIALOG'
exporting
title = 'Select Cost Centers'
text = 'Cost Center'
* SIGNED = 'X'
* LOWER_CASE = ' '
* NO_INTERVAL_CHECK = ' '
* JUST_DISPLAY = ' '
* JUST_INCL = ' '
excluded_options = wf_exl_opt
* DESCRIPTION =
help_field = 'CSKS-KOSTL'
* SEARCH_HELP = 'KOST'
tab_and_field = wf_tab_field
tables
range = r_kostl
exceptions
no_range_tab = 1
cancelled = 2
internal_error = 3
invalid_fieldname = 4
others = 5
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
if not r_kostl[] is initial .
read table r_kostl index 1 .
if sy-subrc eq 0 .
move: r_kostl-low to wf_t_kostl .
endif .
endif .
wf_t_kostl is the screen field name.
Raja -
User Exit for making the field Bill of Lading Mandatory in Delivery
Please suggest an User Exit for making the field Bill of Lading Mandatory in the Delivery document when we create an inbound delivery.
Hi,
I'm not sure, pls check these
USEREXIT_SAVE_DOCUMENT_PREPARE
EXIT_SAPLV46H_001
NOTIF_EVENT_SAVE
thanks
Mohanprabu C -
Hi,
I have a select option on the selection screen which i have made mandatory.
I want to enter the values directly through multiple selection and not on the single field, but when i click on the multiple selection option, it is giving me error to fil the mandatory field first before going to the multiple selction.
Regards,
SonikaDont make it mandatory..
U can do like this.
Start-of-selection.
if (Name of selection option) is initial.
message s(102) (Here give msg like: it is mandatory to fill this field).
leave list-processing.
endif.
Regards,
Nishant -
Making a field in selection screen dynamic mandatory
I have a parameter in the select option of a selection screen. The code is below:
TABLES:vbak,kna1,ekko,lfa1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS: rd1 RADIOBUTTON GROUP rd DEFAULT 'X' USER-COMMAND abc,
rd2 RADIOBUTTON GROUP rd,
rd3 RADIOBUTTON GROUP rd.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS:s_erdat FOR VBAK-ERDAT MODIF ID SAL,
s_vbeln FOR VBAK-VBELN MODIF ID SAL,
s_kunnr FOR KNA1-KUNNR MODIF ID SAL.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS:p_aedat FOR EKKO-AEDAT MODIF ID PUR,
p_ebeln FOR EKKO-AEDAT MODIF ID PUR,
p_lifnr FOR EKKO-AEDAT MODIF ID PUR.
SELECTION-SCREEN END OF BLOCK b3.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rd1 EQ 'X'.
IF SCREEN-GROUP1 = 'SAL' OR SCREEN-GROUP1 EQ 'PUR'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
IF rd2 EQ 'X'.
IF SCREEN-GROUP1 EQ 'PUR'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
IF rd3 EQ 'X'.
IF SCREEN-GROUP1 EQ 'SAL'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
Now the parameters s_erdap & _aedat should both be dynamic mandatory. How this can be achieved?Hi,
This can be done in two ways:
1.
At selection-screen output.
loop at screen.
IF rd1 EQ 'X'.
if screen-name = 's_erdat-low' or screen-name = 'P_AEDAT'.
screen-required = 1.
modify screen.
endif.
endif.
endloop.
the above code would make the lower value in select-option s_erdat and parameter p_aedat mandatory.
2.
at selection-screen.
if rd1 eq 'X'.
if s_erdat is initial.
message 'PLease enter date'.
endif.
endif.
The above will fire an error when you hit execute and the rd1 is choosen and date is not entered
Himanshu -
Search help for A field in select option which doesnt have search help in c
u have table in QM which is QMFE in whihc field FECOD which doesnt have search help , but my requirement is that in select option in report to have users to see its search help, anyone there to help me
Hi sridhar loganathan,
For this goto SE11 and create a ZFECOD Search help for that field. In Defination Tab enter table name
QMFE and Enter Z_F4_FECOD_EXIT in Search help Exit.
Then create a FM in SE37 as Z_F4_FECOD_EXIT under a FG. And then write code as follows for example:
FUNCTION Z_F4_REG_EXIT.
""Local Interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" VALUE(SHLP) TYPE SHLP_DESCR_T
*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
TYPES: begin of ty_code,
dam_code type QMFE-FECOD ,
end of ty_code.
DATA : tw_code type ty_code,
ta_code type table of ty_code.
IF "callcontrol-step <> 'SELONE' AND
callcontrol-step <> 'SELECT' AND
callcontrol-step <> 'DISP'.
EXIT.
ENDIF.
IF callcontrol-step = 'SELECT'.
CALL FUNCTION 'F4UT_PARAMETER_ALLOCATE'
EXPORTING
PARAMETER = 'FECOD'
TABLES
SHLP_TAB = shlp_tab
RECORD_TAB = record_tab
CHANGING
SHLP = shlp
CALLCONTROL = callcontrol
EXCEPTIONS
OTHERS = 3.
ENDIF.
IF callcontrol-step = 'DISP'.
Get the Region
CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET'
EXPORTING
PARAMETER = 'FECOD'
FIELDNAME = 'FECOD'
TABLES
SHLP_TAB = shlp_tab
RECORD_TAB = record_tab
RESULTS_TAB = ta_code
CHANGING
SHLP = shlp
CALLCONTROL = callcontrol
EXCEPTIONS
PARAMETER_UNKNOWN = 1
OTHERS = 2.
IF SY-SUBRC = 0.
SORT TA_CODE BY DAM_CODE.
Deleting duplicate damage codes in Internal Table ta_code
DELETE ADJACENT DUPLICATES FROM TA_CODE COMPARING DAM_CODE.
Passing changed Internal table to FM
CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
EXPORTING
PARAMETER = 'REGION'
FIELDNAME = 'REGION'
TABLES
SHLP_TAB = shlp_tab
RECORD_TAB = record_tab
SOURCE_TAB = ta_code
CHANGING
SHLP = shlp
CALLCONTROL = callcontrol
EXCEPTIONS
PARAMETER_UNKNOWN = 1
OTHERS = 2.
ENDIF.
ENDIF.
ENDFUNCTION.
Revert me for any clarifications.
Regards,
Suneel G. -
F4 help for PO number field with SELECT OPTIONS
Hi all,
I have a field (PO no) using SELECT OPTIONS on my selection screen.I need F4 help for this field.How shud i declare it?
I have declared it as follows:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
select-options sel_po for ZPO_LOI-zobject_id obligatory .
SELECTION-SCREEN END OF BLOCK b1.
ZPO_LOI is a table view with a z data element ZOBJECT_ID to which i have attached a search help which displays the required values for the PO field in the selection screen.But now the problem is i cant see the F4 icon for the field on the sel screen.
Please help.Hi I have a sapmle code for this.
*& AT SELECTION SCREEN ON VALUE REQUEST
*-- F4 help for IDOC numbers
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_docnum-low.
PERFORM value_request_status USING 'S_DOCNUM-LOW'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_docnum-high.
PERFORM value_request_status USING 'S_DOCNUM-HIGH'.
*& Form value_request_status
text
-->fp_field dynpro field that gets the return value
FORM value_request_status USING fp_field TYPE dynfnam.
STATICS tl_values TYPE STANDARD TABLE OF tp_value.
IF tl_values IS INITIAL.
SELECT docnum FROM edidc UP TO 500 ROWS INTO TABLE tl_values
WHERE credat IN s_credat
AND cretim IN s_cretim.
IF sy-subrc eq 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'DOCNUM'
dynpprog = syst-repid
dynpnr = syst-dynnr
dynprofield = fp_field
value_org = 'S'
TABLES
value_tab = tl_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc IS NOT INITIAL.
MESSAGE i999(zz) WITH 'No values found'(004).
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " value_request_status
Regards,
Amit. -
"WHERE field IN select-options" alternative
I currently have a report that uses
SELECT-OPTIONS so_num FOR qmih-qmnum.
SELECT * FROM qmih INTO TABLE t_qmih
WHERE qmnum IN so_num.
Now, this works fine unless the user selects a large number of individual items in the select options, e.g. 7,000 individual qmnums, in which case I get an ABAP error.
The dump contains the following helpful information:
How to correct the error
The SAP Open SQL statement must be divided into several smaller units.
If the problem occurred due to the use of an excessively large table
in an IN itab construct, you can use the addition FOR ALL ENTRIES
instead.
When you use this addition, the statement is split into smaller units
according to the restrictions of the database system used.
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
Could anyone give me an idea of how I could fix this?Hi Chandrasekhar,
very interesting statement but not necessarily correct.
Select-options declares a range-type internal table with header line. The number of table rows is limited by the system memory storage available.
Oracle database has a fixed limit of 32KB for the length of the select statement. The open SQL database interface will resolve the range table resulting in the right number of comparison expressions.
If the user puts too many values into select-options, he will probably copy single values which are represented by SIGN = 'I' and OPTION = 'EQ'.
Try this (example):
select-options:
s_matnr for mara-matnr.
data:
lt_value like hashed table of s_matnr-low with unique key table_line. "avoid duplicates
fiels-symbols:
<any> type any,
<value> type any.
loop at s_matnr assigning <any>
where sign = 'I' and option = 'EQ'.
assign component 'LOW' of structure <any> to <field>.
insert <field> into table t_value.
delete s_matnr.
endloop.
select ...
into table ...
from ...
for all entries in lt_value
where matnr = lt_value-table_line.
if lines( s_matnr ) > 0.
select ...
appending table ...
from ...
where matnr in s_matnr.
endif.
Now you've got them all.
Regards,
Clemens -
Finding a field in select options
I am using select options WD component in my WD component. I have added some fields in the select options component using add_selection_field method.
Is there any method using which I can check if i give an id of a particular field, the method should return if the field with that id already exists or not.
Thanks,
ReenaHi Reena,
just go thru this thread, you may goet some useful infm regarding your query. I m noty sure but just go thru it once
WD ABAP - Search help using Selection-options
thnks -
Controlling the space between label and Input field in SELECT-OPTION
Hi ,
I am using WDR_SELECT_OPTIONS as a used component in order to dynamically generate the Select option in my WD Component.
Can any one tell me if there is a way to control the spacing between Label and Input field? This is because rest of the UI elements are in one particular order but for this dynamically generated UI.
Please help me.
Thanks,
KavithaHi Kavitha,
The label is required for accessibility reasons. It's not possible to remove it and to use your own label from outside the component to point to it. Labels cannot point to targets across views (and hence acress component) boundaries.
Best regards,
Thomas -
Hide Selection Field in Select-Option
Hi,
Is there any way to hide a selection field (not to delete and not to set as read only) in select-option component?
AviadHi,
I have several fields on the select-option view.
One of those fields has a search help attached to it.
The search-help needs additional data in order to filter unwanted results.
If I add two more fields to the select-option view and bind them using the search-help structure (in all three fields) I can see only the desired results.
The user, on the other hand, dos not need to see the additional fields, so I wish to hide them.
Aviad -
Include a field in selection options
Hi,
In my selection screen i want an output like this...
a _______ to ________
b _______ to ________
c ____________
a and b will have a low and high but c needs to be just an input box.
how to define this ??
selection-screen begin of screen 0100 as subscreen.
selection-screen begin of block b4.
select-options: a for MARA-MATNR
how to define c ???
selection-screen end of block b4.Actually the syntax would be like so. You can also add the NO- EXTENSION to the end to get rid of the "Multiple Selection" box.
select-options: c for sy-datum no intervals no-EXTENSION.
Regards,
Rich Heilman -
How to make a Select Option Mandatory.
hi,
In my requirement , I'm supposed to make a Job Code Key mandatory, if if a selection Drop down is clicked.
ie., if for key Employee Type = FullTime, PT, Students.(Drop Down)
when Students key is clicked, Job Key option should be made mandatory, This madate is happening, but when I go back and selct FT employee, Job key mandate is not disappearing.
plz let me know.
Thank Q.
Rohini.Hi,
At the Selection screen.
I gave code like
fill the list box of employee type
param = 'P_EMPTYP'.
value-key = c_1.
value-text = c_ft.
append the values to table values .
APPEND value TO values.
value-key = c_2.
value-text = c_pt.
append the values to table values .
APPEND value TO values.
value-key = c_3.
value-text = c_ptft.
append the values to table values .
APPEND value TO values.
value-key = c_4.
value-text = c_students.
append the values to table values .
APPEND value TO values.
calling the FM to set the values
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = param
values = values.
param1 = 'P_ESTAT'.
REFRESH values1.
value1-key = c_1.
value1-text = text-087.
APPEND value1 TO values1.
value1-key = c_2.
value1-text = text-088.
APPEND value1 TO values1.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = param1
values = values1.
IF p_emptyp = 'Students' .
IF p_emptyp = c_4 .
LOOP AT SCREEN .
IF screen-name = 'S_CODE-LOW' .
screen-required = 1 .
MODIFY SCREEN .
ENDIF .
ENDLOOP .
ENDIF .
Its wrking well here
,I do F8 n select Students there, Its shows Job Key (s-code) as mandate.
but when i come back Output selection screen n click for Full Time employee,
it is also asking for Job key, for it not not supposed to.
Can u plz correct me.
Thank Q.
Rohini. -
Comparing field with select-option
HI
i have one slect option
s_bukrs for coas-bukrs.
and
loop..
if w_bukrs eq s_bukrs"here is the problem,w_bukrs is
"holding single value and s_bukrs a range,so in such
"case how i can do comaprison
endif.
endloopHi Sanju,
Just use IN as said..
if w_bukrs <b>IN</b> s_bukrs
in case you want to compare a single value use..
if w_bukrs <b>EQ</b> s_bukrs-low or
if w_bukrs <b>EQ</b> s_bukrs-high
regards
satesh
Maybe you are looking for
-
Voice mail as last stop for hunt group
Hello: We have no ACD ability, so I have a hunt group set up with 3 extensions (one each as second line on each of 3 phones). If no one is available on any of the hunt extensions, I want it to go to a shared voice mail box. Can anyone help me know if
-
After upgrading to Lion, Preview (5.2.2) appears to have lost the facility to run a slide show by using my mouse to click an icon in the visible menu bar, as I could in the previous version. Can I retrieve that icon and thus that facility?
-
My iPhone 4s will no longer connect to my computer
My iPhone 4s will no longer connect to my computer. I recently converted to iOS6. I am not sure if problem started before or after conversion. It used to connect to computer (using XP professional) via hotwire but no longer connects. I tried connecti
-
Problem with lenght of text and footer elements displaced (bug?)
I have a problem with the footer of my pages. The footer is composed with elements of the master page and two elements that are page dependant so these elements are defined in each page. All the elements in the footer are marked as page footer elemen
-
Hi, When I am starting the Business Explorer, I am getting an Error Message: " A critical Program error occured. The Program has to close.Please refer to the trace for further information". Please reply if you have any info regarding this error.