Multiple select options validation at selection screen
Hi,
I have the requirement to create a selection screen with 3 select options. Two of them are cross-dependent. It is mandatory to fill one of them and it is not allowed to fill both. The third one is optional. I tried the validation at selection-screen on block... and I have a problem that search help buttons for select options react like execution buttons, when I press any of them I am getting one of errors instead of search help.
Any help on this issue would be appreciated.
Here is my code:
DATA:
so_rbkp TYPE rbkp,
so_mseg TYPE mseg.
SELECTION-SCREEN BEGIN OF BLOCK blok WITH FRAME.
SELECT-OPTIONS:
s_fakt FOR so_rbkp-belnr,
s_matdok FOR so_mseg-mblnr,
s_god FOR so_mseg-gjahr.
SELECTION-SCREEN END OF BLOCK blok.
INITIALIZATION.
SET TITLEBAR '0100'.
START-OF-SELECTION.
AT SELECTION-SCREEN on block blok.
if s_fakt <> space and s_matdok <> space.
MESSAGE 'Message1' TYPE 'E'.
elseif s_fakt = space and s_matdok = space.
MESSAGE 'Message2' TYPE 'E'.
endif.
ENDIF.
Only perform the check when user wants to execute or submit the program, not when pressing F4 or even Enter, but in a selection-screen event, before START-OF-SELECTION which were program would terminate in error :
TABLES: SSCRFIELDS.
AT SELECTION-SCREEN OB BLOCK b01.
IF sscrfields-ucomm EQ 'ONLI'
OR sscrfields-ucomm EQ 'PRIN'
OR sscrfields-ucomm EQ 'SJOB'.
IF s_fakt[] IS NOT INITIAL AND s_matdok IS NOT INITIAL.
MESSAGE 'Message1' TYPE 'E'.
ELSEIF s_fakt[] IS INITIAL and s_matdok[] IS INITIAL.
MESSAGE 'Message2' TYPE 'E'.
ENDIF.
ENDIF.
(You could also always send the message, but using type 'E' for those function code and 'S' status for any other value.)
Regards,
Raymond
Similar Messages
-
Select options validation in selection screen
Hi all,
I have select options for plant in selection screen..I want to validate the Plants. and display the invalid plants in the selection screen itself....Since my report is for online purpose i am in need of this requirement...i dont want to print or display the invalid plants as output of the report..
Is thaee any way to achieve this...please help.
points will be rewareded definetely if problem gets solved by your solution.
Thanks in advance..Hi
AT SELECTION-SCREEN ON S_WERKS.
PERFORM F_CHECK_PLANT USING TEXT-024.
FORM F_CHECK_PLANT USING P_TEXT_004.
IF S_WERKS IS NOT INITIAL.
DATA: LV_WERKS TYPE WERKS_D.
SELECT SINGLE WERKS
INTO LV_WERKS
FROM T001W
WHERE WERKS IN S_WERKS.
IF SY-SUBRC <> 0.
CLEAR S_WERKS.
MESSAGE E000 WITH P_TEXT_004 "(Plant does not exist)
ENDIF.
CLEAR LV_WERKS.
ENDIF.
ENDFORM. " F_CHECK_PLANT
Reward if useful
Narendra -
How to creat select-option on module pool screen???
Hi All,
please tell me how to creat select-option on module pool screen???
Regards
DeepakHi Deepak Kumar Sharma,
There are Two ways to achieve it...
1) How to create a select-options in a module pool screen.
Method 1
a) Create a subscreen area in your screen layout where you want to create the select options.
b) In the top include of your module pool program declare a selection screen as a subscreen e.g.
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
select-options s_matnr for mara-matnr.
SELECTION-SCREEN END OF SCREEN.
c) In the PBO and PAI of the main screen where the select options needs to be created do a call subscreen of the above screen (100).
CALL SUBCREEN sub_area INCLUDING <program> <screen>
This call subscreen statement is necessary for transport of values between screen and program.
Note: All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc and not in PAI. These selection screen validations etc should be done in the top include only.
Method 2
a) Create 2 separate fields in your screen layout - one for the low value and one for the high value. Insert an icon beside the high value which will call the multiple selections popup screen on user command. Use function module COMPLEX_SELECTIONS_DIALOG to achieve this.
struc_tab_and_field-fieldname = con_cust. " 'KUNNR'
struc_tab_and_field-tablename = con_kna1. " 'KNA1'.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
TITLE = ' '
text = g_titl1 " 'Customers'
tab_and_field = struc_tab_and_field
TABLES
RANGE = rng_kunnr
EXCEPTIONS
NO_RANGE_TAB = 1
CANCELLED = 2
INTERNAL_ERROR = 3
INVALID_FIELDNAME = 4
OTHERS = 5.
IF NOT rng_kunnr[] IS INITIAL.
Read the very first entry of the range table and pass it to
dynpro screen field
READ TABLE rng_kunnr INDEX 1.
IF sy-subrc = 0.
g_cust = rng_kunnr-low.
ENDIF.
You can use the return table rng_kunnr to populate your own internal range table with the values entered by the user. Basically here you are just simulating the work of a select-options parameter by module pool screen elements.
Also have a look on below threads
how to make select option in module pool
select option in module pool program
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7 -
Hi,
Can any body tell me the best option for validating the select-option field in selection screen.
suppose i have a select option s_lifnr on selection screen.how i can validate that vendor.we have to validate the range or we have to check for at least single value..is valid..what is the best possible solution?
Thanks.the best solution is to check if a single value is fetched from the db
at selection screen on so_lifnr
select single * from lfa1
where lifnr in so_lifnr.
if sy-subrc NE 0.
Message 'Invalid vendor' type 'E'.
endif.
The reason is simple imagine you give a range of 1 to 10 in so_lifnr, then there might be vendors only for 1, 3, 5 ,7. You dont want to give an error message in this case if there is no vendor 2,4, etc...
Also imagine that there are 10000 vendors and the range now has 1 to 10000, imagine the performance if you are to validate each value in the select option.
Last but not the leaset the user has a free option to use patterns (astericks ), signs ( E or I ) , options ( EQ, NE, GE, LE, GT, LT,BT etc ) in select options. So user may enters ABC and 'I in the sign. It would then be hard to code to find exactly all the possible entries the user wants, unless they are selected from db.
So as you can see there are a lot of possible inputs for a select option, the best approach is to validate a single value from database.
regards,
Advait -
Need to disable one of the select-options in dynamic selection screen
Hi,
we have copied the Standard program: RFDOPR00 into Z, my requirement is to disable one of the select-options in dynamic selection screen for ex: Reason code(User shouldnot able to enter anything in it).
Can anyone please tell me the procedure to do it... I had tried using at selection-screen but it doesnt work as it in 'LOOP AT SCREEN', i am not able to capture the Parameter name(screen-name).
Thanks,
RaviHi,
Get inside your selection screen, by executing your program.
Now type /h in the field where you enter transaction code and press enter.
Now again press enter, this will take you debugger starting from your Selection screen.
You might be knowing this, still if you are not aware of this, this might be a valuable tip.
From here , you can trace your Parameter name. -
Select option in user defined screen
Hi friends,
In my program i m in need of using select-options ( input in terms of range ) . i saw some thread . in that they have mentioned FM : COMPLEX_SELECTIONS_DIALOG and some have given call subscreen ***.
but i don't know how to use it. i have never used subscreen in my program..
so u please tell me how to get it.
Thanks and regards,
kani,.Refer:
[http://www.saptechies.com/select-option-in-a-dynpro/]
[Complex_Selections_dialog in Module Pool Programming;
[How to put "selection options without intervals" on screen painter?; -
Adding default value for a select-options in a selection-screen
hello gurus,
i have a report program with the following select-options in a selection-screen block:
select-options: so_site for MyTable-werks.
i want the so_site to have a default value once the program displays. can it be possible?
regards,
sidHi sid,
1. Whenever we use select-option,
an internal table of type range is
automatically created.
2. so, in fact, we have to put
record in this internal table.
3. eg. Just copy paste in new program.
4.
report abc.
tables : t001.
select-options : bukrs for t001-bukrs.
initialization.
bukrs-sign = 'I'.
bukrs-option = 'EQ'.
bukrs-low = '1000'.
append bukrs.
regards,
amit m. -
Default Current year in select option field on selection Screen
Dear Experts,
I want to set current year as default value in fiscal year select-options field on selection screen.
for this, i hv written following code
DATA:VAR_DATE TYPE SY-DATUM.
DATA VAR(4) TYPE C.
VAR_DATE = SY-DATUM.
VAR = VAR_DATE+0(4).
this retrieves current year .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS I11 FOR ANLC-GJAHR DEFAULT VAR TO VAR.. "Fiscal Year
SELECTION-SCREEN END OF BLOCK B1.
Now when i am executing program pop-up is raised describing "Specify the range Limits". Please help.
Regards,
Apoorv Sharma>
Ganga Bhavani R wrote:
> Use below lines.
>
> SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
> SELECT-OPTIONS I11 FOR ANLC-GJAHR DEFAULT SY-DATUM+0(4). "Fiscal Year
> SELECTION-SCREEN END OF BLOCK B1.
Hi, Ganga,
I think it will not working properly that way, Please test the bellow Sample Code.
TABLES: anlc.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS i11 FOR anlc-gjahr .
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
IF i11[] IS INITIAL.
i11-low = sy-datum+0(4).
APPEND i11.
ENDIF.
Thanks and Regards,
Faisal -
Getting select options in module pool screen
hi experts,
can any one suggest me how to provide select options in module pool screen.
thank you,
regards
vijayHi,
Take two fields on screen first for low value and other for high value (say vbeln_low and vbeln_high) also design a button next to the high textbox for select-option button used to display popup.
Using these two input fields append a range (say r_vbeln for vbap-vbeln) for the field to be used (either in query or anywhere).
ranges : r_vbeln for vbap-vbeln.
IF NOT vbeln_high IS INITIAL.
IF NOT vbeln_low LE vbeln_high.
MESSAGE e899 WITH text-007. "high value is smaller than low value
ENDIF.
ENDIF.
r_vbeln-sign = 'I'.
r_vbeln-low = vbeln_low.
IF vbeln_high IS INITIAL.
r_vbeln-option = 'EQ'. "if user takes only a singlr value
ELSE.
r_vbeln-option = 'BT'. "if user takes both low & high value
r_vbeln-high = vbeln_high.
ENDIF.
APPEND r_vbeln. "append range
CLEAR r_vbeln.
On the button click call this FM to call a popup for select-options.
DATA : tab TYPE rstabfield.
tab-tablename = 'VBAP'.
tab-fieldname = 'VBELN'.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
title = text-002
text = ' '
signed = 'X'
* lower_case = ' '
* no_interval_check = ' '
* just_display = ' '
* just_incl = ' '
* excluded_options =
* description =
* help_field =
* search_help =
tab_and_field = tab
TABLES
range = r_vbeln
EXCEPTIONS
no_range_tab = 1
cancelled = 2
internal_error = 3
invalid_fieldname = 4
OTHERS = 5.
IF sy-subrc EQ 2.
MESSAGE s899 WITH text-003. "no value selected
ELSEIF sy-subrc <> 0 AND sy-subrc <> 2.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
This whole code will append your range r_vbeln to be used in program.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Select Option on Module Pool screen
How to display select options on Module Pool screen ?
Via the search functionality, you will find something like :
SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.
SELECT-OPTIONS: S_CARRID FOR SPFLI-CARRID,
S_CONNID FOR SPFLI-CONNID.
SELECTION-SCREEN END OF SCREEN 101.
and to use a CALL SELECTION-SCREEN xxxx in your module pool.
regards,
Hans -
How to create select-options on module pool screen
Hi all
I want get a range of values from the user from the module pool screen.
Is there any element available on module pool screen like select options on the selection screen of reports.
reply me ASAS.
Thanks.hi krishna
actually I want to display the details of PO numbers from 45000100 to 45000150. user will enter this range on the module pool screen just as we enter on the selection screen of report. My question is do we have a button like select-option on the module pool screen.
Plz . reply me ASAP.
Thanks. -
Hiding Select options on a selction screen
hi,
How to Hide Select options on a selction screen
thnks.hi,
eg:-
select-options: sel_mat for mard-matnr no-display.
select-options: sel_plnt for mard-werks.
in this the sel_plnt will appear and sel_mat will not be seen on the selction screen. there are many options avaliable with select-options..
Like
[OBLIGATORY / NO-DISPLAY]
[VISIBLE LENGTH vlen]
[NO-EXTENSION]
[NO INTERVALS]
[MODIF ID modid] ... .
reward points if useful and mark answered if u got the answer -
Say in selection screeen (ie is in select-options) i have selected record r
say in selection screeen (ie is in select-options) i have selected record range from 1000 to 2000 but in the final display list i sholud not get 1200 to 1300 records it should be hide how is it posible
Thanks
BasuHello Math,
There are two ways of restricting the records with 1200 & 1300 values in output list display -
1. Either restrict the records while selecting the data from database using SELECT query. This can be achieved by ranges table populated with the values, which won't select the 1200 & 1300 records.
Find the following code for this -
TABLES: TAB1.
RANGES: R_FLD1 FOR TAB1-FLD1.
R_FLD1-SIGN = 'I' .
R_FLD1-OPTION = 'EQ'.
R_FLD1-LOW = '1000'.
R_FLD1-HIGH = '2000'.
APPEND R_FLD1.
R_FLD1-SIGN = 'I' .
R_FLD1-OPTION = 'NE'.
R_FLD1-LOW = '1200'.
R_FLD1-HIGH = '1300'
APPEND R_FLD1.
SELECT * FROM TAB1
INTO IT_TAB1
WHERE FLD1 IN R_FLD1.
2. Select the data first in internal table first and then delete the entries having 1200 & 1300 values.
Find the following code for this -
TABLES: TAB1.
RANGES: R_FLD1 FOR TAB1-FLD1.
SELECT * FROM TAB1
INTO IT_TAB1
WHERE FLD1 IN R_FLD1.
IF SY-SUBRC EQ 0.
SORT IT_TAB1 BY FLD1.
DELETE IT_TAB1 WHERE ( FLD1 = '1200' ) OR ( FLD1 = '1300' ).
ENDIF.
Hope this helps you.
PS If the answer solves your query, plz close the thread by rewarding each reply and marking it Solved.
Regards -
Hiii select option validation on screen
Hi
please advise how do i do check on selection screen
Suppose i have a internal table ITAB which has value as below
ITAB-->
BUKRS----CODE
AA-------01
AA-------08
AA-------07
BB-------03
BB-------04
i have on selection screen as below:
Paremeters: P_bukrs
select_options: S_CODE
i have to do a check when user enter value on s_code that it is valid for the bukrs
please advise. can we do a loop with S_codeHi,
Try like this,
Just copy paste and execute the code.
REPORT z10_test
NO STANDARD PAGE HEADING
MESSAGE-ID z10_test.
Types: begin of t_tab,
bukrs type bukrs,
code(4) type c,
end of t_tab.
data: itab type standard table of t_tab with header line.
parameters: p_bukrs like itab-bukrs.
select-options: s_code for itab-code.
AT SELECTION-SCREEN on S_code.
itab-bukrs = 'AA'.
itab-code = '01'.
append itab.
itab-bukrs = 'AA'.
itab-code = '08'.
append itab.
itab-bukrs = 'AA'.
itab-code = '07'.
append itab.
itab-bukrs = 'BB'.
itab-code = '03'.
append itab.
itab-bukrs = 'BB'.
itab-code = '04'.
append itab.
loop at itab where code in s_code and
bukrs = p_bukrs.
if sy-subrc ne 0.
exit.
endif.
endloop.
message e000. <--- Error message.
Hope this helps.
Edited by: jagannathan krishnan on Feb 4, 2008 7:12 AM -
Text for block and select option on the selection screen of Logical Databas
Hi,
I have copied a standard program (RFBELJ10) which is making use of LDB (BRF) and created a custom program. Now, the requirement is to add a selection screen option to the custom report and do some validation on the data extracted. I have added the select option and provided a text (lets say "Segment") to it using menu path Goto --> Text Elements --> Selection Texts and activated. But this text is not displayed on the screen when i execute the report. It is showing the string which i used while defining the select option.
Also i need to provide a frame and title to it. but its not displayed.
i have written the following code for that:
SELECTION-SCREEN: BEGIN OF BLOCK seg WITH FRAME TITLE text-h01. " Segment
SELECT-OPTIONS: s_segmnt FOR faglflexa-segment. " Segment
SELECTION-SCREEN: END OF BLOCK seg.
Could you please help me in getting the texts displayed for fram and the select option?
Thanks,
PhaniSolved the problem. I have maintained the text in German. So, when I execute the report in english, it is not displaying the text. I have translated the texts to English and is working fine now.
Maybe you are looking for
-
The sum of the confirmed quantity exceeds the sum of stock items
Hi, I have two sales order. Material is same. Both of them related project stok. First sales order's qty=1. I created purchase order and post goods receipt. Second sales order's qty=2. I created only purchase order. I cannot create delivery for first
-
When I plug in my Seagage Agent External Hard drive into my HP 2000-4 Laptop PC, it sees it as a devise rather than as a drive. How do I get this turned around?
-
How do we Use Internal table in Global Memory ?
Hi All , Can anyone help me with how to create and use an internal table in SAP global memory ? Regards, Ranjita
-
Impossible to create or refresh webi report. (WIJ 77778) - please help
Hello, i'm experiencing problem with BO Edge Standard edition on RHEL4 trying to create or refresh a report on Webi. I have installed BO without problem on the RHEL4. I can log on Infoview and in CMC with "administrator" however when i try to create
-
Got a error message of "conversion failure" from a PDF to word, what are next steps in trouble lshooting? Thanks