‎2005 Sep 10 6:47 PM
Hi all,
can anyone please tell me what a Check table is ?
thanks
Sabrina.
‎2005 Sep 10 8:59 PM
Hi Sabrina
The Check Table is the table used by system to check if a data exist or not exist.
While creating a table if you want to be sure that a field can have some values and these are in a certain table, you can give IT this table as CHECK TABLE.
For example: I've created my Z-TABLE where is a field KUNNR (customer). Now I want only custemers which are in master data table KNA1 can be inserted in my Z-table.
So I assign KNA1 as check table to field KUNNR in my Z-TABLE.
However this control is active only in the screens:
nothing'll be able to prevent to insert a wrong value in my Z-TABLE in a program.
If I write:
TABLES Z-TABLE.
Z-TABLE-KUNNR = 'AAAAAAAAAAA'.
MODIFY Z-TABLE.
The system'll update Z-TABLE even if the value 'AAAAAAAAAAA' isn't in KNA1. In this case the control can't work.
But if you use the field in a screen, if user insert 'AAAAAAAAAAA' and push enter, the system'll automatically give a error message. So you can avoid to check the existence in your program, it' useless to write
SELECT SINGLE * FROM KNA1 WHERE KUNNR = <FIELD_DYNPRO>.
IF SY-SUBRC <> 0.
........
The system'll do the control for you.
Max
Message was edited by: max bianchi
‎2005 Sep 10 7:00 PM
Hi,
Check table is kind of a validation for entry on screens
and maintaining referential integrity of RDBMS.
These are for defining foreing keys on table fields.
For exmple EKKO-LIFNR has a check table LFA1. This means that if you enter a vendor number which does not exist in LFA1 the system will throw an error.
Cheers.
‎2005 Sep 10 8:59 PM
Hi Sabrina
The Check Table is the table used by system to check if a data exist or not exist.
While creating a table if you want to be sure that a field can have some values and these are in a certain table, you can give IT this table as CHECK TABLE.
For example: I've created my Z-TABLE where is a field KUNNR (customer). Now I want only custemers which are in master data table KNA1 can be inserted in my Z-table.
So I assign KNA1 as check table to field KUNNR in my Z-TABLE.
However this control is active only in the screens:
nothing'll be able to prevent to insert a wrong value in my Z-TABLE in a program.
If I write:
TABLES Z-TABLE.
Z-TABLE-KUNNR = 'AAAAAAAAAAA'.
MODIFY Z-TABLE.
The system'll update Z-TABLE even if the value 'AAAAAAAAAAA' isn't in KNA1. In this case the control can't work.
But if you use the field in a screen, if user insert 'AAAAAAAAAAA' and push enter, the system'll automatically give a error message. So you can avoid to check the existence in your program, it' useless to write
SELECT SINGLE * FROM KNA1 WHERE KUNNR = <FIELD_DYNPRO>.
IF SY-SUBRC <> 0.
........
The system'll do the control for you.
Max
Message was edited by: max bianchi
‎2005 Sep 11 8:14 PM
thanks Sanjay and Max, your answers were very helpful.
Sabrina.