2011 Jul 11 2:14 PM
Hello,
this bug (?) kept me busy quite a while: I have a table with a a foreign key field, a country ID.
In the same table I have another field for entering a name.
When the name field is of type CHAR(30) and I try to insert an invalid country ID via the menu I get an error message as expected. (name field empty, btw)
When the name field is of type SSTRING(30) and I try to insert an invald country ID via the menu I DO NOT get any error message and the entry is saved. (name field also left empty)
Everything else I left unchanged, switching the name field from CHAR to SSTRING back and forth switches the odd behavior off and on.
Can anybody reproduce this or tell me what I'm missing?
Thanks!
Hello,
this bug (?) kept me busy quite a while: I have a table with a a foreign key field, a country ID.
In the same table I have another field for entering a name.
When the name field is of type CHAR(30) and I try to insert an invalid country ID via the menu I get an error message as expected. (name field empty, btw)
When the name field is of type SSTRING(30) and I try to insert an invald country ID via the menu I DO NOT get any error message and the entry is saved. (name field also left empty)
Everything else I left unchanged, switching the name field from CHAR to SSTRING back and forth switches the odd behavior off and on.
Can anybody reproduce this or tell me what I'm missing?
Thanks!
2011 Jul 12 7:18 AM
Hi ,
i doubt if SSTRING is allowed to have 30 length .
It has a default length of 20 charaters and system does not allow to define a custom length for the same .
Regards ,
2011 Jul 12 8:39 AM
Hello,
good point, changed the length of the SSTRING field to 5 - still get the same odd behavior:
As long as I have any SSTRING field in my table (whether I fill it in or not), I can enter whatever value I want into my foreign key fields and the dataset will be saved without any error. As soon as I delete the sstring field, however, the foreign keys get checked correctly and I can't save datasets with invalid data in foreign key fields.
Can anybody replicate this?
Thanks
P.S. By the way: The system DOES require a length to be set for a field with SSTRING data type (1-255) - so the error shouldn't lie here.
2011 Jul 12 9:49 AM
Hi,
did you define a client field in table key, too? Foreign key for check table T005 uses both CLIENT and COUNTRY field.
Have you used foreign key field type option Key field/candidates ?
Regards,
Klaus
2011 Jul 12 9:53 AM
Thanks for your answer.
> did you define a client field in table key, too. Foreign key for check table T005 uses both CLIENT and COUNTRY field.
Yes.
> Have you used foreign key field type option Key field/candidates ?
No, but enabling it doesn't change anything. As long as I have a SSTRING field in the table, the foreign key is "ignored".
2011 Jul 12 9:55 AM
Hi,
Can you explain how you are entering the values in the field ? Is this a screen field or a direct table field used in se11.
For foreign key field checks, the foreign key field (in the other table) and the field in the current table must be of same type.
If you have declared the key field in the FK table as of type Char and then you use a SSTRING field in your secondary table, the key might not check. The data type of both the fields must match.
Titus
2011 Jul 12 10:08 AM
> Can you explain how you are entering the values in the field ? Is this a screen field or a direct table field used in se11.
SE11 -> Utilities -> Table Contents -> Create entries
> For foreign key field checks, the foreign key field (in the other table) and the field in the current table must be of same type.
Maybe it wasn't clear from my first posts: The SSTRING field has nothing to do with the foreign keys. I have one FK field of type CHAR(3) which I don't change. However, once I add one more (simple) SSTRING field to the table and try to create an entry (even leaving the SSTRING field empty) I get a success notice.
> If you have declared the key field in the FK table as of type Char and then you use a SSTRING field in your secondary table, the key might not check. The data type of both the fields must match.
They do match and their types are not changed. See above.
Do the following to replicate:
- Create new table with fields:
mandt mandt
primary key field
- try to enter invalid data in primary key -> error
- add field "test" to previous table, data element ***test with data type sstring, length 5
- try to enter invalid data in primary key -> success
2011 Jul 12 11:09 AM
Hi,
I can see your issue. I created a table ZTESTCOUNTRY without SSTRING field and foreign key check was working. When I added the SSTRING field it was working no more, because the country field on screen 0101 of program /1BCDWB/DBZTESTCOUNTRY had no more flags from dict and foreign key check as it had before.
Sorry, no solution without screen modification.
Regards,
Klaus
2011 Aug 10 1:52 PM
Got feedback from SAP support:
Note [512075|https://service.sap.com/sap/support/notes/512075] describes the behavior. It seems to only affect transaction SE16.
As a workaround, SAP suggests to create the view that includes all fields but the STRING/SSTRING field. That should put foreign key checking back to work.
Stefan
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |