Search This Blog

Monday, November 26, 2018

Oracle apps r12 XML Template sum of column showing output as NNNN


if AMT is your column to be sum in the rtf template then use as below.

<?sum(AMT[.!=''])?>


Wednesday, November 14, 2018

Oracle Apps R12 SSHR 'Request Information' (QUESTION/ANSWER) from plsql


1. Procedure ..

    CREATE OR replace PROCEDURE apps.equest_information(pAction IN VARCHAR2, --QUESTION , for Answer keep null
                                pComments IN VARCHAR2, -- Manager request for more info details
                                userName IN VARCHAR2,  --to whom to be intended
                                pNotification_id IN NUMBER, -- Notification ID
                                pStatus OUT VARCHAR2,
                                pMessage OUT VARCHAR2
                                )
            IS
            BEGIN
                    BEGIN

IF(pAction = 'QUESTION') THEN
wf_notification.UpdateInfo(pNotification_id, userName,pComments,'MANAGER.API','WA','');
ELSE
wf_notification.UpdateInfo(pNotification_id, '',pComments,'','','');
END IF;

                    pStatus := 'S';
                    pMessage := 'Successfully '||initcap(pAction);
                    COMMIT;
            EXCEPTION
            WHEN OTHERS THEN
            pStatus := 'E';
            pMessage := 'Unexpected error while Approve/Reject the notification: '||SQLERRM;
            END equest_information;
END;           


2..----------------------------to check the transaction history then ----------
SELECT rownum l_sequence ,a.l_notification_id ,a.l_role role ,a.l_action action ,a.l_comments ,to_char(a.l_date,'dd-mm-yyyy hh:mi:ss am')  l_date FROM (
SELECT DISTINCT wn.notification_id l_notification_id ,wf_directory.getroledisplayname
 (nvl (wn.more_info_role ,wn.recipient_role)) l_role ,
 decode (l.lookup_code ,'SFL' ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,'PENDING')) ,
 decode (wn.status ,'CANCELED' ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,'BEATEN')) ,l.meaning)) l_action ,
 na.text_value l_comments ,ias.end_date l_date FROM wf_activities a ,wf_notification_attributes na ,wf_process_activities pa ,wf_items i
 ,wf_item_activity_statuses ias ,wf_lookups_tl l ,wf_user_roles wur ,wf_notifications wn
 WHERE i.item_type = :p_item_type AND i.item_key = :p_item_key AND ias.item_type = i.item_type AND ias.item_key = i.item_key
 AND ias.notification_id IS NOT NULL AND wn.notification_id = na.notification_id (+) AND na.name (+) = 'WF_NOTE'
 AND nvl (ias.activity_result_code ,'A') NOT IN ('SFL','RESUBMIT') AND ias.process_activity = pa.instance_id
 AND pa.activity_name = a.name AND pa.activity_item_type = a.item_type AND a.result_type NOT IN ('*','HR_DONE')
 AND i.begin_date BETWEEN a.begin_date AND nvl (a.end_date ,i.begin_date) AND a.result_type = l.lookup_type
 AND nvl (ias.activity_result_code ,'SFL') = l.lookup_code AND l.language = userenv('LANG')
 AND ias.assigned_user = wur.role_name AND ias.notification_id = wn.group_id
 UNION
 SELECT pah.notification_id l_notification_id ,wf_directory.getroledisplayname (pah.user_name) l_role
 ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,pah.action)) l_action ,pah.user_comment l_comments
 ,pah.last_update_date l_date FROM pqh_ss_approval_history pah WHERE pah.transaction_item_type = :p_item_type
 AND pah.transaction_item_key = :p_item_key AND pah.action NOT IN ('APPROVED','REJECTED','SUBMIT' ,'RFC','RESUBMIT','TIMEOUT','QUESTION','ANSWER')
 UNION
 SELECT DISTINCT wn.notification_id l_notification_id ,wf_directory.getroledisplayname (wn.recipient_role) l_role
 ,decode (l.lookup_code ,'SFL' ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,'PENDING'))
 ,decode (wn.status ,'CANCELED' ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,'BEATEN')) ,l.meaning)) l_action
 ,decode (wn.status ,'CANCELED' ,NULL ,nvl (na.text_value ,
 ( SELECT user_comment FROM wf_comments WHERE notification_id = wn.notification_id AND action = l.lookup_code AND rownum = 1 ))) l_comments
 ,nvl (ias.end_date ,ias.begin_date) l_date FROM wf_activities a ,wf_notification_attributes na ,wf_process_activities pa ,wf_items i
 ,wf_item_activity_statuses_h ias ,wf_lookups_tl l ,wf_user_roles wur ,wf_notifications wn
 WHERE i.item_type = :p_item_type AND i.item_key = :p_item_key AND ias.item_type = i.item_type AND ias.item_key = i.item_key
 AND ias.notification_id IS NOT NULL AND wn.notification_id = na.notification_id (+) AND na.name (+) = 'WF_NOTE'
 AND nvl (ias.activity_result_code ,'A') NOT IN ('SFL','RESUBMIT') AND ias.process_activity = pa.instance_id
 AND pa.activity_name = a.name AND pa.activity_item_type = a.item_type AND a.result_type NOT IN ('*','HR_DONE')
 AND i.begin_date BETWEEN a.begin_date AND nvl (a.end_date ,i.begin_date) AND a.result_type = l.lookup_type
 AND nvl (ias.activity_result_code ,'SFL') = l.lookup_code AND l.language = userenv('LANG')
 AND ias.assigned_user = wur.role_name AND ias.notification_id = wn.group_id
 UNION
 SELECT wn.notification_id l_notification_id ,wf_directory.getroledisplayname (nvl (wn.more_info_role ,wn.recipient_role)) l_role
 ,decode (wn.status ,'CANCELED' ,decode (pah.action ,'TIMEOUT' ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,pah.action))
 ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,'BEATEN'))) ,(hr_general.decode_lookup ('PQH_SS_APPROVAL_STATUS' ,pah.action))) l_action
 ,decode (pah.notification_id ,wn.notification_id ,pah.user_comment ,NULL) l_comments ,pah.last_update_date l_date
 FROM pqh_ss_approval_history pah ,wf_notifications wn
 WHERE pah.transaction_item_type = :p_item_type AND pah.transaction_item_key = :p_item_key
 AND pah.action IN ('TIMEOUT','RESUBMIT') AND wn.group_id = ( SELECT group_id FROM wf_notifications WHERE notification_id = pah.notification_id
 AND rownum = 1 )
 UNION
 select wn.notification_id l_notification_id ,wf_directory.getroledisplayname (C.FROM_ROLE) l_role
 -- ,WF_CORE.TRANSLATE(C.ACTION) l_action
 ,C.ACTION l_action ,C.USER_COMMENT l_comments -- ,nvl (ias.end_date,ias.begin_date) l_date
 ,c.comment_date l_date from WF_ITEM_ACTIVITY_STATUSES_H IAS, WF_COMMENTS C, wf_notifications wn
 where IAS.ITEM_TYPE = :p_item_type and IAS.ITEM_KEY = :p_item_key and IAS.NOTIFICATION_ID = wn.group_id
 and wn.notification_id = c.notification_id and C.ACTION in('QUESTION', 'ANSWER') UNION
 select wn.notification_id l_notification_id ,wf_directory.getroledisplayname (C.FROM_ROLE) l_role -- ,WF_CORE.TRANSLATE(C.ACTION) l_action
 ,C.ACTION l_action ,C.USER_COMMENT l_comments -- ,nvl (ias.end_date,ias.begin_date) l_date
 ,c.comment_date l_date from WF_ITEM_ACTIVITY_STATUSES IAS, WF_COMMENTS C, wf_notifications wn
 where IAS.ITEM_TYPE = :p_item_type and IAS.ITEM_KEY = :p_item_key and IAS.NOTIFICATION_ID = wn.group_id and wn.notification_id = c.notification_id
 and C.ACTION in('QUESTION', 'ANSWER')
 UNION SELECT 0 ,wf_directory.getroledisplayname (owner_role) l_role ,wf_core.translate ('SUBMIT')
 ,appr.text_value note ,begin_date l_date
 FROM wf_items i ,wf_item_attribute_values appr
 WHERE i.item_type = :p_item_type AND i.item_key = :p_item_key AND i.item_type = appr.item_type (+) AND i.item_key = appr.item_key (+)
 AND appr.name (+) = 'SUBMIT_COMMENTS' ORDER BY l_notification_id ,l_date ) a

Oracle Apps R12 api to upload PER_QUALIFICATION_TYPES in english and Arabic (Multi-Lingual)


1. Interface Table

CREATE TABLE XXFUJ_INT_QUAL_TYPES
(
ID NUMBER,
CODE VARCHAR2(240),
NAME_ENG VARCHAR2(240),
NAME_AR VARCHAR2(240),
CATEGORY VARCHAR2(240),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
ATTRIBUTE5 VARCHAR2(240)
)

2. FOR ENGLISH

declare
l_qualification_type_id NUMBER;
l_object_version_number NUMBER;
CURSOR C1 IS
SELECT * FROM XXFUJ_INT_QUAL_TYPES
--WHERE CODE = 100
WHERE ID IS NULL
;
begin
FOR I IN C1 LOOP
HR_QUALIFICATION_TYPE_API.create_qualification_type(
P_EFFECTIVE_DATE => SYSDATE
,P_NAME => I.NAME_ENG
,P_CATEGORY => I.CATEGORY
--,p_language_code => 'AR'
,p_qualification_type_id => l_qualification_type_id
,p_object_version_number => l_object_version_number
);
UPDATE XXFUJ_INT_QUAL_TYPES
SET ID = l_qualification_type_id
WHERE CODE= I.CODE;
COMMIT;
END LOOP;
exception when others then
dbms_output.put_line(sqlerrm);
end;


--SELECT * FROM PER_QUALIFICATION_TYPES


3.FOR ARABIC-

declare
l_qualification_type_id NUMBER;
l_object_version_number NUMBER := 1;
l_language_code VARCHAR2(200) := 'AR';
--L_object_version_number NUMBER;
CURSOR C1 IS
SELECT OBJECT_VERSION_NUMBER,
ID, CODE, (select flv.meaning --flv.lookup_CODE,
from fnd_lookup_types hrl,fnd_lookup_values flv
where hrl.lookup_type  = flv.lookup_type
AND language = 'AR'
and hrl.lookup_type  = 'AE_EDUCATION_LEVEL'
AND XXFUJ.CODE = FLV.LOOKUP_CODE
)NAME_AR1 FROM XXFUJ_INT_QUAL_TYPES XXFUJ, PER_QUALIFICATION_TYPES PER
WHERE
PER.QUALIFICATION_TYPE_ID = XXFUJ.ID
--AND XXFUJ.ID NOT IN ( 1030,1010,1011,1012,1013,1014)
;
/*SELECT
ID, CODE, (select flv.meaning --flv.lookup_CODE,
from fnd_lookup_types hrl,fnd_lookup_values flv
where hrl.lookup_type  = flv.lookup_type
AND language = 'AR'
and hrl.lookup_type  = 'AE_EDUCATION_LEVEL'
AND XXFUJ.CODE = FLV.LOOKUP_CODE
)NAME_AR1 FROM XXFUJ_INT_QUAL_TYPES XXFUJ
WHERE ID NOT IN ( 1030,1010,1011,1012,1013)
;*/
begin
FOR  I IN C1 LOOP
--dbms_output.put_line('HI');
HR_QUALIFICATION_TYPE_API.update_qualification_type(
p_qualification_type_id => I.ID
,p_object_version_number => I.OBJECT_VERSION_NUMBER
,P_language_code => L_language_code
,P_EFFECTIVE_DATE => SYSDATE
,P_NAME => I.NAME_AR1
--,p_language_code => l_language_code
--,p_qualification_type_id => l_qualification_type_id
);
commit;
END LOOP;
dbms_output.put_line(sqlerrm);
exception when others then
dbms_output.put_line(sqlerrm);
end;

Query Oracle Apps R12 Payroll Result Values Element Query with Effective Date

select papf.employee_number,papf.full_name,ppa.effective_date,pp.payroll_name,
pet.element_name,piv.name input_value,prrv.result_value,ppa.payroll_action_id
from apps.pay_payroll_actions ppa,
 pay_assignment_actions paa,
pay_payrolls_f pp,
pay_run_results prr,
pay_run_result_values prrv,
pay_input_values_f piv,
pay_element_types_f pet,
apps.per_all_assignments_f paaf,
apps.per_all_people_f papf
--where ppa.payroll_action_id = :payroll_action_id -- give your payroll_action_id
where
ppa.payroll_id = nvl(:payroll_id,ppa.payroll_id)
--and paaf.organization_id = nvl(:p_organization_id, paaf.organization_id)
--and paaf.person_id = nvl(:P_PERSON_ID, paaf.person_id)
--and paa.assignment_action_id = :assignment_action_id
and ppa.payroll_action_id = paa.payroll_action_id
and ppa.payroll_id = pp.payroll_id
and paa.assignment_action_id = prr.assignment_action_id
and prr.run_result_id= prrv.run_result_id
and prrv.input_value_id = piv.input_value_id
and piv.element_type_id = pet.element_type_id
and paaf.assignment_id = paa.assignment_id
and paaf.person_id = papf.person_id
and trunc(sysdate) between pp.effective_start_date and pp.effective_end_date
and trunc(sysdate) between pet.effective_start_date and pet.effective_end_date
and trunc(sysdate) between piv.effective_start_date and piv.effective_end_date
and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and papf.employee_number = '1234'  --give your employee number here
and ppa.effective_date = to_date('28-MAR-2018')--between (:P_FROM_DATE) and last_day(:P_FROM_TO)
and ELEMENT_NAME = 'Net Salary'
AND piv.name = 'Pay Value'
order by employee_number

Monday, July 30, 2018

Oracle Apps R12 AR Invoice Transaction API for Single


With Cursor : Oracle Apps R12 AR Invoice Transaction API (With Cursor) Multiple

DECLARE
   v_customer_id             NUMBER := 8980620;
   v_service_name            VARCHAR2(200) := 'XX- Customer Name';
   v_costshare_value         NUMBER := 1000;
   v_user_id                 NUMBER := 26051;
   v_resp_id                 NUMBER := 55556;
   v_org_id                  NUMBER := 1300;
   v_date                    DATE := TO_DATE('30-JUL-2018');
   --v_trx_number        OUT   NUMBER
   v_trx_number           NUMBER;
--)AS
   l_return_status           VARCHAR2 (1);
   l_msg_count               NUMBER;
   l_msg_data                VARCHAR2 (2000);
   l_batch_id                NUMBER;
   l_batch_source_rec        ar_invoice_api_pub.batch_source_rec_type;
   l_trx_header_tbl          ar_invoice_api_pub.trx_header_tbl_type;
   l_trx_lines_tbl           ar_invoice_api_pub.trx_line_tbl_type;
   l_trx_dist_tbl            ar_invoice_api_pub.trx_dist_tbl_type;
   l_trx_salescredits_tbl    ar_invoice_api_pub.trx_salescredits_tbl_type;
   l_trx_contingencies_tbl   ar_invoice_api_pub.trx_contingencies_tbl_type;
   trx_header_id_v           NUMBER;
   trx_line_id_v             NUMBER;
   trx_dist_id_v             NUMBER;
   CURSOR cbatch
   IS
      SELECT customer_trx_id
        FROM ra_customer_trx_all
       WHERE batch_id = l_batch_id;
   CURSOR cvalidtxn
   IS
      SELECT trx_header_id
        FROM ar_trx_header_gt
       WHERE trx_header_id NOT IN (SELECT trx_header_id
                                     FROM ar_trx_errors_gt);
 

BEGIN
     SELECT xx_invoice_header.NEXTVAL
     INTO trx_header_id_v
     FROM DUAL;
   SELECT xx_invoice_line.NEXTVAL
     INTO trx_line_id_v
     FROM DUAL;
   SELECT xx_invoice_dist.NEXTVAL
     INTO trx_dist_id_v
     FROM DUAL;
   fnd_global.apps_initialize (v_user_id, v_resp_id, 222);
   mo_global.init ('AR');
   mo_global.set_policy_context ('S', v_org_id);
   xla_security_pkg.set_security_context (222);
   l_batch_source_rec.batch_source_id := 4048;
   l_trx_header_tbl (1).trx_header_id := trx_header_id_v;
   l_trx_header_tbl (1).bill_to_customer_id := v_customer_id;           --1042
   l_trx_header_tbl (1).cust_trx_type_id := 1420;
   l_trx_header_tbl (1).trx_date := v_date;   --'10-AUG-2006';--'30-MAY-2006';
   l_trx_header_tbl (1).trx_currency := 'AED';
   l_trx_header_tbl (1).term_id := 5;
   --l_trx_header_tbl (1).default_tax_exempt_flag := 'E';
   l_trx_header_tbl (1).legal_entity_id := 21178;
   l_trx_header_tbl (1).finance_charges := NULL;
   l_trx_header_tbl (1).status_trx := 'OP';
   l_trx_header_tbl (1).printing_option := 'PRI';
   --l_trx_header_tbl (1).set_of_books_id := 12345;
   --l_trx_header_tbl (1).complete_flag := 'Y';
   l_trx_lines_tbl (1).trx_header_id := trx_header_id_v;
   l_trx_lines_tbl (1).trx_line_id := trx_line_id_v;
   l_trx_lines_tbl (1).line_number := 1;
   l_trx_lines_tbl (1).description := v_service_name;
   l_trx_lines_tbl (1).quantity_invoiced := 1;
   l_trx_lines_tbl (1).unit_selling_price := v_costshare_value;
   l_trx_lines_tbl (1).line_type := 'LINE';
   --l_trx_lines_tbl (1).tax_exempt_flag := 'E';
   --l_trx_lines_tbl (1).TAX_EXEMPT_REASON_CODE := 'E';
   --l_trx_lines_tbl (1).TAX_EXEMPT_REASON_CODE_MEANING := 'E';
   l_trx_lines_tbl (1).memo_line_id := 46160;
--   l_trx_lines_tbl (1).TAX_PRECEDENCE := 10;
--   l_trx_lines_tbl (1).TAX_RATE := 10;
   l_trx_dist_tbl (1).trx_dist_id := trx_dist_id_v;
   l_trx_dist_tbl (1).trx_line_id := trx_line_id_v;
   l_trx_dist_tbl (1).account_class := 'REV';
   l_trx_dist_tbl (1).PERCENT := 100;
   l_trx_dist_tbl (1).code_combination_id := 3361155;
   ar_invoice_api_pub.create_invoice
                            (p_api_version               => 1.0,
                             p_batch_source_rec          => l_batch_source_rec,
                             p_trx_header_tbl            => l_trx_header_tbl,
                             p_trx_lines_tbl             => l_trx_lines_tbl,
                             p_trx_dist_tbl              => l_trx_dist_tbl,
                             p_trx_salescredits_tbl      => l_trx_salescredits_tbl,
                             x_return_status             => l_return_status,
                             x_msg_count                 => l_msg_count,
                             x_msg_data                  => l_msg_data
                            );
   DBMS_OUTPUT.put_line (l_return_status);
   DBMS_OUTPUT.put_line (l_msg_data);
   IF    l_return_status = fnd_api.g_ret_sts_error
      OR l_return_status = fnd_api.g_ret_sts_unexp_error
   THEN
      DBMS_OUTPUT.put_line ('unexpected errors found!');
   ELSE
      FOR cvalidtxnrec IN cvalidtxn
      LOOP
         IF (ar_invoice_api_pub.g_api_outputs.batch_id IS NOT NULL)
         THEN
            DBMS_OUTPUT.put_line ('Invoice(s) suceessfully created!');
            DBMS_OUTPUT.put_line (   'Batch ID: '
                                  || ar_invoice_api_pub.g_api_outputs.batch_id
                                 );
            l_batch_id := ar_invoice_api_pub.g_api_outputs.batch_id;
            FOR cbatchrec IN cbatch
            LOOP
               DBMS_OUTPUT.put_line (   'Cust Trx Id '
                                     || cbatchrec.customer_trx_id
                                    );
               v_trx_number := cbatchrec.customer_trx_id;
            END LOOP;
         ELSE
            DBMS_OUTPUT.put_line ('Errors found!');
         END IF;
      END LOOP;
   END IF;
END;
/

Oracle Apps R12 AR Invoice Transaction API (With Cursor) Multiple

CREATE OR REPLACE PROCEDURE APPS.xxcreate_invoice_ar (
P_VEHICLE_NO VARCHAR2,
P_DATE DATE,
P_CUSTOMER_CODE VARCHAR2,
P_RESULT OUT VARCHAR2,
P_INVOICE_ID OUT NUMBER,
P_INVOICE_NUM OUT VARCHAR2
) AS

   v_customer_id             NUMBER;--:= 8980620;
   L_VEHICLE_NO        varchar2(200) := P_VEHICLE_NO;
   v_user_id                 NUMBER := 2605;
   v_resp_id                 NUMBER := 52328;
   v_org_id                  NUMBER := 1930;
   v_date                    DATE := P_DATE;
   v_trx_number           NUMBER;
   l_return_status           VARCHAR2 (1);
   l_msg_count               NUMBER;
   l_msg_data                VARCHAR2 (2000);
   l_batch_id                NUMBER;
   l_batch_source_rec        ar_invoice_api_pub.batch_source_rec_type;
   l_trx_header_tbl          ar_invoice_api_pub.trx_header_tbl_type;
   l_trx_lines_tbl           ar_invoice_api_pub.trx_line_tbl_type;
   l_trx_dist_tbl            ar_invoice_api_pub.trx_dist_tbl_type;
   l_trx_salescredits_tbl    ar_invoice_api_pub.trx_salescredits_tbl_type;
   l_trx_contingencies_tbl   ar_invoice_api_pub.trx_contingencies_tbl_type;
   trx_header_id_v           NUMBER;
   trx_line_id_v             NUMBER;
   trx_dist_id_v             NUMBER;
   v_line                    number := 1;
   v_line_count              number :=0;
 
   CURSOR cbatch
   IS
      SELECT customer_trx_id
        FROM ra_customer_trx_all
       WHERE batch_id = l_batch_id;
 
   CURSOR cvalidtxn
   IS
      SELECT trx_header_id
        FROM ar_trx_header_gt
       WHERE trx_header_id NOT IN (SELECT trx_header_id
                                     FROM ar_trx_errors_gt);

  CURSOR line_items is

 SELECT MEMO_LINE_ID,NAME,PRICE,QTY
 ,(SELECT GL_ID_REV FROM AR_MEMO_LINES_ALL_VL WHERE MEMO_LINE_ID =XXF.MEMO_LINE_ID AND ATTRIBUTE1 IS NOT NULL )GL_ID
 FROM XXF_SERVICES_D XXF
 WHERE VEHICLE_NO = P_VEHICLE_NO;--20180701141;

 
BEGIN

     SELECT CUSTOMER_ID
      INTO v_customer_id
      FROM AR_CUSTOMERS
      WHERE CUSTOMER_NUMBER = P_CUSTOMER_CODE;

     SELECT xx_invoice_header.NEXTVAL
     INTO trx_header_id_v
     FROM DUAL;
   /*SELECT xx_invoice_line.NEXTVAL
     INTO trx_line_id_v
     FROM DUAL;
   SELECT xx_invoice_dist.NEXTVAL
     INTO trx_dist_id_v
     FROM DUAL;*/
   fnd_global.apps_initialize (v_user_id, v_resp_id, 222);
   mo_global.init ('AR');
   mo_global.set_policy_context ('S', v_org_id);
   xla_security_pkg.set_security_context (222);
   l_batch_source_rec.batch_source_id := 4048;
   l_trx_header_tbl (1).trx_header_id := trx_header_id_v;
   l_trx_header_tbl (1).bill_to_customer_id := v_customer_id;           --1042
   l_trx_header_tbl (1).cust_trx_type_id := 1420;
   l_trx_header_tbl (1).trx_date := v_date;   --'10-AUG-2006';--'30-MAY-2006';
   l_trx_header_tbl (1).trx_currency := 'AED';
   l_trx_header_tbl (1).term_id := 5;
   --l_trx_header_tbl (1).default_tax_exempt_flag := 'E';
   l_trx_header_tbl (1).legal_entity_id := 27278;
   l_trx_header_tbl (1).finance_charges := NULL;
   l_trx_header_tbl (1).status_trx := 'OP';
   l_trx_header_tbl (1).printing_option := 'PRI';
   --l_trx_header_tbl (1).set_of_books_id := 12345;
   --l_trx_header_tbl (1).complete_flag := 'Y';
 
   for i in line_items loop
   v_line_count := v_line_count + v_line;
   l_trx_lines_tbl (v_line_count).trx_header_id := trx_header_id_v;
   l_trx_lines_tbl (v_line_count).trx_line_id := xx_invoice_line.NEXTVAL;--trx_line_id_v;
   l_trx_lines_tbl (v_line_count).line_number := v_line_count;
   l_trx_lines_tbl (v_line_count).description := i.name;
   l_trx_lines_tbl (v_line_count).quantity_invoiced := i.qty;
   l_trx_lines_tbl (v_line_count).unit_selling_price := i.price;
   l_trx_lines_tbl (v_line_count).line_type := 'LINE';
   --l_trx_lines_tbl (1).tax_exempt_flag := 'E';
   --l_trx_lines_tbl (1).TAX_EXEMPT_REASON_CODE := 'E';
   --l_trx_lines_tbl (1).TAX_EXEMPT_REASON_CODE_MEANING := 'E';
   l_trx_lines_tbl (v_line_count).memo_line_id := i.memo_line_id;
--   l_trx_lines_tbl (1).TAX_PRECEDENCE := 10;
--   l_trx_lines_tbl (1).TAX_RATE := 10;
   l_trx_dist_tbl (v_line_count).trx_dist_id := xx_invoice_dist.NEXTVAL;
   l_trx_dist_tbl (v_line_count).trx_line_id := xx_invoice_line.CURRVAL;
   l_trx_dist_tbl (v_line_count).account_class := 'REV';
   l_trx_dist_tbl (v_line_count).PERCENT := 100;
   l_trx_dist_tbl (v_line_count).code_combination_id := i.gl_id;
   end loop;
   ar_invoice_api_pub.create_invoice
                            (p_api_version               => 1.0,
                             p_batch_source_rec          => l_batch_source_rec,
                             p_trx_header_tbl            => l_trx_header_tbl,
                             p_trx_lines_tbl             => l_trx_lines_tbl,
                             p_trx_dist_tbl              => l_trx_dist_tbl,
                             p_trx_salescredits_tbl      => l_trx_salescredits_tbl,
                             x_return_status             => l_return_status,
                             x_msg_count                 => l_msg_count,
                             x_msg_data                  => l_msg_data
                            );
   DBMS_OUTPUT.put_line (l_return_status);
   DBMS_OUTPUT.put_line (l_msg_data);
   P_RESULT:= l_return_status||'-'||l_msg_data;
   IF    l_return_status = fnd_api.g_ret_sts_error
      OR l_return_status = fnd_api.g_ret_sts_unexp_error
   THEN
      DBMS_OUTPUT.put_line ('unexpected errors found!');
   ELSE
      FOR cvalidtxnrec IN cvalidtxn
      LOOP
         IF (ar_invoice_api_pub.g_api_outputs.batch_id IS NOT NULL)
         THEN
            DBMS_OUTPUT.put_line ('Invoice(s) suceessfully created!');
            DBMS_OUTPUT.put_line (   'Batch ID: '
                                  || ar_invoice_api_pub.g_api_outputs.batch_id
                                 );
            l_batch_id := ar_invoice_api_pub.g_api_outputs.batch_id;
            FOR cbatchrec IN cbatch
            LOOP
               DBMS_OUTPUT.put_line (   'Cust Trx Id '
                                     || cbatchrec.customer_trx_id
                                    );
               v_trx_number := cbatchrec.customer_trx_id;
               DBMS_OUTPUT.PUT_LINE('INVOICE_ID->'||v_trx_number||'-INVOICE_NUMBER->'||trx_header_id_v);
               P_INVOICE_ID := v_trx_number;
               P_INVOICE_NUM := trx_header_id_v;
            END LOOP;
         ELSE
            DBMS_OUTPUT.put_line ('Errors found!');
           
         END IF;
      END LOOP;
   END IF;
   COMMIT;
END;
/

Oracle Apps R12 Transact Move Order in Inventory API

--Transact Move order from here

PROCEDURE xxcona_alloc_move_order (
      p_move_order_line_id   IN       NUMBER,
      x_return_status        OUT      VARCHAR2,
      x_detailed_qty         OUT      NUMBER
   )
   IS

-- WHO columns
   l_user_id          NUMBER        := -1;
   l_resp_id          NUMBER        := -1;
   l_application_id   NUMBER        := -1;
   l_user_name        VARCHAR2 (30) := 'XX_AFZAL';
   l_resp_name        VARCHAR2 (30) := 'xx Inventory';
      -- Common Declarations
      l_api_version            NUMBER                                  := 1.0;
      l_init_msg_list          VARCHAR2 (2)                 := fnd_api.g_true;
      l_return_values          VARCHAR2 (2)                := fnd_api.g_false;
      l_commit                 VARCHAR2 (2)                := fnd_api.g_false;
      --x_return_status          VARCHAR2 (2);
      x_msg_count              NUMBER                                    := 0;
      x_msg_data               VARCHAR2 (255);
      -- WHO columns
      --l_user_id                NUMBER                                   := -1;
      --l_resp_id                NUMBER                                   := -1;
      --l_application_id         NUMBER                                   := -1;
      l_row_cnt                NUMBER                                    := 1;
       --l_user_name              VARCHAR2 (30)                    := 'CONACENT';
      --l_resp_name              VARCHAR2 (30)                   := 'INVENTORY';
       -- API specific declarations
      l_trohdr_rec             inv_move_order_pub.trohdr_rec_type;
      l_trohdr_val_rec         inv_move_order_pub.trohdr_val_rec_type;
      x_trohdr_rec             inv_move_order_pub.trohdr_rec_type;
      x_trohdr_val_rec         inv_move_order_pub.trohdr_val_rec_type;
      l_validation_flag        VARCHAR2 (2)
                                       := inv_move_order_pub.g_validation_yes;
      l_trolin_tbl             inv_move_order_pub.trolin_tbl_type;
      l_trolin_val_tbl         inv_move_order_pub.trolin_val_tbl_type;
      x_trolin_tbl             inv_move_order_pub.trolin_tbl_type;
      x_trolin_val_tbl         inv_move_order_pub.trolin_val_tbl_type;
      l_line_id                mtl_txn_request_lines.line_id%TYPE
                                                      := p_move_order_line_id;
      l_move_order_type        mtl_txn_request_headers.move_order_type%TYPE
                                                                         := 1;
      --x_detailed_qty           NUMBER                                    := 0;
      x_number_of_rows         NUMBER                                    := 0;
      x_revision               VARCHAR2 (3);
      x_locator_id             NUMBER                                    := 0;
      x_transfer_to_location   NUMBER                                    := 0;
      x_lot_number             VARCHAR2 (30);
      x_expiration_date        DATE;
      x_transaction_temp_id    NUMBER                                    := 0;
   BEGIN
      -- Get the user_id
      /*SELECT user_id
        INTO l_user_id
        FROM fnd_user
       WHERE user_name = l_user_name;

      -- Get the application_id and responsibility_id
      SELECT application_id, responsibility_id
        INTO l_application_id, l_resp_id
        FROM fnd_responsibility
       WHERE responsibility_key = l_resp_name;

      fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id);
      -- MFG / Mfg Mgr / INV
      DBMS_OUTPUT.put_line (   'Initialized applications context: '
                            || l_user_id
                            || ' '
                            || l_resp_id
                            || ' '
                            || l_application_id
                           );*/
      -- Allocate each line of the Move Order
      inv_replenish_detail_pub.line_details_pub
                           (p_line_id                    => l_line_id,
                            x_number_of_rows             => x_number_of_rows,
                            x_detailed_qty               => x_detailed_qty,
                            x_return_status              => x_return_status,
                            x_msg_count                  => x_msg_count,
                            x_msg_data                   => x_msg_data,
                            x_revision                   => x_revision,
                            x_locator_id                 => x_locator_id,
                            x_transfer_to_location       => x_transfer_to_location,
                            x_lot_number                 => x_lot_number,
                            x_expiration_date            => x_expiration_date,
                            x_transaction_temp_id        => x_transaction_temp_id,
                            p_transaction_header_id      => NULL,
                            p_transaction_mode           => NULL,
                            p_move_order_type            => l_move_order_type,
                            p_serial_flag                => fnd_api.g_false,
                            p_plan_tasks                 => FALSE
                                                                 --FND_API.G_FALSE
      ,
                            p_auto_pick_confirm          => FALSE
                                                                 --FND_API.G_FALSE
      ,
                            p_commit                     => TRUE
                           --FND_API.G_FALSE
                           );
      DBMS_OUTPUT.put_line
                 ('==========================================================');
      DBMS_OUTPUT.put_line ('Return Status: ' || x_return_status);

      IF (x_return_status <> fnd_api.g_ret_sts_success)
      THEN
         DBMS_OUTPUT.put_line ('Error Message :' || x_msg_data);
      END IF;

      IF (x_return_status = fnd_api.g_ret_sts_success)
      THEN
         COMMIT;
         DBMS_OUTPUT.put_line ('Detailed Qty: ' || x_detailed_qty);
         DBMS_OUTPUT.put_line ('Number of rows: ' || x_number_of_rows);
         DBMS_OUTPUT.put_line ('Trx temp ID: ' || x_transaction_temp_id);
      END IF;

      DBMS_OUTPUT.put_line
                 ('==========================================================');
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('Exception Occured :');
         DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
         DBMS_OUTPUT.put_line
                   ('=======================================================');
   END xxcona_alloc_move_order;

   PROCEDURE xxcona_process_move_order_line (
      p_move_order_line_id      IN       NUMBER,
      p_new_quantity_detailed   IN       NUMBER,
      x_return_status           OUT      VARCHAR2
   )
   IS
      -- Main parameters -- Move order to update, and new quantity
      l_new_quantity_detailed   NUMBER             := p_new_quantity_detailed;
      l_mo_line_id              NUMBER                := p_move_order_line_id;
      -- User Information
      --l_user_id                 NUMBER                             := -1;
      --l_user_name               VARCHAR2 (20)                   := 'CONACENT';
      --l_resp_id                 NUMBER                             := -1;
      --l_resp_name               VARCHAR2 (40)                  := 'INVENTORY';
      --l_application_id          NUMBER                             := -1;
      l_rowcnt                  NUMBER                             := 1;
      -- Errors
      --x_return_status           VARCHAR2 (10);
      x_msg_count               NUMBER;
      x_msg_data                VARCHAR2 (255);
      x_message_list            error_handler.error_tbl_type;
      -- Move order variables
      l_trolin_tbl              inv_move_order_pub.trolin_tbl_type;
      l_trolin_old_tbl          inv_move_order_pub.trolin_tbl_type;
      x_trolin_tbl              inv_move_order_pub.trolin_tbl_type;
      l_mo_line_rec             inv_move_order_pub.trolin_rec_type;
   BEGIN
  
      l_mo_line_rec := inv_trolin_util.query_row (p_line_id => l_mo_line_id);
      l_trolin_tbl (1) := l_mo_line_rec;
      l_trolin_old_tbl (1) := l_mo_line_rec;
      l_trolin_tbl (1).operation := 'UPDATE';    -- INV_GLOBALS.G_OPR_UPDATE;
      l_trolin_tbl (1).quantity_detailed := l_new_quantity_detailed;
      inv_move_order_pub.process_move_order_line
                                       (p_api_version_number      => 1.0,
                                        p_init_msg_list           => fnd_api.g_true,
                                        p_return_values           => fnd_api.g_false
                                                                                    -- Convert ids to values
      ,
                                        p_commit                  => fnd_api.g_false
                                                                                    --FND_API.G_FALSE
      ,
                                        x_return_status           => x_return_status,
                                        x_msg_count               => x_msg_count,
                                        x_msg_data                => x_msg_data,
                                        p_trolin_tbl              => l_trolin_tbl,
                                        p_trolin_old_tbl          => l_trolin_old_tbl,
                                        x_trolin_tbl              => x_trolin_tbl
                                       );
      DBMS_OUTPUT.put_line ('=========================================');
      DBMS_OUTPUT.put_line ('Return Status: ' || x_return_status);

      IF (x_return_status <> fnd_api.g_ret_sts_success)
      THEN
         DBMS_OUTPUT.put_line ('x_msg_data :' || x_msg_data);
         DBMS_OUTPUT.put_line ('Error Messages :');
         error_handler.get_message_list (x_message_list => x_message_list);

         FOR i IN 1 .. x_message_list.COUNT
         LOOP
            DBMS_OUTPUT.put_line (x_message_list (i).MESSAGE_TEXT);
         END LOOP;
      ELSE
         COMMIT;
      END IF;

      DBMS_OUTPUT.put_line ('=========================================');
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('Exception Occured :');
         DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
         DBMS_OUTPUT.put_line ('========================================');
   END xxcona_process_move_order_line;

   PROCEDURE xxcona_transact_mo_line (
      p_header_id   IN   NUMBER,
      p_line_id     IN   NUMBER
   )
   IS
      -- Common Declarations
      l_api_version        NUMBER                                  := 1.0;
      l_init_msg_list      VARCHAR2 (2)                     := fnd_api.g_true;
      l_commit             VARCHAR2 (2)                    := fnd_api.g_false;
      x_return_status      VARCHAR2 (2);
      x_msg_count          NUMBER                                  := 0;
      x_msg_data           VARCHAR2 (255);
      -- API specific declarations
      l_move_order_type    NUMBER                                  := 1;
      l_transaction_mode   NUMBER                                  := 1;
      l_trolin_tbl         inv_move_order_pub.trolin_tbl_type;
      l_mold_tbl           inv_mo_line_detail_util.g_mmtt_tbl_type;
      x_mmtt_tbl           inv_mo_line_detail_util.g_mmtt_tbl_type;
      x_trolin_tbl         inv_move_order_pub.trolin_tbl_type;
      l_transaction_date   DATE                                    := SYSDATE;
      -- WHO columns
      --l_user_id            NUMBER                                  := -1;
      --l_resp_id            NUMBER                                  := -1;
      --l_application_id     NUMBER                                  := -1;
      l_row_cnt            NUMBER                                  := 1;
   --l_user_name          VARCHAR2 (30)                        := 'CONACENT';
   --l_resp_name          VARCHAR2 (30)                       := 'INVENTORY';
   BEGIN
      -- Get the user_id
      /*SELECT user_id
        INTO l_user_id
        FROM fnd_user
       WHERE user_name = l_user_name;

      -- Get the application_id and responsibility_id
      SELECT application_id, responsibility_id
        INTO l_application_id, l_resp_id
        FROM fnd_responsibility
       WHERE responsibility_key = l_resp_name;

      fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id);
      DBMS_OUTPUT.put_line (   'Initialized applications context: '
                            || l_user_id
                            || ' '
                            || l_resp_id
                            || ' '
                            || l_application_id
                           );*/
      l_trolin_tbl (1).line_id := p_line_id;
      l_trolin_tbl (1).header_id := p_header_id;                     -- Added
      -- call API to create move order header
      DBMS_OUTPUT.put_line
                   ('=======================================================');
      DBMS_OUTPUT.put_line
                   ('Calling INV_Pick_Wave_Pick_Confirm_PUB.Pick_Confirm API');
      inv_pick_wave_pick_confirm_pub.pick_confirm
                                   (p_api_version_number      => l_api_version,
                                    p_init_msg_list           => l_init_msg_list,
                                    p_commit                  => l_commit,
                                    x_return_status           => x_return_status,
                                    x_msg_count               => x_msg_count,
                                    x_msg_data                => x_msg_data,
                                    p_move_order_type         => l_move_order_type,
                                    p_transaction_mode        => l_transaction_mode,
                                    p_trolin_tbl              => l_trolin_tbl,
                                    p_mold_tbl                => l_mold_tbl,
                                    x_mmtt_tbl                => x_mmtt_tbl,
                                    x_trolin_tbl              => x_trolin_tbl,
                                    p_transaction_date        => l_transaction_date
                                   );
      DBMS_OUTPUT.put_line
                    ('=======================================================');
      DBMS_OUTPUT.put_line ('Return Status: ' || x_return_status);

      IF (x_return_status <> fnd_api.g_ret_sts_success)
      THEN
         DBMS_OUTPUT.put_line ('Error Message :' || x_msg_data);
      ELSE
         COMMIT;
      END IF;

      DBMS_OUTPUT.put_line
                    ('=======================================================');
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('Exception Occured :');
         DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
         DBMS_OUTPUT.put_line
                   ('=======================================================');
   END xxcona_transact_mo_line;

   PROCEDURE xxcona_main (
      p_move_order_no     IN   VARCHAR2,
      p_organization_id   IN   NUMBER
   )
   IS
      x_return_status   VARCHAR2 (2);
      x_detailed_qty    NUMBER;

      CURSOR move_order_cur
      IS
         SELECT mtrh.request_number, mtrh.organization_id, mtrh.header_id,
                mtrl.line_id, mtrh.move_order_type, mtrl.quantity,
                mtrl.quantity_delivered,
                (mtrl.quantity - mtrl.quantity_delivered) unallocated_qty
           FROM mtl_txn_request_headers mtrh, mtl_txn_request_lines mtrl
          WHERE mtrh.organization_id = mtrl.organization_id
            AND mtrh.header_id = mtrl.header_id
            AND mtrh.request_number = p_move_order_no
            AND mtrh.organization_id = p_organization_id;
   BEGIN
      BEGIN
         -- Get the user_id
         SELECT user_id
           INTO l_user_id
           FROM fnd_user
          WHERE user_name = l_user_name;

         -- Get the application_id and responsibility_id
         SELECT application_id, responsibility_id
           INTO l_application_id, l_resp_id
           FROM fnd_responsibility
          WHERE responsibility_key = l_resp_name;

         fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id);
         DBMS_OUTPUT.put_line (   'Initialized applications context: '
                               || l_user_id
                               || ' '
                               || l_resp_id
                               || ' '
                               || l_application_id
                              );
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line
               ('Exception Occured : Not able to Initialize applications context'
               );
            DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
            DBMS_OUTPUT.put_line
                    ('=======================================================');
      END;

      BEGIN
         FOR cur_rec IN move_order_cur
         LOOP
            xxcona_alloc_move_order (cur_rec.line_id,
                                     x_return_status,
                                     x_detailed_qty
                                    );

            IF     x_return_status = fnd_api.g_ret_sts_success
               AND x_detailed_qty > 0
            THEN
               x_return_status := NULL;                      --- Reset Status
               xxcona_process_move_order_line (cur_rec.line_id,
                                               x_detailed_qty,
                                               x_return_status
                                              );

               IF x_return_status = fnd_api.g_ret_sts_success
               THEN
                  xxcona_transact_mo_line (cur_rec.header_id,
                                           cur_rec.line_id);
               END IF;
            ELSE
               DBMS_OUTPUT.put_line
                  ('Exception Occured : Unable to allocate requested quantity.'
                  );
            END IF;
         END LOOP;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line
               ('Exception Occured : Unable to process the request --- Transact Move Orders'
               );
            DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
            DBMS_OUTPUT.put_line
                    ('=======================================================');
      END;
   END xxcona_main;
--Transact move order ends here

Execute:

BEGIN
   xxcona_main (p_move_order_no        => '112',
                                            p_organization_id      => 1733
                                           );
END;

commit

Sunday, July 29, 2018

External SOAP Webservice consume in .net application connection Oracle 11g database

 .net Forms Application

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
//using Oracle.ManagedDataAccess.Client;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Net;
using System.IO;
using System.Net.Mail;
namespace WindowsFormsApplication3
{

        private void Submit_Click(object sender, EventArgs e)
        {

            Cursor.Current = Cursors.WaitCursor;
            runCode();
            Cursor.Current = Cursors.Default;
            //MessageBox.Show("No code inside :)");
        }

  public void runCode()
        {
            OracleConnection myConnection = new OracleConnection();
            myConnection.ConnectionString = "Data Source=TEST;User Id=usrname1;Password=test1";
            try
            {
                myConnection.Open();
            }
            catch (Exception ex)
            {
                SendEmail("Error check connection with database ->" + ex.Message);
            }
            //execute queries
            //OracleDataAdapter oda = new OracleDataAdapter("select * from xml_document", myConnection);
            try
            {
                OracleDataAdapter oda = new OracleDataAdapter("select apps.test_function_f() from dual", myConnection);//getting xml output from the function with 3 values ex: newnumber+'S'(success) + xml output.
                string l_msg = "";
                string l_refno = "";
                string l_xml = "";
                DataTable dt = new DataTable();
                oda.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    string output = dt.Rows[0][0].ToString();
                    // string test2 = "FUJREF1907201826";// dt.Rows[0][0].ToString();
                    string[] xx = new string[3];
                    xx = output.Split(',');
                    l_msg = xx[0];
                    l_refno = xx[1];
                    l_xml = xx[2];
                    // MessageBox.Show(l_refno);
                    this.textBox2.Text = l_refno.ToString();

                    if (l_msg == "S")
                    {
                        SOAP_Request(l_xml);
                    }
                    else
                    {
                        SendEmail("Error check the soap webservice ->" + l_msg + l_refno);
                    }


                    /* XmlDocument xmltest = new XmlDocument();
                     xmltest.LoadXml(test);
                     XmlNodeList elemlist = xmltest.GetElementsByTagName("soapenv:Envelope");

                     string result = elemlist[0].OuterXml.ToString();//.InnerXml;
                     XmlDocument xmltest1 = new XmlDocument();
                     xmltest1.LoadXml(result);
                     XmlNodeList elemlist1 = xmltest1.GetElementsByTagName("loc:SerId");
                     result = elemlist1[0].InnerXml.ToString();
                     MessageBox.Show(result);
                     MessageBox.Show(elemlist.Count.ToString());
                     */
                }
            }
            catch (Exception ex)
            {
                SendEmail("Error check for body exception ->" + ex.Message);
            }
            myConnection.Close();
        }

        //consume soap client
        public void SOAP_Request(string data)
        {
            HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            soapEnvelopeXml.LoadXml(@data);
            using (Stream stream = request.GetRequestStream())
            {
                soapEnvelopeXml.Save(stream);
            }

            using (WebResponse response = request.GetResponse())
            {
                using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                {
                    string soapResult = rd.ReadToEnd();
                    this.soapResult.Text = soapResult;
                    SendEmail(this.soapResult.Text);
                }
            }
        }

        //sending response to the emails from soap service
        public void SendEmail(String response)
        {
             MailMessage mail = new MailMessage("test@testmail.com", "test2@testmail.com");
            SmtpClient client = new SmtpClient();
            client.Port = 55;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host = "10.1.1.1";//"smtp.gmail.com";
            mail.Subject = "Response from SOAP Webservice1->" + this.textBox2.Text;
            mail.Body = response;// "this is my test email body";
            client.Send(mail);
        }
       
        //soap link details
        public static HttpWebRequest CreateWebRequest()
        {
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://test.com/services/EmpStatistics");
            webRequest.Headers.Add(@"SOAP:Action");
            webRequest.ContentType = "text/xml;charset=\"utf-8\"";
            webRequest.Accept = "text/xml";
            webRequest.Method = "POST";
            return webRequest;
        }
}
}