ADR6
. The field where the e-mail address is stored is SMTP_ADDR
, which has a data element with a case-sensitive domain handling 241 characters. Since the field is case-sensitive, we have e-mail addresses with a mixture of uppercase and lowercase letters, e.g.:SMTP_SRCH
in table ADR6
which is provided to simplify the search by storing the e-mail address uppercase. However, there is a serious limitation to this solution. The field is only 20 characters long. Since many e-mail addresses are longer than 20 characters, the field isn’t very useful.SMTP_ADDR
ot uppercase in the SELECT
statement when selecting directly from the database table ADR6
:DATA user_email TYPE ad_smtpadr.
TRY.
" Note that table and field names must be uppercase
EXEC SQL.
SELECT
SMTP_ADDR
INTO :user_email
FROM ADR6
WHERE CLIENT = :sy-mandt
AND UPPER(SMTP_ADDR) = 'Q.W@R.S'
ENDEXEC.
CATCH cx_sy_native_sql_error INTO DATA(native_sql_excecption).
DATA(error_text) = |{ native_sql_excecption->get_text( ) } SQL CODE: { native_sql_excecption->sqlcode } MSG: { native_sql_excecption->sqlmsg }|.
MESSAGE error_text TYPE 'E'.
ENDTRY.
WRITE: / user_email.
ADR6
is lowercase q.w@r.se
, the entry is still found.ADR6
:DATA user_email TYPE ad_smtpadr.
TRY.
" Using the DDL SQL View of the CDS works
EXEC SQL.
SELECT
EMAIL
INTO :user_email
FROM ZCDSCPEMAIL
WHERE MANDT = :sy-mandt
AND UPPER(EMAIL) = 'Q.W@R.S'
ENDEXEC.
CATCH cx_sy_native_sql_error INTO DATA(native_sql_excecption).
DATA(error_text) = |{ native_sql_excecption->get_text( ) } SQL CODE: { native_sql_excecption->sqlcode } MSG: { native_sql_excecption->sqlmsg }|.
MESSAGE error_text TYPE 'E'.
ENDTRY.
WRITE: / user_email.
ADR6
:DATA user_email TYPE ad_smtpadr.
TRY.
" Using the CDS name does not work
EXEC SQL.
SELECT
EMAIL
INTO :user_email
FROM ZCDS_CONTACT_EMAIL
WHERE MANDT = :sy-mandt
AND UPPER(EMAIL) = 'Q.W@R.S'
ENDEXEC.
CATCH cx_sy_native_sql_error INTO DATA(native_sql_excecption).
DATA(error_text) = |{ native_sql_excecption->get_text( ) } SQL CODE: { native_sql_excecption->sqlcode } MSG: { native_sql_excecption->sqlmsg }|.
MESSAGE error_text TYPE 'E'.
ENDTRY.
WRITE: / user_email.
You tried to work with the name of a table or view that does not exist in the database SQL CODE: 208 MSG: Invalid object name 'ZCDS_CONTACT_EMAIL'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |