Solved

need of code

Posted on 2011-05-12
4
322 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 16

Expert Comment

by:Walter Ritzel
ID: 35750672
Would be possible to send all the code?
0
 

Author Comment

by:thota198
ID: 35750709
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 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 35750739
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 16

Expert Comment

by:Walter Ritzel
ID: 35750781
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to take different types of Oracle backups using RMAN.

838 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