Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Solution

Former Member
0 Likes
991

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
936

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

9 REPLIES 9
Read only

Former Member
0 Likes
936

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,

Read only

Former Member
0 Likes
936

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

Read only

0 Likes
936

Hi,

thank you very much

Regards,

Mani Murugan

Read only

Former Member
0 Likes
936

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

Read only

Former Member
0 Likes
936

hi,

refer the link you should get answer. Hope its very helpful for your requirement

Regards,

Dhina..

Read only

0 Likes
936

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

Read only

0 Likes
936

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

Read only

Former Member
0 Likes
937

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

Read only

Clemenss
Active Contributor
0 Likes
936

Hi manimurugan001

welcome.

[Please read "The Forum Rules of Engagement" before posting! HOT NEWS!! Pages: |;

[FAQ's, intros and memorable discussions in the ABAP General Forum|;

[How to post code in SCN, and some things NOT to do...|;

Regards

Clemens