2011 Aug 11 10:46 PM
Hi All,
I am using the select-options s_plant.
I am validating the plant at AT SELECTION-SCREEN ON S_PLANT.
Here I am want to display error message like Enter plant + S_PLANT+ doesnot exits .
Can any one tell me code how to display all S_PLANT (not present in selection table).
Here my code is :
select plant from <table_name> where plant in s_plant.
if sy-subrc <> 0.
message text-001 type 'E'. " text-001 ->Plant
endif.
Regards,
TM Murugan.
Moderator message: please choose more descriptive subject lines for your posts.
Edited by: Thomas Zloch on Aug 12, 2011 2:08 PM
2011 Aug 12 3:30 PM
Hi
try to do something like this.
Always validate those things on the events of AT SELECTION-SCREEN
tables: T001w.
data: w_werks like T001W-WERKS.
SELECT-OPTIONS S_PLANT FOR T001W-WERKS.
AT SELECTION-SCREEN ON s_plant.
if s_plant[] is not initial.
SELECT single WERKS INTO W_WERKS
FROM T001W
WHERE WERKS IN S_PLANT.
if sy-subrc <> 0.
message ' error no valido' type 'E'.
endif.
endif.
Regards
Miguel
The link posted by Dhina further confirms my above post that it is not possible to display all invalid plants with select-options and is used to check that whether atleast 1 valid plant is existing or not.
Diwakar
2011 Aug 12 1:13 AM
Hi,
Message displayed on the botton of the screen has a limitation with the length. If you want to display all the plants then please use a "pop-up" window.
Regards,
2011 Aug 12 3:06 AM
Murugan,
I understand your question is that if S_plant contains 5 plants and out of them 4 are valid ones, then you want to list out that 1 invalid one in the error message.
As per my knowledge, this is not possible because Select will be always sy-subrc 0 even if 1 plant matches the criteria. Actually you can't check that what is in your select-options table s_plant. It will not always be a simple list of plants, it can be something like
>1100...... BT 1000 and 2000....... NE 1100....
So, in that case how can you know that which was NOT valid. e.g BT 1000 and 2000, you will never want to give a list of all numbers between 1000 and 2000 which are not valid plant codes, right ?
So, select-options validation with select only ensures that there is atleast 1 valid data, listing out the invalid one can be done with parameters only.
BR,
Diwakar
2011 Aug 16 7:13 AM
2011 Aug 12 5:54 AM
Hi
You can validate this through parameters statement.
using select statement you can fetch only the entries which are valid .
As we know that Select statment retrieves only the valid entries which are given in the condtion and select-options internal table will hold only value range.
The scenario will not match for your requirement using select-options.
Thanks
Hariharan
2011 Aug 12 6:00 AM
2011 Aug 12 6:11 AM
The link posted by Dhina further confirms my above post that it is not possible to display all invalid plants with select-options and is used to check that whether atleast 1 valid plant is existing or not.
Diwakar
2011 Aug 12 6:23 AM
Hi
I too have checked the post .
TYPES: BEGIN OF TY_T001W,
WERKS TYPE T001W-WERKS,
END OF TY_T001W.
DATA : L_WERKS TYPE TABLE OF TY_T001W,
W_WERKS TYPE TY_T001W.
DATA : GV_WERKS TYPE T001W-WERKS.
SELECT-OPTIONS S_PLANT FOR GV_WERKS.
SELECT WERKS INTO W_WERKS UP TO 1 ROWS
FROM T001W
WHERE WERKS IN S_PLANT.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE 'No valid Sales Order selected for the input range. Please check.' TYPE 'E'.
ENDIF.This code will chec kif both low and high values are not available .
if you have valid entries it will not work.
Thanks
Hariharan
2011 Aug 12 3:30 PM
Hi
try to do something like this.
Always validate those things on the events of AT SELECTION-SCREEN
tables: T001w.
data: w_werks like T001W-WERKS.
SELECT-OPTIONS S_PLANT FOR T001W-WERKS.
AT SELECTION-SCREEN ON s_plant.
if s_plant[] is not initial.
SELECT single WERKS INTO W_WERKS
FROM T001W
WHERE WERKS IN S_PLANT.
if sy-subrc <> 0.
message ' error no valido' type 'E'.
endif.
endif.
Regards
Miguel
2011 Aug 13 8:12 PM
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |