ORACLE

ORACLE
Let us share our knowledge to the world of oracle apps. I am trying my best to do so and I request every one to contribute their part. If you have any thing useful related to oracle apps, do send me I will post in my blog on behalf of you. If you like my blog tell the world about it, else tell me i will improve. You can suggest me, what exactly you want on oracle apps. Mail your queries.

Wednesday, May 21, 2014

Create Claim

DECLARE
  lv_return_status   VARCHAR2 (1);
  lv_msg_count       NUMBER;
  lv_msg_data        VARCHAR2 (20000);
  lv_resp_name       VARCHAR2 (100) := 'Oracle Trade Management User';
  lv_user_name       VARCHAR2 (100) := 'HARI';
  lv_appl_short_name VARCHAR2 (100);
  lv_appl_id         NUMBER;
  lv_resp_id         NUMBER;
  lv_user_id         NUMBER;
  lv_org_id          NUMBER;
  lv_claim_pub_rec ozf_claim_pub.claim_rec_type;
  lv_claim_line_pub_tbl ozf_claim_pub.claim_line_tbl_type;
  lv_claim_line_count NUMBER := 0;
  lv_x_claim_id       NUMBER;
  
BEGIN
  SELECT fa.application_id,
    responsibility_id,
    fa.application_short_name
  INTO lv_appl_id,
       lv_resp_id,
       lv_appl_short_name
  FROM fnd_responsibility_vl fr,
    fnd_application fa
  WHERE responsibility_name = lv_resp_name
  AND fr.application_id     = fa.application_id;
  
  SELECT user_id 
  INTO lv_user_id 
  FROM fnd_user
  WHERE user_name = lv_user_name;

 fnd_global.apps_initialize (lv_user_id, lv_resp_id, lv_appl_id);
  Mo_Global.set_policy_context ('S', 85);
  lv_claim_pub_rec.claim_number                   := 'NEW1234';
  lv_claim_pub_rec.cust_account_id                := 3022;
  lv_claim_pub_rec.amount                         := 5000;
  lv_claim_pub_rec.gl_date                        := SYSDATE;
  lv_claim_pub_rec.acctd_amount                   := 5000;
  lv_claim_pub_rec.status_code                    := 'NEW';
  lv_claim_pub_rec.claim_type_id                  := -6;
  lv_claim_pub_rec.reason_code_id                 := 43;
  lv_claim_pub_rec.last_update_date               := SYSDATE;
  lv_claim_pub_rec.last_updated_by                := lv_user_id;
  lv_claim_pub_rec.creation_date                  := SYSDATE;
  lv_claim_pub_rec.created_by                     := lv_user_id;
  lv_claim_pub_rec.claim_date                     := SYSDATE;
  lv_claim_pub_rec.amount_remaining               := 5000;
  lv_claim_pub_rec.currency_code                  := 'USD';
  lv_claim_pub_rec.org_id                         := 85;
  lv_claim_pub_rec.set_of_books_id                := 2022;
  lv_claim_line_pub_tbl (1).claim_line_id         := ozf_claim_lines_all_s.nextval;
  lv_claim_line_pub_tbl (1).object_version_number := 1.0;
  lv_claim_line_pub_tbl (1).last_update_date      := SYSDATE;
  lv_claim_line_pub_tbl (1).last_updated_by       := lv_user_id;
  lv_claim_line_pub_tbl (1).creation_date         := SYSDATE;
  lv_claim_line_pub_tbl (1).created_by            := lv_user_id;
  lv_claim_line_pub_tbl (1).claim_id              := lv_x_claim_id;
  lv_claim_line_pub_tbl (1).line_number           := 1;
  lv_claim_line_pub_tbl (1).amount                := lv_claim_pub_rec.amount;
  lv_claim_line_pub_tbl (1).claim_currency_amount := lv_claim_pub_rec.acctd_amount;
  lv_claim_line_pub_tbl (1).acctd_amount          := lv_claim_pub_rec.acctd_amount;
  lv_claim_line_pub_tbl (1).set_of_books_id       := 2022;
  lv_claim_line_pub_tbl (1).valid_flag            := lv_claim_pub_rec.valid_flag;
  lv_claim_line_pub_tbl (1).org_id                := 85;
  lv_claim_line_pub_tbl (1).currency_code:= lv_claim_pub_rec.currency_code;

  
  
  ozf_claim_pub.create_claim (p_api_version_number => 1.0,
 p_init_msg_list => fnd_api.g_true,
 p_commit => fnd_api.g_false,
 p_validation_level => fnd_api.g_valid_level_full,
 x_return_status => lv_return_status,
 x_msg_count => lv_msg_count,
 x_msg_data => lv_msg_data,
 p_claim_rec => lv_claim_pub_rec,
 p_claim_line_tbl => lv_claim_line_pub_tbl,
 x_claim_id => lv_x_claim_id );
 
 
IF lv_return_status <> 'S'
THEN
IF lv_msg_count > 0
THEN
FOR i IN 1 .. lv_msg_count
LOOP
Fnd_Msg_Pub.get (i, Fnd_Api.g_false, lv_msg_data,lv_msg_count);
DBMS_OUTPUT.PUT_LINE ('Error Message : ' || lv_msg_data);

END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE
( 'Error occured while updating claim id');
END IF;


END;
/

No comments:

Post a Comment