Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

select the text from lower case data element

Hello,

        There has been some instances where we want to select text from some data element which is lower case enabled, for example material characteristic values, text40 etc..

          Here we have a logic using selopt structure to get tevt like "ABCD" aBcd abCd abcD etc...

Error rendering macro 'code': Invalid value specified for parameter 'lang'
PARAMETER: pa_name TYPE text40.



DATA: ra_name TYPE STANDARD TABLE OF selopt,

      wa_name TYPE selopt,

      lv_name TYPE text40,

      lv_i TYPE i, lv_count TYPE i.



lv_name = pa_name.



lv_i = STRLEN( lv_name ).



DO lv_i TIMES.

  TRANSLATE lv_name+lv_count(1) TO UPPER CASE.

  wa_name-sign = 'I'.

  wa_name-option = 'EQ'.

  wa_name-low = lv_name.

  APPEND wa_name TO ra_name.   " ra_name in select (where ename in ra_name).

  WRITE:/ wa_name-low.

  lv_name = pa_name.

  lv_count = lv_count + 1.

ENDDO.

3 Comments

  1. Hello Smruti,

    can you please explain in more detail where such a functionality should be needed?

    Best regards
    Gregor 

    1. Former Member

      Hi Gregor,

      Above Post is added by MR.J@Y , i am just editing "added Show line numbers and syntax highlighter" .

      As per functionality if i understand correctly ...

       

      Above Functionality We required when search a record by ‘TEXT’ , like here Material Shot Text is an Example in SAP MM Module , Table : MAKT.

       

       Like I have five Material which shot text start with ‘MATERIAL’ Text , As we know material shot text enter by end user using MM01,MM02 T-code in SAP.


      Case # 1 :  Material Number : 000000000200000100

                      Shot text : Material

                       (In this Shot text if you see ‘M’ is Capital)

      ==============================================================================================

      Case # 2 : Material Number : 000000000200000101

                        Shot text : MaTerial

      (In this Shot text if you see ‘M’ is Capital,’T’ is Capital)

      =============================================================================================

       

      Case # 3 : Material Number : 000000000200000102

       

       

       

                        Shot text : MatErial

       

      (In this Shot text if you see ‘M’ is Capital ,’E’ is Capital)

       

       =================================================================================================

       

      Case # 4 : Material Number : 000000000200000104

       

       

       

                        Shot text : MateriaL

       

      (In this Shot text if you see ‘M’ is Capital ,’L’ is Capital)

       

       

       

      ================================================================================================ 

       

      Case # 5 : Material Number : 000000000200000104

       

       

       

                        Shot text : MAterial

       

      (In this Shot text if you see ‘M’ is Capital ,’A’ is Capital)


      ================================================================================================

      If you see all above case shot text is ‘MATERIAL’ but case is not same.

       

      Testing:

      I want to retrieve all Material Number from MAKT table where shot text (MAKTX) start with ‘MATERIAL’ and SPRAS = ‘EN’ (English)

       

      Test Case # 1 : 


      Output : 



       ================================================================================================================================


      Test Case # 2 :  In this Shot text if you see ‘M’ is Capital



      Output : 


      ===============================================================================================

      Test Case # 3:  In this Shot text if you see ‘M’ is Capital, ’T’ is Capital



      Output :



      ================================================================================================================


      Test Case # 4 :  Now I am merge both case # 2 and case #3  





      Output :



      =======================================================================================================

      Note : These are case which support the above functionality , if ‘Upper’ Case Field value not is available or not maintain for any text  but in SAP MAKT Table we can find a field ‘MAKTG’ which store the ‘Upper’ Case value to the respective shot text .

       

      Regard's

      Smruti





      1. Your solution is an absolute performance killer. If your customer needs case in-sensitive search on case-sensisive fields please advise him to use the Embedded Search with TREX.