‎2006 May 05 10:56 AM
Hi Folks
iam creating a Ztable , for filed1 in the table , i set the value range in the domain as 1, 2, 3 ,
now if iam trying to manually enter the value ( eg: 4) other than 1,2,3 it is not allowing , up to this is good
but in the program when i trying to insert the value ( 4 , other than the given range )by using insert statement . the result is the values is updated sucessfully and sy-subrc= 0.
could you please why the insert operation is suceesful? and is there any way to resrtict this?
Thanks
Best regards
priya
‎2006 May 05 11:03 AM
hi,
value range is for getting values from the drop down list for the field.thats y insert is successful.
hope this helps,
priya.
Message was edited by: Priya
‎2006 May 05 11:03 AM
hi
define your values thru value table and define the necessary foreign key check.
Cheers,
Abdul
‎2006 May 05 11:08 AM
Hi,
even if you have restricted the value range in the domain (this is a control at application level), the INSERT statement bypass this control. In fact it is a DB statement and checks only the field type (for example it would give you an error if you try to insert a CHAR value into a field defined as NUMC).
For example the domain allows you to restrict the value range for user input in a dynpro. You should make some checks in ABAP before the INSERT statement, or use a foreign key check using a control table .
Regards,
Manuel
‎2006 May 05 11:10 AM
Hello Priya,
When u try and enter values manually then the associated domain check is applied as the program validates the data but when u use INSERT it is at database level and no validations are applied of domain or otherwise..
‎2006 May 05 11:13 AM
Hi Priya,
If you still want to validate it against the fixed values,
then use the FM
GET_DOMAIN_VALUES and then validate:
CALL FUNCTION 'GET_DOMAIN_VALUES'
EXPORTING
domname = <Domain Name>
TEXT = 'X'
FILL_DD07L_TAB = ' '
TABLES
values_tab = t_domain_values
VALUES_DD07L =
EXCEPTIONS
no_values_found = 1
OTHERS = 2
.
Check if the entered value is in t_domain_values before you insert into the table.
Regards,
Ravi
‎2006 May 05 11:16 AM
Hi,
For insert statement, value check in domain is not considered.
U can do so by defining the value as foriegn key related to some master field value mainted in some other table..
Also u can use a dropdown box..
Regards,
Tanveer.
Please mark helpful answers
‎2006 May 05 11:16 AM
Hi Priya
if you enter the values in a table using screens.. then only all the value validations takes place coz users actions on the screen triggers various events in the program and subsequent validation takes place
but if you directly enter the values thorugh coding in ABAP edititor.. then no such validations takes place..and all the values get updated in the database without any input check and this may be the reason ..we use table maintenance generator for maintaining different tables
Thanks
‎2006 May 05 11:37 AM
Hi Priya,
1. Why the insert operation is successful ?
ans : because even if you have restricted the value range in the domain (this is a control at application level), the INSERT statement bypass this control. In fact it is a DB statement and checks only the field type (for example it would give you an error if you try to insert a CHAR value into a field defined as int4.)
2. How to restrict this ?
Ans : You can restrict this by making a foreign key check on that field.
Another way to do so is have a dropown listbox, whihc contains the values 1,2,3 . So the user will only be able to insert these values and no other.
Regards,
Kunal.