Home > SAP Tips > SAP best practices
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SAP BEST PRACTICES

Select Text fields: Case-insensitive


Carsten Wagener
07.02.2008
Rating: -5.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Searching for strings (parts or with pattern) is cumbersome if the table field isn't defined as case-insensitive.

Example:

Search all requests in "E07T" where "AS4TEXT" contains "Sales."

With a normal SELECT * FROM E070T WHERE AS4TEXT LIKE gv_text" values like SALES or sales will not be found.

By using EXEC-SQL, there's a way to do this selection Case-insensitive:

Code

REPORT xy.
DATA:
  gt_e07t       TYPE TABLE OF e07t WITH HEADER LINE,
  gv_reqtxt(60).

PARAMETERS p_text TYPE rzielort.

*** Selection by Request text
*** Native SQL needed since as4text is case sensitive but we
*** want to search case-insensitive
gv_reqtxt = p_text.
TRANSLATE gv_reqtxt TO UPPER CASE.
CONCATENATE '%' gv_reqtxt '%' INTO gv_reqtxt.
*** Change SAP-wildcards to DB-wildcards TRANSLATE gv_reqtxt USING '*%'.
TRANSLATE gv_reqtxt USING '+_'.
EXEC SQL PERFORMING append_e07t.
  SELECT * FROM e07t INTO :gt_e07t
      WHERE upper(as4text) LIKE :gv_reqtxt ENDEXEC.
DESCRIBE TABLE gt_e07t LINES sy-dbcnt.
CHECK sy-dbcnt GT 0.

LOOP AT gt_e07t.
  WRITE: / gt_e07t-trkorr, gt_e07t-as4text.
ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  append_e07t
*&---------------------------------------------------------------------*
*         text
*-----------------------------------------------------------------------*
FORM append_e07t.
  APPEND gt_e07t.
ENDFORM.                    "append_e07t

Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
SAP ABAP
The difference between an SAP system and a non-SAP system
Is C, C++ and Java knowledge required when learning SAP?
Getting started with a NetWeaver career
How to be a self-taught NetWeaver and ABAP expert
Is SAP BI knowledge advantageous to an ABAP user?
An ABAP user wants to learn XI
Finding BADIs you can use
Is ABAP knowledge necessary for SAP BI?
Quiz: SAP ABAP development
Is this the quickest way to find a BADI?
SAP ABAP Research

SAP Front-ends
The difference between an SAP system and a non-SAP system
Is C, C++ and Java knowledge required when learning SAP?
Finding BADIs you can use
Quiz: SAP ABAP development
SAP exec discusses Imagineering, the future of development
Is there a 'load of program' option in report generation?
Deleting entries from a dynamic table
Defining a structure in a report
The stars of TechEd: SAP application demos
Error when reading XML files in SAP

SAP Interface Technologies
Is C, C++ and Java knowledge required when learning SAP?
An ABAP user wants to learn XI
Finding BADIs you can use
Quiz: SAP ABAP development
SAP exec discusses Imagineering, the future of development
Tools for enabling SAP screens on a BlackBerry
Is there a 'load of program' option in report generation?
Deleting entries from a dynamic table
Defining a structure in a report
SAP applications demo: BP's key mapping

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
ABAP  (SearchSAP.com)
ABAP Objects  (SearchSAP.com)
ABAP Workbench  (SearchSAP.com)
BAPI  (SearchSAP.com)
CATT  (SearchSAP.com)
R/3 Repository  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

HomeNewsTopicsBlogsTipsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts