0 Replies Latest reply on Dec 23, 2015 2:08 PM by user5345

    In Oracle CRM (Need to create SR)

    user5345

      Here is the code of mine, it is giving error

       

      ORA-06502: PL/SQL: numeric or value error: character to number conversion error

      I'm new to CRM, can any one help me in this.

       

      declare

      x_errbuf            VARCHAR2(1000);

      lr_ser_req_rec               cs_servicerequest_pub.service_request_rec_type;

          v_address_id                 NUMBER;

          p_serial_number       VARCHAR2(1000);

          p_party_number     VARCHAR2(1000) := 'NULL';

      lc_return_status VARCHAR2(1);

          ln_msg_count     NUMBER;

          lc_msg_data      VARCHAR2(4000);

              lx_msg_data      VARCHAR2(4000);

          gn_user_id     NUMBER(15) := fnd_profile.VALUE('USER_ID');

          gn_resp_id     NUMBER(15) := fnd_profile.VALUE('APPLICATION_ID');

          gn_resp_app_id NUMBER(15) := fnd_profile.VALUE('RESPONSIBILITY_ID');

          gn_org_id      NUMBER(15) := fnd_profile.VALUE('ORG_ID');

          gn_login_id    NUMBER(15) := fnd_profile.VALUE('LOGIN_ID')    ;

           lr_notes                     cs_servicerequest_pub.notes_table;

          lr_contacts                  cs_servicerequest_pub.contacts_table;

          lr_sr_out_rec                cs_servicerequest_pub.sr_create_out_rec_type; --sr_out_record.

           ln_request_id                NUMBER;

         x_retcode           NUMBER;

         x_sr_id             VARCHAR2(1000);

         x_sr_number         VARCHAR2(1100);

            lc_code_status   VARCHAR2(500);

                lc_msg_index_out VARCHAR2(100);

                    lc_request_number            VARCHAR2(100);

                        lx_return_status VARCHAR2(1);

                        p_ref_number varchar2(100) := 'N125';

                                

      begin

       

       

          SAVEPOINT sr_creation;

       

       

          fnd_global.apps_initialize(2597

                                    ,51549

                                    ,170);

       

          --fnd_global.apps_initialize (1210, 50665,170  );

          --MO_GLOBAL.SET_POLICY_CONTEXT('S',p_inv_org_id);

       

          cs_servicerequest_pub.initialize_rec(lr_ser_req_rec);

          fnd_msg_pub.initialize;

         

              lr_ser_req_rec.summary := 'Intall Item2';

              lr_ser_req_rec.caller_type := 'ORGANIZATION';

              --lr_ser_req_rec.severity_id := 28002;

              lr_ser_req_rec.status_id := 1;

              lr_ser_req_rec.customer_id := 442051;

              lr_ser_req_rec.type_id := 11006;

              --lr_ser_req_rec.owner_group_id := 100000463;

              lr_ser_req_rec.inventory_org_id := 1146;

              lr_ser_req_rec.inventory_item_id := 283005;

       

       

            cs_servicerequest_pub.create_servicerequest(p_api_version         => 4.0

                                                       ,p_init_msg_list       => fnd_api.g_true

                                                       ,p_commit              => fnd_api.g_false

                                                       ,x_return_status       => lc_return_status

                                                       ,x_msg_count           => ln_msg_count

                                                       ,x_msg_data            => lc_msg_data

                                                       ,p_resp_appl_id        => 170

                                                       ,p_resp_id             => 51549

                                                       ,p_user_id             => 2597

                                                       ,p_service_request_rec => lr_ser_req_rec

                                                       ,p_notes               => lr_notes

                                                       ,p_contacts            => lr_contacts

                                                       ,p_auto_assign         => 'N'

                                                       ,p_auto_generate_tasks => 'Y'

                                                       ,x_sr_create_out_rec   => lr_sr_out_rec

                                                       ,p_default_contract_sla_ind => 'N');

         

            IF lc_return_status = fnd_api.g_ret_sts_success THEN

              --SR Creation Success

              x_retcode   := 0;

              x_sr_id     := lr_sr_out_rec.request_id; --ln_request_id;

              x_sr_number := lr_sr_out_rec.request_number; --lc_request_number;

              DBMS_OUTPUT.put_line('SR NUMBER ....' || lc_request_number);

             

            ELSE

              lc_code_status := 'Could not create SR';

           

              FOR ln_index IN 1 .. fnd_msg_pub.count_msg LOOP

                fnd_msg_pub.get(p_msg_index     => ln_index

                               ,p_encoded       => 'F'

                               ,p_data          => lc_msg_data

                               ,p_msg_index_out => lc_msg_index_out);

                lx_msg_data := lx_msg_data || ' : ' || lc_msg_data;

                DBMS_OUTPUT.put_line(SUBSTR(lx_msg_data

                                           ,1

                                           ,255));

              END LOOP;

              x_retcode := 1;

              x_errbuf  := lx_msg_data;

            END IF;

         

            -----------------------Commit/Rollback--------------------------------------------

         

            IF (lc_return_status = fnd_api.g_ret_sts_success) THEN

              COMMIT;

            END IF;

       

        EXCEPTION

          WHEN OTHERS THEN

            ROLLBACK TO sr_creation;

            lx_return_status := fnd_api.g_ret_sts_unexp_error;

            x_retcode        := 1;

            x_errbuf         := lc_code_status || ' : ' || SQLERRM;

            DBMS_OUTPUT.put_line('When Others Exception ' || x_errbuf);

      end;

       

      Thanks