cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Converting SELECT OPTION to upper case

luis_rod
Participant
0 Kudos
541

Hi all,

I have an issue converting a SELECT-OPTION variable to upper case.

If my input is done in upper case (e.g. *JHON*), this works(i.e., returns data):

DATA w_name TYPE lfa1-name1.
SELECTION-SCREEN BEGIN OF BLOCK block-1 WITH FRAME.
  SELECT-OPTIONS s_name FOR w_name NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK block-1.

TRANSLATE s_name-low TO UPPER CASE.
SELECT * FROM lfa1 WHERE name1 IN @s_name INTO TABLE @DATA(itab).

Now, as soon as I try to enter the data in lower case (e.g. *jhon*), the Select does not return any data, although doing a debug shows the value for s_name in upper case (after the TRANSLATE).

I know that there are a lot of workarounds that I could use, but I’ m curious why the difference, even though the variable's value seems to be the same.

TIA,

Luis

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

It's happening because your reference to translating S_NAME-LOW is in the header row, and not an update to the internal table that stores the data used in the query.

 

Regards,

Ryan Crosby

Answers (1)

Answers (1)

RaymondGiuseppi
Active Contributor

Remarks

  • LFA1-NAME1 domain is NAME and allows lowercase characters.
  • You should also translate HIGH subfield not only LOW (else wrong RANGE can trigger dump)
  • You should translate the whole internal table and not only hearder line (LOOP required)
  • Use field LFA1-MCOD1 which is in uppercase (should be identical to NAME1 but converted)

For recent versions you can use upper SQL function (WHERE UPPER(NAME1) IN <RANGE>)

luis_rod
Participant
0 Kudos

Thanks. That should do the trick (using MCOD1)