Application Development 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: 

Fetching user id from email id

Former Member
0 Kudos
679

Hi All,

I am creating a FM where the input parameter is email id's.

Logic: i am passing this email id to adr6 table and fetching the adress number and personal number. However the emaid id i am getting in the FM is "XYZ@abc". But the email id stored in the user profile(adr6) is "Xyz@abc" in this case i am not able to fetch the required data as both the chars are diff.

Please help me in this regards.

Thansk and Regards,

Vijay.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
348

In [native SQL|http://help.sap.com/abapdocu_70/en/ABENNATIVESQL.htm], between [EXEC SQL|http://help.sap.com/abapdocu_70/en/ABAPEXEC.htm] and [ENDEXEC|http://help.sap.com/abapdocu_70/en/ABAPENDEXEC.htm] you could use a SELECT ... WHERE UPPER(SMTP_ADDR) = <input field translated to uppercase> but not on OPEN SQL.

Of course you can try to check the short SMTP_SRCH field which is uppercase, but only 20 characters long, or look for the first characters from parameters converted to uppercase, extracting records containing the start, and then checking in a LOOP/ENDLOOP if the whole parameter matches the address, small sample to illustrate

PARAMETER p_mail LIKE adr6-smtp_addr.

DATA: upper_mail LIKE adr6-smtp_addr,
      check_mail LIKE adr6-smtp_addr,
      itab_adr6 TYPE TABLE OF adr6,
      upper_srch LIKE adr6-smtp_srch.
FIELD-SYMBOLS <adr6> TYPE adr6.

SET LANGUAGE sy-langu.
upper_mail = p_mail.
TRANSLATE upper_mail TO UPPER CASE.
upper_srch = upper_mail.

SELECT * INTO TABLE itab_adr6
  FROM adr6
  WHERE smtp_srch = upper_srch.

LOOP AT itab_adr6 ASSIGNING <adr6>.
  check_mail = <adr6>-smtp_addr.
  TRANSLATE check_mail TO UPPER CASE.
  IF check_mail NE upper_mail.
    DELETE itab_adr6.
  ENDIF.
ENDLOOP.

Regards,

Raymond

2 REPLIES 2

Former Member
0 Kudos
348

I probably don't get your problem..

I suggest TRANSLATE <your_field> TO UPPERCASE and selecting ADR6 on SMTP_SRCH...

raymond_giuseppi
Active Contributor
0 Kudos
349

In [native SQL|http://help.sap.com/abapdocu_70/en/ABENNATIVESQL.htm], between [EXEC SQL|http://help.sap.com/abapdocu_70/en/ABAPEXEC.htm] and [ENDEXEC|http://help.sap.com/abapdocu_70/en/ABAPENDEXEC.htm] you could use a SELECT ... WHERE UPPER(SMTP_ADDR) = <input field translated to uppercase> but not on OPEN SQL.

Of course you can try to check the short SMTP_SRCH field which is uppercase, but only 20 characters long, or look for the first characters from parameters converted to uppercase, extracting records containing the start, and then checking in a LOOP/ENDLOOP if the whole parameter matches the address, small sample to illustrate

PARAMETER p_mail LIKE adr6-smtp_addr.

DATA: upper_mail LIKE adr6-smtp_addr,
      check_mail LIKE adr6-smtp_addr,
      itab_adr6 TYPE TABLE OF adr6,
      upper_srch LIKE adr6-smtp_srch.
FIELD-SYMBOLS <adr6> TYPE adr6.

SET LANGUAGE sy-langu.
upper_mail = p_mail.
TRANSLATE upper_mail TO UPPER CASE.
upper_srch = upper_mail.

SELECT * INTO TABLE itab_adr6
  FROM adr6
  WHERE smtp_srch = upper_srch.

LOOP AT itab_adr6 ASSIGNING <adr6>.
  check_mail = <adr6>-smtp_addr.
  TRANSLATE check_mail TO UPPER CASE.
  IF check_mail NE upper_mail.
    DELETE itab_adr6.
  ENDIF.
ENDLOOP.

Regards,

Raymond