How to do validations for select-options
Hi gurus,
can you suggest me
how to do validations for select-options
Thanks&ragards,
Kals.
HI,
TABLES: BKPF.
TYPES: BEGIN OF TY_BKPF,
BUKRS TYPE BUKRS, "COMPANY CODE
GJAHR TYPE GJAHR, "FISCAL YEAR
MONAT TYPE MONAT, "FISCAL PERIOD
DATA: T_BKPF TYPE TABLE OF TY_BKPF,
W_BKPF TYPE TY_BKPF.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_CODE FOR BKPF-BUKRS,
S_YEAR FOR BKPF-GJAHR,
S_PERIOD FOR BKPF-MONAT.
SELECTION-SCREEN: END OF BLOCK B1.
AT SELECTION-SCREEN *
IF S_CODE IS INITIAL OR S_YEAR IS INITIAL OR S_PERIOD IS INITIAL.
MESSAGE E000(0) WITH 'ENTER VLAUES'.
ENDIF.
SELECT SINGLE * FROM BKPF WHERE BUKRS IN S_CODE.
IF SY-SUBRC <> 0.
MESSAGE E000(0) WITH 'ENTER VALID VALUES'.
ENDIF.
reward if useful
thanks and regards
Similar Messages
-
How to use offset for select-option parameter ?
Hi experts
could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
following is my code
SELECT-OPTIONS: s_prctr FOR vbsegs-prctr OBLIGATORY.
here "prctr" length is 10.
i'm using two tables 1. vbsegd-bupla
2. vbsegs-prctr
here prctr+6(4) = bupla.
"Bupla" length is 4
SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND bupla IN s_prctr.
the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND prctr IN s_prctr.
this is working as prctr and s_prctr lengths are equal.
could anybody please help me out in this.
Thanks in advance.
regards
satishBelow code will work for you.
SELECT-OPTIONS: s_prctr FOR vbsegs-prctr OBLIGATORY.
RANGES: s_bupla FOR vbsegd-bupla.
s_bupla[] = s_prctr[].
DELETE ADJACENT DUPLICATES FROM s_bupla.
SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND bupla IN s_bupla. -
How to add OBLIGATORY for SELECT-OPTIONS
Hi experts,
I can use OBLIGATORY for PARAMETERS
PARAMETERS :s_WMno TYPE LINK-LGNUM DEFAULT 'SCA' OBLIGATORY.
I want to add OBLIGATORY for SELECT-OPTIONS. How to do this?
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME .
SELECT-OPTIONS: s_matnr FOR mara-matnr .
SELECTION-SCREEN END OF BLOCK b1.
Many thanks.Hi,
TABLES spfli.
SELECT-OPTIONS : carrid FOR spfli-carrid OBLIGATORY. " This makes only Low field Obligatory
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'CARRID-HIGH'. " To make High field also obligatory
screen-required = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Cheerz
Ram -
need help in validaiton for select-options.
Hi..,
could u paste ur selection screen declarations here !!!
check this..
*"Selection screen elements............................................
select-options :
s_vbeln for vbak-vbeln, " Sales document number
s_vkorg for vbak-vkorg, " Sales organization
s_erdat for vbak-erdat . " Run date
AT SELECTION-SCREEN ON EVENT *
*Validation on Sales document number range...
at selection-screen on s_vbeln.
Perform to validate Sales document number range...
perform f0000_validate_vbeln.
AT SELECTION-SCREEN ON EVENT *
*Validation on Sales Organization range...
at selection-screen on s_vkorg.
*Perform to validate the Organization number user input...
perform f0100_validate_vkorg.
AT SELECTION-SCREEN ON EVENT *
*Validation on Creation date range...
at selection-screen on s_erdat.
*Perform to validate the Creation date of the sales documents...
perform f0100_validate_erdat.
*& Form f0000_validate_vbeln
This subroutine validates the user input - Sales document *
number range *
There are no interface parameters *
form f0000_validate_vbeln.
select vbeln " Sales Document number
from vbuk
up to 1 rows
into vbak-vbeln
where vbeln in s_vbeln.
endselect.
check sy-subrc ne 0.
message e001(zsls640) with s_vbeln-low s_vbeln-high.
endform. " Form f0000_validate_vbeln
*& Form f0100_validate_vkorg
This subroutine validates the user input - Sales Organization *
range *
There are no interface parameters *
form f0100_validate_vkorg.
select vkorg " Sales Organization
from vbak
up to 1 rows
into vbak-vkorg
where vkorg in s_vkorg.
endselect.
check sy-subrc ne 0.
message e002(zsls640) with s_vkorg-low s_vkorg-high.
endform. " Form f0100_validate_vkorg
*& Form f0100_validate_erdat
This subroutine validates the user input - Creation date of the*
Sales documents *
There are no interface parameters *
form f0100_validate_erdat.
select erdat " Creation date
from vbak
up to 1 rows
into vbak-erdat
where vkorg in s_erdat.
endselect.
check sy-subrc ne 0.
message e003(zsls640) with s_erdat-low s_erdat-high.
endform. " Form f0100_validate_erdat
<b>regards,
sai ramesh</b> -
Validation for Select-Option - Issue
Hi Experts!!
I have a select-option s_field on which I have written a validation under AT SELECTION-SCREEN. Now, the problem is that, if validation fails in second line of s_field, then to change it when we click on Extension, it's not allowing to enter but is throwing error message again and again as AT SELECTION-SCREEN is called.
Suppose, I have entered 2 single values as C001 and F001. s_field will have 2 entries. Now, C001 is a valid value but F001 is not. PFB my code:
LOOP AT s_field.
SELECT SINGLE *
FROM ztable INTO ls_field
WHERE field EQ s_field-low.
IF sy-subrc NE 0.
" Error Message
ENDIF.
ENDLOOP.
Now, for C001, sy-subrc will be 0. But for F001 sy-subrc is 4 and hence will throw an error. Now, to correct this, I am trying to enter into extension, but as this will be called again, I am unable to. Hope I explained it clearly.
I do not see any possibility to correct this. Can anybody please suggest if any workaround can be implemented?
Your help is highly appreciable.Hi,
You can try the following:
AT SELECTION-SCREEN on s_field.
LOOP AT s_field.
SELECT SINGLE *
FROM ztable INTO ls_field
WHERE field EQ s_field-low.
IF sy-subrc NE 0.
MESSAGE s398(00) DISPLAY LIKE 'E' with 'ERROR MESSAGE'.
ENDIF.
ENDLOOP.
I hope this works as per your requirement.
<<point-begging removed>>
Edited by: micky prasad on Jan 6, 2012 1:00 PM
Edited by: kishan P on Jan 9, 2012 1:40 PM -
How to set default values in initialization event for select option
Abapers,
I have 3 GL account like 0024831231,0024831238,0024831245.
Please help me how to set default values in select-options ( s_hkont ) in INTIALIZATION event
ThanksSelect option is table <Structure> with fields, low, high, sign & option
you need to append the value into the select option, with appropriate value in low or
example:
S_HKONT-low = <value>
S_HKONT-SIGN = 'I'
S_hkont-OPTION = 'EQ'
append s_hkont.
Default value for select-option also can be added directly in select-option statement.
Regards,
Mahesh -
How to get calender in f4 help for select options in module pool (URGENT)
Hi All,
how to get calender in f4 help for select options in module pool
Please help .
Thanx in advance,
amrutaHi Amruta,
First of all, you can not create select-options directly in module pool.
For creating <b>select-option is dialog prog</b> follow these steps:
1. create your selection screen model as subscreen by:
SELECTION-SCREEN BEGIN OF SCREEN 2000 AS SUBSCREEN.
PARAMETRS: P_MATNR LIKE MARA-MATNR.
SELECT-OPTIONS: S_BISMAT FOR MARA-BISMAT.
SELECTION-SCREEN END OF SCREEN 2000.
2. create a screen ( example 100 ) in your module-pool dedicated for selection-screen. on this screen layout sketch a sub-screen name like subscree_2000.
3. write this bit of code in PBO and PAI of the screen 100;
CALL SUBSCREEN SUBSCREEN_2000.
4. include this code in PBO:
INCLUDING SY-REPID '2000'
6. write user_command of PAI, call screen which is going to executable after selection-screen.
5. create a transcation for this dialog module pool with screen 100.
6. execute this transaction and you can see it's behaving like cool with select-options.
After that in [bprocee on value-request]</b>, use F4_DATE for both from and to option field.
Hope it will solve the problem.
Regards
Krishnendu -
How to assign search help using ovs for select options for ALV in web dynpr
how to assign search help using ovs for select options for ALV in web dynpro
Hi,
refer http://wiki.sdn.sap.com/wiki/display/WDABAP/InputhelpofObjectValueSelectioninWDABAP
http://www.****************/Tutorials/WebDynproABAP/OVS/page1.htm
and http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproAbap-OVSsearch+help
Thanks,
Chandra -
How to write Error message for select options?
Hi
i have this select option statement
SELECT-OPTIONS: s_fevor FOR afko-fevor.
how to write error message for this?
Regards
SmithaError messages are displayed for Select-options mostly on two conditions:
1) You needs to check wether a value is entered or not its done by:
a)
Select-options:SELECT-OPTIONS: s_fevor FOR afko-fevor Obligatory.
In this case error message is automatically throwed by system.
b) You can do this in Selection Screen events.
Ex:
AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
IF S_FEVOR-LOW IS INITIAL.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.
2) You need to Validate the entered value:
You can do this in Selection Screen events.
Ex:
AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
SELECT FEVOR
FROM AFKO
INTO AFKO-FEVOR
UP TO 1 ROWS
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.
Regards,
Gurpreet -
Maximum allowable input for select-options
Hi All,
Can we enter any number of values in select-options on the selection screen. What is the limit on the number of values that can be given for select options.
For example if the limit for a select-options field is 100000 and if i want to give 999999 values as input on the selection screen, how am I supposed to handle this.
Thanks in advance,
MadhuHi Madhu,
see the sample code below .. i hope it this will help you..
SELECT-OPTIONS: s_order FOR vbak-vbeln . "Default the value range 100000 to 9999999 appears on the screen
INITIALIZATION.
* Loading default values to screen input for Sales Order field
MOVE 'I' TO s_order-sign.
MOVE 'BT' TO s_order-option.
MOVE '1000000' TO s_order-low.
MOVE '9999999' TO s_order-high.
APPEND s_order.
* Screen field Validation
AT SELECTION-SCREEN ON s_order.
if s_order-low NE 100000.
message 'Sales order Low value should be 100000' type 'E'.
endif.
if s_order-High NE 999999.
message 'Sales order High value should be 999999' type 'E'.
endif.
Regards,
Prabhudas -
How can we pass the select-option value to modulepool program?
hi,
how can we pass the select-option value to modulepool program ?
Because if i declared select-options in executable program and i used SSCRFIELDS to define push buttons in selection screen.
My requirement if enter the values to select-options and press UPDATE pussbotton then i want call screen which contains tablecontrol.
How i get select-option values to PAI of call screen for getting the data from database table to my internal table?Oh I thought that you have selection-screen and again you are working on dialog programming.
if you want to use select-option directly in module pool then it is not possible.
but you can do other way.
create two varaiables
data : v_kun_low like kna1-kunnr,
v_kun_high like kna1-kunnr.
use these two variables in layout ,let user knows that he can not give options like gt,lt,eq ,it will be always BT.
and also when you see normal report program,you can use multiple values in either low or high,but here it is not possibel.
use can enter only low value and high value.
when you come to program point of view
declare one range
ranges r_kunnr for kna1-kunnr.
do the coding like
r_kunnr-low = v_kun_low.
r_kunnr-high = v_kun_high.
r_kunnr-options = 'BT'.
r_kunnr-sign = 'I'.
append r_kunnr.
now you can use r_kunnr in select query ,it will work like select-option.
other than this there is no option.
Thanks
Seshu -
Standard Match Code for Selection Options with Example
Hi Guys,
Can anybody tell me Standard Match Code or Search help for Selection Options.
ex: MBEW-MATNR , MBEW-BWKEY and MBEW-BWTAR. can anybody tell how to keep Search Help or Match Code for the Above Fields in ECC 6.0 with Example
Very Urgent.
Thanks,
Gopi.Well Gopi.. as per your requirement no need to use collective search help.
I guess you have three fields in selection-screen,out 3 fields you have two fields contains search help.
Create your user defined search help BWTAR ..
Check the below links for creation search help :
http://help.sap.com/saphelp_46c/helpdata/EN/cf/21ee2b446011d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Hope you got it.
Thanks
Seshu -
Set of default values for Select-Options
Hi Gurus,
I have a requirement where I need to set default values for select options
ex: SELECT-OPTIONS: S_MTART FOR MARA-MTART
default values must be ERSA - HIBE- FHMI - DIEN - GEST
Please tell me how to do it.
Effective replies will be rewarded with full points
KarthikHi,
For each SELECT-OPTION, you can only specify one DEFAULT.
You must specify the default value g in its internal format, e.g. "SELECT-OPTIONS DATE FOR SY-DATUM DEFAULT '19931224'", not "... DEFAULT '24.12.1993'".
The default value g should normally be a literal because, at runtime when you use SUBMIT, it is transferred to the selection options table sel so early that no value can be assigned to the field g. System fields like SY-DATUM are an exception here because the system usually assigns values to them as soon as the report processing starts.
When you use user-defined selection screens in your programs that you do not call using SUBMIT, the DEFAULT value is transfered when the selection screen is first called. In this case, therefore, you can use other fields g.
regards,
sowjanya
Message was edited by: sowjanya suggula -
Freely Programed Help for select-option field
Hi,
how can i set freely programmed help for select option field, i mean while adding selection field what are the parameters that are important for freely programmed help.
i have implemented iwd_value_help in one component comp1 and declared the usage of comp1 in comp2 where i actually defined the usage of select-option component.
i used parameter i_value_help_type = if_wd_value_help_handler=>co_prefix_appldev while adding selection field, however when i presss F4 icon, the following message is coming
View WD_VALUE_HELP does not exist within the component WDR_SELECT_OPTIONS
Please suggest where i am doing wrong??
Edited by: kranthi kumar on Dec 29, 2010 6:19 PM>
kranthi kumar wrote:
> Hi,
>
> how can i set freely programmed help for select option field, i mean while adding selection field what are the parameters that are important for freely programmed help.
>
> i have implemented iwd_value_help in one component comp1 and declared the usage of comp1 in comp2 where i actually defined the usage of select-option component.
>
> i used parameter i_value_help_type = if_wd_value_help_handler=>co_prefix_appldev while adding selection field, however when i presss F4 icon, the following message is coming
>
> View WD_VALUE_HELP does not exist within the component WDR_SELECT_OPTIONS
>
> Please suggest where i am doing wrong??
>
> Edited by: kranthi kumar on Dec 29, 2010 6:19 PM
Hi Kranthi,
Please help me to understand your design.
Why would you like to create a Freely programmed value help for select-option?. why not use wdr_select_option directly ? -
How to write Validations for RadioButton
Hi All,
in my Application , two RadioButtons and one submitbutton is there, in that
1. yes
2. no
both are radio buttons
when i click on submit button, without selecting any one of those radiobuttons ,
it shud display error message, this errormessage i have written in iwdmessage.
it shud show this error message, instead of displaying nullpointer exception.
how to write validation for this.
please help me.
regards
sushHi shushma,
Simply put a check that:
If(wdContext.current<YOUR_NODE>Element().get<YOUR_ATTRIBUTE_NAME> !=null){
else{
// Show the error messages
//Displaying the error message is very easy.
//You can report exception using the message manager API's. You will get this easily on SDN.
I hope this helps! if you need ay further help please let me know.
Thanks and Regards,
Pravesh
Maybe you are looking for
-
I am using a new computer with the latest version of FF on it. When the problem began, I was using an older computer that had a virus and malware on it. I have not yet cleaned the files from the old computer and consequently have not transferred any
-
Showing preview of downloaded pis fails
Hi there (second try), this is a often discussed matter AFAIK. There are synchronizing Problems when downloading pics into a component that displays the pics. This could be solved by using imageObservers or MediaTracker Objects (I tried them, but the
-
Automatic update of links appears broken in 2007 format word documents
this is all in Word 2013 Pro + [15.0.4569.1504] under Win7 [6.1.7601]. legacy DOC (XLS) format documents. have LINK fields with the following format: { LINK Excel.Sheet.8 "c:\\test\\test.xls" "Sheet19!A1:D11" /a /p } Excel spreadsheet is in the same
-
I can't update my music players library, it won't show me any menu in the music player, it just keeps saying no music files stored. I need to update my library to get the songs I'm putting onto my phone from my computer. Any idea how to get into the
-
Enhancement request : Table - Data -- Filter with multiple lines
It would be nice when the Filter option in the tables Data tab could contain multiple lines, because : In case of a complex where clause on a table (used in a query) it's hard to get an impression of the filter because everything is typed on one sing