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

How to automatic validity check in select screen

Former Member
0 Likes
1,557

Hi all

I was requested to set a fields like company code to select screen.

And designer tell me, if the company code input by user does not exist in T001, then SAP system can automatically display the error message.

How to do it if you donnot write a select sentence to check it?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,278

You cannot validate without writing a select statement.

Hi all

I was requested to set a fields like company code to select screen.

And designer tell me, if the company code input by user does not exist in T001, then SAP system can automatically display the error message.

How to do it if you donnot write a select sentence to check it?

8 REPLIES 8
Read only

rahulkavuri
Active Contributor
0 Likes
1,278

<<deleted>>

Read only

Former Member
0 Likes
1,278

do this way

tables : T001.

at selection-screen.
select single bukrs from T001 into T001 where bukrs in s_bukrs.
if sy-subrc <> 0.
  <Error Message>
endif.

Read only

Former Member
0 Likes
1,278
parameters : p_bukrs like t001-bukrs.

at selection-screen.

if not p_bukrs is initial.
   select single bukrs from T001 into t001-bukrs where bukrs eq p_bukrs.
   if sy-subrc ne 0
   set cursor field 'P_BUKRS'.
   message e001(ZZ) with 'Please enter valid company code'.
  endif.
endif.
Read only

Former Member
0 Likes
1,279

You cannot validate without writing a select statement.

Read only

Former Member
0 Likes
1,278

at selection-screen on p_bukrs.

select single * from T001 where bukrs = p_bukrs.

if sy-subrc ne 0.

message 'no co code is there' type 'E'.

endif.

start-of-selection.

regards

shiba dutta

Read only

Former Member
0 Likes
1,278

Hello Jack,

U can do like this:

tables : T001.
 parameters: p_bukrs like t001-bukrs.
at selection-screen on P_Bukrs.
select single bukrs from T001 where bukrs eq p_bukrs.
if sy-subrc <> 0.
  <Error Message>
endif.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
1,278

Hi,

GOOD.

But SAP have given the provision to validate only by using select statement.

U need to check the entries in the table. Then only you can validate.

So you have to write the select statement for validation as others told.

<b>Please reward points if helpful.</b>

Regards,

Abir.

Read only

Former Member
0 Likes
1,278

Actually the domain for BUKRS has a value table ,

This has to check automatically when that field is used,

but when i see the documentation for value table , it says

<b>Value table</b>

In some cases you already know when you define a domain that all the

fields referring to this domain should be checked against a certain

table. This information can be stored in the domain by entering a value

table.

The system proposes the value table as check table when you try to

define a foreign key for this field. You can override this proposal.

<b> Entering a value table does not implement a check. The check against the

value table only takes place when a foreign key is defined.</b>

so in this case may be foreign key is not defined as the value table is same as T001