10G-form: How to do MULTIPLE WORD OR SINGLE WORD SEARCH at ITEM?

I am using 10G DB + 10G Form Builder.
I've 'database_item' where I am storing multiline text data.
I want to do MULTIPLE WORD OR SINGLE WORD SEARCH at this item through FORM.
I've tried by creating the following NON Database Items on the form:
- multiline_search_text_item, and
- multiline_result__text_item
And then writing execute_query in KEY-NEXT-ITEM trigger.
I've also tried using this in the POST-TEXT-ITEM at multiline_search_text_item:
select table.database_item into :multiline_result__text_item from table where multiline_search_text_item = :multiline_search_text_item;
Pl help me asap.
Gaurav

What you want to do is not clear.
The query you wrote will select records where the table contains exactly what has been written in the search item. You can use LIKE and a wildcard search to find records which contain the search text:
select table.database_item into :multiline_result__text_item
from table
where multiline_search_text_item LIKE '%'||:multiline_search_text_item||'%';
You can use UPPER to make this case insensitive:
select table.database_item into :multiline_result__text_item
from table
where Upper(multiline_search_text_item) LIKE Upper('%'||:multiline_search_text_item||'%');
But I suspect you want either to match the individual words in the search text to individual words in the database multiline field, or find records where the search words appear (not necessarily as whole words). In that case, check out the following:
-- set up a table (multiline and various whitespaces)
DROP TABLE t;
CREATE TABLE t AS
SELECT
  ROWNUM rn,
  owner||Chr(9)||object_name||Chr(160)||subobject_name||'    '||object_id||' '||
  data_object_id||Chr(10)||object_type||' '||created||' '||last_ddl_time||' '||
  timestamp||' '||status||' '||temporary||' '||generated||' '||secondary AS col
FROM all_objects;
-- check the format of the multiline text item (col)
SELECT * FROM t WHERE ROWNUM < 4;
-- a type for the function below
CREATE TYPE string_tab AS TABLE OF VARCHAR2(255);
-- this function takes a string and cuts out each word, idetifying words
-- as being separated by any whitespace.  it returns a collection
CREATE OR REPLACE FUNCTION string_to_tab(
  p_string IN VARCHAR2) RETURN string_tab IS
  l_string LONG DEFAULT
    RTrim(regexp_replace(p_string,'[[:space:]]+',' ')) || ' ';
  l_data string_tab := string_tab();
  n NUMBER;
BEGIN
  LOOP
    EXIT WHEN l_string IS NULL;
    n := InStr(l_string, ' ');
    l_data.extend;
    l_data(l_data.Count) := LTrim(RTrim(SubStr(l_string, 1, n - 1)));
    l_string := SubStr(l_string, n + 1);
  END LOOP;
  RETURN l_data;
END string_to_tab;
-- selecting from t where ANY of the words in the search text has
-- a match in the multiline field (as a word or part of a word), so SYS
-- matches to MDSYS and SYSTEM
SELECT DISTINCT
  t.rn, t.col
FROM
  t,
  (SELECT column_value
   FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
WHERE InStr(t.col,x.column_value) > 0;
-- selecting from t where ALL of the words in the search text has
-- a match in the multiline field (as a word or part of a word), so SYS
-- matches to MDSYS and SYSTEM
SELECT rn, col FROM(
SELECT
  t.rn, t.col, cnt_x, Count(*) cnt
FROM
  t,
  (SELECT column_value , Count(1) over(PARTITION BY 1)cnt_x
   FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
WHERE InStr(t.col,x.column_value) > 0
GROUP BY t.rn, t.col, cnt_x
WHERE cnt = cnt_x;
-- selecting from t where ANY of the words in the search text
-- match a word in the multiline field, so SYS matches only to SYS
SELECT DISTINCT
  t.rn, t.col
FROM
  t,
  (TABLE(CAST(string_to_tab(t.col) AS string_tab))) t2,
  (SELECT column_value
   FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
WHERE t2.column_value = x.column_value;
-- selecting from t where ALL of the words in the search text
-- match a word in the multiline field, so SYS matches only to SYS
SELECT rn, col FROM(
SELECT
  t.rn, t.col, cnt_x, Count(*) cnt
FROM
  t,
  (TABLE(CAST(string_to_tab(t.col) AS string_tab))) t2,
  (SELECT column_value , Count(1) over(PARTITION BY 1)cnt_x
   FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
WHERE t2.column_value = x.column_value
GROUP BY t.rn, t.col, cnt_x
WHERE cnt = cnt_x;For your application you would replace 'SYS INDEX' with a variable (the search field). You can use upper() and wildcards for case insensitive & 'fuzzy' searches. You might need to modify the function so it removes other delimiters such as commas and colons.

Similar Messages

  • How to send multiple attachements in single mail

    Hi All,
    Currently i am using this function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with only one attachment.
    But now i need to send multiple attachments to a single mail.
    Can any one please tell me as how to send multiple attachments in single mail.
    Thanks in advance.

    Hi
    See this and do accordingly
    Mailing with Attachment by ABAP Coding  
    Refer this link:
    Mail with attachment.
    FORM send_list_to_basis .
      DATA: w_path      LIKE rlgrap OCCURS 0 WITH HEADER LINE,
            lt_index    TYPE sy-tabix,
            doc_type(3) TYPE c,
            descr       LIKE it_objpack_basis-obj_descr,
            temp_data   LIKE w_path,
            temp1       TYPE string,
            tab_lines   TYPE i,
            langu(15)   TYPE c,
            expirydate  TYPE so_obj_edt,
            L_FILE1(100).
      CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
      W_PATH-FILENAME = L_FILE1.
      APPEND w_path.
      CLEAR w_path.
      wa_doc_chng-obj_descr  = 'User List not logged on for 180 days'.
      wa_doc_chng-obj_langu  = 'E'.
      wa_doc_chng-obj_expdat = sy-datum.
      CLEAR w_subject.
      CONCATENATE 'Please find attached document with list of users'
                  'not logged on for 180 days for client' sy-mandt
                  INTO w_subject SEPARATED BY space.
      it_objtxt_basis-line = w_subject.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      it_objtxt_basis-line = text-004.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      CLEAR w_tab_line.
      DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
      READ TABLE it_objtxt_basis INDEX w_tab_line  INTO l_cline.
      wa_doc_chng-doc_size =
       ( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
      CLEAR it_objpack_basis-transf_bin.
      it_objpack_basis-head_start = 1.
      it_objpack_basis-head_num   = 0.
      it_objpack_basis-body_start = 1.
      it_objpack_basis-body_num   = w_tab_line.
      it_objpack_basis-doc_type   = 'RAW'.
      APPEND it_objpack_basis.
      CLEAR it_objpack_basis.
      LOOP AT w_path.
        temp1 = w_path.
        descr = w_path.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '\'
            string    = descr
          IMPORTING
            head      = descr
            tail      = temp_data.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '.'
            string    = descr
          IMPORTING
            head      = temp_data
            tail      = doc_type.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename      = temp1
            filetype      = 'BIN'
            header_length = 0
            read_by_line  = 'X'
            replacement   = '#'
          TABLES
            data_tab      = it_upload.
        DESCRIBE TABLE it_upload LINES tab_lines.
        DESCRIBE TABLE it_objbin_basis LINES lt_index.
        lt_index = lt_index + 1.
        LOOP AT it_upload.
          wa_objbin_basis-line = it_upload-line.
          APPEND wa_objbin_basis TO it_objbin_basis.
          CLEAR wa_objbin_basis.
        ENDLOOP.
        it_objpack_basis-transf_bin = 'X'.
        it_objpack_basis-head_start = 0.
        it_objpack_basis-head_num   = 0.
        it_objpack_basis-body_start = lt_index.
        it_objpack_basis-body_num   = tab_lines.
        it_objpack_basis-doc_type   = doc_type.
        it_objpack_basis-obj_descr  = descr.
        it_objpack_basis-doc_size   = tab_lines * 255.
        APPEND it_objpack_basis.
        CLEAR it_objpack_basis.
      ENDLOOP.
      it_reclist_basis-receiver = '[email protected]'.
      it_reclist_basis-rec_type = 'U'.
      APPEND it_reclist_basis.
      CLEAR it_reclist_basis.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_objpack_basis
          contents_txt               = it_objtxt_basis
          contents_bin               = it_objbin_basis
          receivers                  = it_reclist_basis
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc EQ 0.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
      ENDIF.
    ENDFORM.                    " send_list_to_basis
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to attach Multiple attachments to single mail

    How to attach multiple pdfs to single mail  ?
    or
    how to attach one pdf & One excel & One word document to single mail ?
    Thanks In Advance

    Hello Karunya,
    Please refer to the link below.
    https://wiki.sdn.sap.com/wiki/display/Snippets/Send%20email%20with%20multiple%20zipped%20attachments
    Regards,
    P Bansal

  • How To Use Multiple Currencies in single payroll ........

    Dear All
    Can you help me How To Use Multiple Currencies in single payroll?
    with regards
    User600722

    I am not a functional expert. but ML Note 150173.1 (which is quite old) states that this is not possible.
    Srini

  • How to Pass multiple parameter into single store procedure

    How to Pass multiple parameter into single store procedure
    like a one to many relationship.
    it is possible then reply me immediatly

    you mean like this .....
    CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
    BEGIN
    DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
    END display_me;
    CREATE OR REPLACE procedure display_me_2 as
    cnt integer :=0;
    BEGIN
    For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
         display_me(in_param => c1_rec.empno);
         cnt := cnt+1;
         end loop;
         DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
    END display_me_2;
    SQL > exec display_me_2
    Values is .....9999....Default
    Values is .....4567....Default
    Values is .....2345....Default
    Values is .....7369....Default
    Values is .....7499....Default
    Values is .....7521....Default
    Values is .....7566....Default
    Values is .....7654....Default
    Values is .....7698....Default
    Values is .....7782....Default
    Values is .....7788....Default
    Values is .....7839....Default
    Values is .....7844....Default
    Values is .....7876....Default
    Values is .....7900....Default
    Values is .....7902....Default
    Values is .....7934....Default
    Values is .....1234....Default
    Total record count is ....18

  • How to uploade multiple flatfiles for single transaction using BDC?

    How to uploade multiple flatfiles for single transaction using BDC?

    Hi,
    You need to upload all data files into an internal table first either using OPEN DATASET (application server files) or GUI_UPLOAD (PC files).
    Then loop at the internal table and call BDC transaction to process the data.
    Regards,
    Ferry Lianto

  • Posting multiple invoices against single purchase order line item

    Hi,
    We receive invoices on completion of certain milestones and Goods receipt is done when the final lot of material is delivered.  For example the purchase order may be to deliver 1 quantity of Machine.  Material is supplied in bits like Gear Box, Engine and body.  Invoice is received when Gear Box, Engine is supplied. Final invoicing is received on completion of delivery (taking into account what has already been delivered)
    Goods Receipt in SAP needs to be posted only once when complete machinery is delivered (the tracking for different parts delivered is done outside SAP).  However, the multiple invoice needs to be posted in SAP referring to same PO item (Please note PO quantity for complete assembled material is only 1).
    This needs to be treated as material and not service in SAP.  Can you please suggest how to book multiple invoices for same purchase order line item?
    Thanks

    Hi Charan
    Thanks for your reply.  However, both the options are not feasible.  Invoices can be received in different periods, sometimes over different months or years, hence needs to be booked immediately.
    Also, i cannot create material master for each component as the quantity for the final material is only 1.
    Any other alternatives?
    regards
    Sameer

  • Parameter form - how to enter multiple values, e.g. IN (:p_status)

    On a parameter form, how would I enter in multiple parameters at reports runtime. In my query I have
    WHERE status IN (:p_status)
    I always get 0 records, no matter what punctuation I put in between the data on the Parameter form. What is the correct way for doing this?

    Hi,
    Try using
    IN (&p_status)

  • 10G Forms-How 2 create link of searched file stored in DB?

    1. I've table named document which stores File_NAME, DOC_SIZE, LAST_UPDATED, etc. info;
    2. I have .doc, .pdf, .txt files stored in the document table;
    3. Using Oracle 10G Form Builder:
    -I've created form in which I can view the columns (NAME, DOC_SIZE, LAST_UPDATED, etc.); and then able to do search for NAME using LOV.
    I want to create a link or button just in front of queried data/record from where I can download that particular file stored in the DB.
    Pl help me out.
    Thanks.
    Gaurav

    Hi ,
    configure the webutil ... then download the webutil demo ....:
    http://www.oracle.com/technology/products/forms/htdocs/webutil/Webutil_demo.zip
    and then adjust your program requirements suitably....!!!!!!!!!!
    Good luck
    Simon

  • 10G-Form: How to add Email-id to the To: field in the Outlook?

    I am using 10G DB + 10G Form Builder.
    I've 'email_item' field in table where I am storing email-ids.
    I m displaying 'email_item' field and 'Send_Email_button' in the form.
    I want to add (copy) the exact email-id that has been displayed on the form to the To: field in the Outlook.
    Means whatever Email got displayed in the 'email_item' field, I want to add this Email automatically.
    I do not want to type manually the email-id of the person in the To: field of the Outlook like I am using rt. now as:
    WHEN-BUTTON-PRESSED trigger code=
    WEB.SHOW_DOCUMENT ('mailto:hard_coded_value_of_email?subject=Testing%20Email: &body=Please%20check............');
    Pl help me.
    Gaurav

    Hi,
    For getting the email ID you can write a java code using the Iuser Interface. Have look to the following:
    public class UseremailID extends AbstractPortalComponent
    public void doContent(
    IPortalComponentRequest request,
    IPortalComponentResponse response)
    try
    IUserFactory userfactory = UMFactory.getUserFactory();
    IUserSearchFilter userfltr = userfactory.getUserSearchFilter();
    userfltr.setMaxSearchResultSize(5000);
    ISearchResult userResult = userfactory.searchUsers(userfltr);
    while (userResult.hasNext())
    response.write("<table border=0>\n");
    String uniqueid = (String) userResult.next();
    IUser user = userfactory.getUser(uniqueid);
    //IRole role = rolefactory.getRole(uniqueid);
    response.write("<tr><td bgcolor=Red>"+ user.getDisplayName()+ "</td></tr>\n");
    response.write("<tr><td bgcolor=Green>"+ user.getEmail()+ "</td></tr>\n");
    response.write("</table>\n");
    response.write("
    \n");
    catch (Exception e)
    for analyzing the error you just need to check the log file at your server. Visit the following path:
    <Your_SAP_Drive> :/usr/sap/<your_System_Name>/jc00/j2ee/cluster/server0/log/
    There you can view the .trc file. Open that file and look for the error or the Stack trace in that.
    i think it may help you

  • How to use multiple table in single control file?

    Hi,
    How to use multiple table and data file in sigle control file? I have a four table and four csv file i mean data file for that. I am running concurrent program to load the data from csv file to custom table. based on my input data file name, it has to take automatically from one control file.
    Can anyone share with me how can i acheive this?
    Thanks

    Hi,
    Can't we acehive like below. I don't this exactly corrcect.
    OPTIONS (SKIP=1)
    LOAD DATA
    INFILE << file name 1 >>
    APPEND INTO TABLE XXCZ_VA_SAMPLE1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
         PARENT_ITEM               "TRIM(BOTH FROM :PARENT_ITEM)"
    LOAD DATA
    INFILE << file name 2 >>
    APPEND INTO TABLE XXCZ_VA_SAMPLE2
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
         ITEM_NUMBER               "TRIM(BOTH FROM :ITEM_NUMBER)"
    )Edited by: orasuriya on Sep 14, 2009 3:03 AM

  • How to set to bold a single word in the text box?

    How can I set to bold a single word in the text box? When I try, it puts the whole text bold.

    you should do this by HTML way
    like this :
    sym.$("your text box Name").html("Hello i'm <strong>Bold</strong> one")
    Zaxist

  • How to configure multiple databases in single listener

    Hi,
    I want to configure upto 8 standby databases in a server. But I do not know how to configure multiple databases within the listener.
    Also can I use the same port number for all the databases.
    please give your suggestions.
    thankyou
    satyanag

    Please check (http://download.oracle.com/docs/cd/B10501_01/network.920/a96580/toc.htm)
    Jonathan Ferreira
    http://oracle4dbas.blogspot.com

  • How to print multiple pages in single spool in smartforms

    Hi all,
      I have a issue on to print multiple pages in single spool,i can able to print multiple pages in multiple spool .I am doing Check Print smartforms in that i need to print Multiple pages in single spool.Currently i am using the below code please help to solve this issue.
    IF gv_tabix = 1.
    lwa_outp_option-tdnewid = 'X'.
    ELSE.
    lwa_outp_option-tdnewid = ' '.
    ENDIF.
    Thanks,
    Deesanth

    Hi
    TABLES: spfli.
    DATA:
      t_spfli type STANDARD TABLE OF spfli.
    DATA:
      fs_spfli TYPE spfli.
    DATA:
      w_form TYPE tdsfname,
      w_flag TYPE i,
      f_nam TYPE rs38l_fnam,
      w_input TYPE ssfcompin,
      w_control TYPE ssfctrlop.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECT-OPTIONS s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK blk .
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.
    PARAMETERS:
      p_single RADIOBUTTON GROUP rad1,
      p_ind RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN END OF BLOCK block1.
    START-OF-SELECTION.
    PERFORM display_data.
    PERFORM ssf_function_module_name.
    PERFORM spool_request.
    *& Form display_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM display_data .
    SELECT * FROM spfli INTO TABLE t_spfli WHERE carrid IN s_carrid.
    ENDFORM. " display_data
    *& Form ssf_function_module_name
    * text
    * --> p1 text
    * <-- p2 text
    FORM ssf_function_module_name .
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING formname = ' '
    IMPORTING fm_name = f_nam
    EXCEPTIONS no_form = 1
    no_function_module = 2.
    * IF sy-subrc NE 0.
    * MESSAGE 'Form cannot be displayed' TYPE 'E' .
    * ENDIF. " IF sy-subrc eq 0
    ENDFORM. " ssf_function_module_name
    *& Form spool_request
    * text
    * --> p1 text
    * <-- p2 text
    FORM spool_request .
    w_input-dialog = 'X'.
    CALL FUNCTION 'SSFCOMP_OPEN'
    EXPORTING input = w_input
    EXCEPTIONS error = 1.
    *" LOOP AT t_spfli .....................................................
    LOOP AT t_spfli INTO fs_spfli.
    w_control-no_open = ' '.
    w_control-no_close = ' '.
    *"Single spool request..................................................
    IF p_single EQ 'X'.
    w_control-no_open = 'X'.
    w_control-no_close = 'X'.
    ELSE.
    *"Individual spool request.............................................
    IF w_flag NE '1'.
    w_control-no_open = 'X'.
    w_control-no_close = ' '.
    w_flag = 1.
    CALL FUNCTION ' '
    EXPORTING control_parameters = w_control
    fs_spfli = fs_spfli
    EXCEPTIONS formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4.
    endif. " IF w_flag ne '1'
    ENDIF. " IF p_single eq 'X'.
    CALL FUNCTION ' '
    EXPORTING
    control_parameters = w_control
    fs_spfli = fs_spfli
    EXCEPTIONS formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4.
    ENDLOOP. " LOOP at t_spfli into ...
    *&This function module close the spool request *
    CALL FUNCTION 'SSFCOMP_CLOSE'
    EXCEPTIONS error = 1.
    ENDFORM. " spool_request
    Regards,
    Sravanthi

  • How to Concat multiple columns to single column at the report level

    Hi All,
    I have a requirement in such a way that I have to concat multiple colulmns to single column at the report level.
    First of all the column I am using in my report is "X" with datatype as Integer. Now  if the length of this column "X" is <8 then I have add zero's (0) before the number.
    And then I have to concat with a column "Y" and then cocnat with a column "Z" and finally the datatype should be casted to CHAR.
    Can anyone please let me know the logic how I can add to my column so that it satisfies all the above.
    Thanks All

    >Also, Another thing is if X < length of 8 Ihave to append with zero's..
    >Ex: if the actual value of X is 123456 i wanted to show it as 000123456.
    Try to be consistence what you said, you are looking for 8 length and above ex is 9 in length.
    You need to learn many things one of those is CASE, at least do copy and also read
    Forums Etiquette/Reward Points

Maybe you are looking for

  • Oracle Forms & Reports 11.1.2 with WebLogic 10.3.5 - Creating Domain 0%

    I would be grateful if someone could point out where I'm going wrong here...... I am attempting to install Forms and Reports 11g (11.1.2.0.0) 64-bit edition on a Windows 2008 Server (R2 x64). Step 1: download and install jdk-7u3-windows-x64.exe Step

  • IBM 240X with Unmountable_Boot_Volume

    The laptop turned off after a sudden power failure. After reboot, the error of unmountable_boot_volume displayed. Without a floppy drive, is there any method to resolve it?

  • Coherence in SOA BPEL Java Embedding error

    I am trying to use Coherence to cache message in SOA BPEL process. The BPEL process is deployed into WebLogic 10.3.2 on SOA 11g platform. Withing the BPEL, I use Java Embedding, try to cache a meesage on another coherence instance (Running as a serve

  • Need help in Developing the Smartform for Delivery notes

    I'm developing the smartform for tcode vl02n. My question is when writing the print program which is the best way : 1) By making use of standard print program RLE_DELNOTE 2) developing from scratch by declaring my own types and subroutines as per my

  • Hiding 403 text in KM?

    Hi All, In our portal landing page, we are displaying a sales graph, once we click on sales graph users will be able to see detailed graph. Currently we are in a process of differentiating these graphs between the users, so we are decided to give thi