Application Development and Automation 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: 
Read only

Conversion to Combination

Former Member
0 Likes
388

Hi all ,

i want to get a function module which will <b>convert abc</b> <b>to all the combination of abc like ABC , aBC , Abc etc</b> , and then fetch data depending on this ..

Plz help

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
367

I don't think there is any FM which can solve your purpose.

The best possible way, I can think is..

Get all the description into internal table from database

translate the description to Upper case

translate your input, e.g. ABC to upper case

delete the entries from the interal table which are not suitable for that.

Try this code which is similar to your requirment.


REPORT  ZTEST_NP.
 
TABLES: MAKT.
 
TYPES: BEGIN OF TY_MAKT,
       MATNR TYPE MATNR,
       MAKTX TYPE MAKTX,
       DESC  TYPE MAKTX,
       END   OF TY_MAKT.
 
DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
      WA_MAKT TYPE TY_MAKT.
 
SELECT-OPTIONS: S_MAKTX FOR MAKT-MAKTX VISIBLE LENGTH 15.
 
START-OF-SELECTION.
  SELECT MATNR MAKTX
         INTO  TABLE IT_MAKT
         FROM  MAKT.
  LOOP AT IT_MAKT INTO WA_MAKT.
    WA_MAKT-DESC = WA_MAKT-MAKTX.
    TRANSLATE WA_MAKT-DESC TO UPPER CASE.
    MODIFY IT_MAKT FROM WA_MAKT.
    CLEAR  WA_MAKT.
  ENDLOOP.
 
  LOOP AT S_MAKTX.
    TRANSLATE S_MAKTX TO UPPER CASE.
    s_maktx-option = 'CP'.
    concatenate '*' s_maktx-low  '*' into s_maktx-low.
    if not s_maktx-high is initial.
    concatenate '*' s_maktx-high '*' into s_maktx-high.
    endif.
    MODIFY S_MAKTX.
    CLEAR  S_MAKTX.
  ENDLOOP.
 
  DELETE IT_MAKT WHERE NOT DESC IN S_MAKTX.
 
  WRITE: 'Material contains entered pattern'.
  LOOP AT IT_MAKT INTO WA_MAKT.
    WRITE: / WA_MAKT-MATNR,
             WA_MAKT-MAKTX.
  ENDLOOP.

Regards,

Naimesh Patel

Read only

0 Likes
367

Thanks , any usage of class , can you just guide me ?