Solved

need of code

Posted on 2011-05-12
4
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

751 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