Solved

need of code

Posted on 2011-05-12
4
307 Views
Last Modified: 2012-05-11

   i have to send an email to the non-production database and it has to print the banner in the way given below in the placeholder
 i defined this placeholder and replaced in the replaced value section below
 io_email_replace_vals (179).fieldname := '|V_BANNER|'


  IF i_email_cd = 'APPROVAL_COMPLETE_BOM_2T_FULFILMENT' THEN
     
      io_email_replace_vals (179).fieldvalue :=
      '============= THE FOLLOWING SECTION WILL NOT APPEAR ON PRODUCTION ============= ' || CHR(10) ||
      'DB = ' ||v_db_name  || CHR(10) ||
      'TO = <to>'  || CHR(10) ||
      'CC = <cc>'  || CHR(10) ||
      'BCC= <bcc>' ;
     
      ELSE
      io_email_replace_vals (179).fieldvalue := '';
     
      END IF;

all this is defined in a procedure called replace_placeholder_values
im calling this proc in 'get_email_contents_proc'
so we have to use a replace function for tht
i have tried to give this way its not working

 IF v_email_cd = 'APPROVAL_COMPLETE_BOM_2T_FULFILMENT' THEN
               IF v_db_name<>'DMPROD' then
             
               o_email_subject := REPLACE (o_email_subject, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               o_email_to := REPLACE (o_email_to, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               o_email_cc := REPLACE (o_email_cc, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               v_email_replace_vals (l_cnt).fielname := REPLACE (v_email_replace_vals (l_cnt).fieldname,
               v_email_replace_vals (l_cnt).fieldvalue := REPLACE ((REPLACE ( v_email_replace_vals (l_cnt).fieldvalue,  '<to>', 'sthota@cisco.com')),
                                                '<cc>',
                                                 'kuchoudh@cisco.com'
                                                );
               
               o_email_text := clobreplace_fn (o_email_text,
                                               v_email_replace_vals (l_cnt).fieldname,
                                               NVL (v_email_replace_vals (l_cnt).fieldvalue, ' ')
                                              );
             
            END IF;
            END IF;

v_email_cd is message type
Can anyone explain why the above replace func is not working
0
Comment
Question by:thota198
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Walter Ritzel
Comment Utility
Would be possible to send all the code?
0
 

Author Comment

by:thota198
Comment Utility
this is the code from where the procedure is getting called from ' get_email_contents_proc'

 build_replaceable_values_tab (o_rc                       => o_rc,
                                    o_reason                   => o_reason,
                                    o_file_name                => o_file_name,
                                    o_file_data                => o_file_data,
                                    i_deal_id                  => i_deal_id,
                                    i_quote_object_id          => i_quote_object_id,
                                    i_user_id                  => i_user_id,
                                    i_approver_seq             => i_approver_seq,
                                    i_email_cd                 => v_email_cd,
                                    io_email_replace_vals      => v_email_replace_vals,
                                    i_source_profile_id        => i_source_profile_id,
                                    i_order_number             => i_order_number
                                   --added for Q2O notifications
                                   );

      -- Get Email Data
      FOR rec_pdr_email IN pdr_email_cur
      LOOP
         -- read info into output variables
         o_email_from := rec_pdr_email.message_from;
         ---  o_email_to := rec_pdr_email.message_to;
         --- o_email_cc := rec_pdr_email.message_cc;
         o_email_to := TRIM (REPLACE (REPLACE (REPLACE (rec_pdr_email.message_to, CHR (10), ''), CHR (13), ''), CHR (9), ''));
         o_email_cc := TRIM (REPLACE (REPLACE (REPLACE (rec_pdr_email.message_cc, CHR (10), ''), CHR (13), ''), CHR (9), ''));
         o_email_subject := rec_pdr_email.message_subject;
         o_email_reply_to := rec_pdr_email.message_reply_to;
         o_email_text := rec_pdr_email.message_format;
      END LOOP;

      OPEN check_emer_euro;

      FETCH check_emer_euro
       INTO v_dummy;

      v_exists := check_emer_euro%FOUND;

      CLOSE check_emer_euro;

      -- If it is EMER/EURO deal, then remove the Approver Email ID from the message subject
      -- added by mgarikap for UAT fix.
      IF v_exists THEN
         IF INSTR (o_email_subject, 'by') > 0 THEN
            o_email_subject := SUBSTR (o_email_subject, 0, INSTR (o_email_subject, 'by') - 1);
         END IF;
      END IF;

      IF v_local_flag = 'Y' THEN
         o_email_subject := v_email_subject;
         o_email_text := v_email_text || '<br>' || '<br>' || '<br>' || o_email_text;
      END IF;

      -- Replace Place holder fields
      IF (v_email_replace_vals.COUNT > 0) THEN
         FOR l_cnt IN v_email_replace_vals.FIRST .. v_email_replace_vals.LAST
         LOOP
            BEGIN
               -- Log for debug purpose
               -- Q3 FY11 release enhancement from Sherin.  Defect # 74372
               --taken as enhancement to display partner contact user name in Subject , who has actually reopen the Cisco deal
               IF v_email_cd = 'CISCO_DEAL_NOTIFY_REOPENED_QUOTE_TO_AM' THEN
                  SELECT cq_pdb_pae_common_pkg.getpaeuserid_fn (updated_by, 'CCO_ID')
                    INTO v_partner_contact_pae_user_id
                    FROM cq_deal
                   WHERE opty_number = i_deal_id;

                  SELECT user_first_name, user_last_name
                    INTO v_partner_contact_first_name, v_partner_contact_last_name
                    FROM pae_user
                   WHERE user_id = v_partner_contact_pae_user_id;

                  IF v_partner_contact_first_name IS NOT NULL AND v_partner_contact_last_name IS NOT NULL THEN
                     o_email_subject := REPLACE ((REPLACE (o_email_subject, '|PARTNER_CONTACT_FIRST_NAME|', v_partner_contact_first_name)),
                                                 '|PARTNER_CONTACT_LAST_NAME|',
                                                 v_partner_contact_last_name
                                                );
                  END IF;
               END IF;

               --ends here
               
               ----added by sushanth for printing banner in message body for |v_banner|---
              IF v_email_cd = 'APPROVAL_COMPLETE_BOM_2T_FULFILMENT' THEN
               IF v_db_name<>'DMPROD' then
             
               o_email_subject := REPLACE (o_email_subject, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               o_email_to := REPLACE (o_email_to, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               o_email_cc := REPLACE (o_email_cc, v_email_replace_vals (l_cnt).fieldname, v_email_replace_vals (l_cnt).fieldvalue);
               v_email_replace_vals (l_cnt).fielname := REPLACE (v_email_replace_vals (l_cnt).fieldname,
               v_email_replace_vals (l_cnt).fieldvalue := REPLACE ((REPLACE ( v_email_replace_vals (l_cnt).fieldvalue,  '<to>', 'sthota@cisco.com')),
                                                '<cc>',
                                                 'kuchoudh@cisco.com'
                                                );
               
               o_email_text := clobreplace_fn (o_email_text,
                                               v_email_replace_vals (l_cnt).fieldname,
                                               NVL (v_email_replace_vals (l_cnt).fieldvalue, ' ')
                                              );
             
            END IF;
            END IF;
           
               
               EXCEPTION
               WHEN OTHERS THEN
               NULL;
            END;
         END LOOP;
      END IF;

      o_email_to := TRIM (c_comma FROM o_email_to);
      o_email_cc := TRIM (c_comma FROM o_email_cc);
   -- conversion of place holders is over here
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
Which replace isn't working?

I suggest you debug (at least dbms_output.put_line) the values of:
v_email_replace_vals (l_cnt).fieldname
and
v_email_replace_vals (l_cnt).fieldvalue

as well as the original values.  This should show you why no replace is being performed.

for example:
dbms_output.put_line('Subj: ' || o_email_subject);
dbms_output.put_line('Field: ' || v_email_replace_vals (l_cnt).fieldname);
dbms_output.put_line('Val: ' || v_email_replace_vals (l_cnt).fieldvalue);

0
 
LVL 15

Expert Comment

by:Walter Ritzel
Comment Utility
Yes, some results from debug would be nice...
By the way, in the code you paste here, this line is incorrect:

               v_email_replace_vals (l_cnt).fielname := REPLACE (v_email_replace_vals (l_cnt).fieldname,

Based on that, your code wouldnt even compile.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now