Monday, April 23, 2018

Create AR Transaction/Invoice adjustment(API)



Scope: To apply the adjustment in AR Invoice. (eg. To make AR Invoice amount roundoff).

  • Before RoundOff adjustment API.


Applying Adjustment through API.

---++----------------------------------Code-----------------++-------------------------
DECLARE

up_adj_rec              ar_adjustments%rowtype;
up_api_name             VARCHAR2(20);
up_api_version          NUMBER;
up_called_from          VARCHAR2(10);
up_check_amount         VARCHAR2(1);
up_chk_approval_limits  VARCHAR2(1);
up_commit_flag          VARCHAR2(1);
up_init_msg_list        VARCHAR2(1);
up_move_deferred_tax    VARCHAR2(10);
up_msg_count            NUMBER;
up_msg_data             VARCHAR2(2000);
up_new_adjust_id        ar_adjustments.adjustment_id%type;
up_new_adjust_number    ar_adjustments.adjustment_number%type;
up_old_adjust_id        ar_adjustments.adjustment_id%type;
up_return_status        VARCHAR2(5);
up_validation_level     NUMBER;


BEGIN

 apps.mo_global.init ('AR');
 apps.mo_global.set_policy_context ('S',204);  --Pass valid Org_id 
 apps.fnd_global.apps_initialize(1318,50559,222); -- Initiliaze the application with valid value.

up_adj_rec              := NULL;
up_api_name             := NULL;
up_api_version          := 1.0;
up_called_from          := NULL;
up_check_amount         := NULL;
up_chk_approval_limits  := NULL;
up_commit_flag          := NULL;
up_init_msg_list        := FND_API.G_TRUE;
up_move_deferred_tax    := 'Y';
up_msg_count            := 0;
up_msg_data             := NULL;
up_new_adjust_id        := NULL;
up_new_adjust_number    := NULL;
up_old_adjust_id        := NULL;
up_return_status        := NULL;
up_validation_level     := FND_API.G_VALID_LEVEL_FULL;


/* api- data adjustments mapping record - start */


up_adj_rec.ACCTD_AMOUNT         := 0.09;        
up_adj_rec.ADJUSTMENT_ID        := NULL;
up_adj_rec.ADJUSTMENT_NUMBER    := NULL;
up_adj_rec.ADJUSTMENT_TYPE      := 'M';                 
up_adj_rec.AMOUNT               := 0.09;         
up_adj_rec.CREATED_BY           := -1;        
up_adj_rec.CREATED_FROM         := 'XXTEST_RCVRoundoff';
up_adj_rec.CREATION_DATE        := SYSDATE;
up_adj_rec.GL_DATE              := SYSDATE;
up_adj_rec.LAST_UPDATE_DATE     := SYSDATE;
up_adj_rec.LAST_UPDATED_BY      := -1;
--up_adj_rec.POSTING_CONTROL_ID   := -3;
up_adj_rec.SET_OF_BOOKS_ID      := 1;
up_adj_rec.STATUS               := 'A';
up_adj_rec.TYPE                 := 'CHARGES';              
up_adj_rec.PAYMENT_SCHEDULE_ID  := 561827;               
up_adj_rec.APPLY_DATE           := SYSDATE;
up_adj_rec.RECEIVABLES_TRX_ID   := 13910;        -- this is rec activity
up_adj_rec.CUSTOMER_TRX_ID      := 1263466;       --- Transaction for which adjustment is made



/*  api- data adjustments mapping record - End */


AR_ADJUST_PUB.Create_Adjustment
(
p_api_name              => up_api_name,
p_api_version           => up_api_version,
p_init_msg_list         => up_init_msg_list,
p_commit_flag           => up_commit_flag,
p_validation_level      => up_validation_level,
p_msg_count             => up_msg_count,
p_msg_data              => up_msg_data,
p_return_status         => up_return_status,
p_adj_rec               => up_adj_rec,
p_chk_approval_limits   => up_chk_approval_limits,
p_check_amount          => up_check_amount,
p_move_deferred_tax     => up_move_deferred_tax,
p_new_adjust_number     => up_new_adjust_number,
p_new_adjust_id         => up_new_adjust_id,
p_called_from           => up_called_from,
p_old_adjust_id         => up_old_adjust_id
);


DBMS_OUTPUT.PUT_LINE('New Adjustment Number: ' || up_new_adjust_number);
DBMS_OUTPUT.PUT_LINE('New Adjustment ID: ' || up_new_adjust_id);


IF up_msg_count >=1 THEN
FOR I IN 1..up_msg_count LOOP
dbms_output.put_line(I||'. '||SUBSTR(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;

END;

-----++---------------------------------------------------------------------------++-----------------------
  • After  Round Off Apply. The Transaction possibly looks like this below.




Here the adjustment applied successfully and transaction amount has been rounded off.


7 comments:

  1. Thanks for your information.nice blog,it helps many students.Oracle Training in Hyderabad

    ReplyDelete
  2. That's amazing to read blog about commerce xml.
    CXML Ariba

    ReplyDelete
  3. Thanks for sharing great article about cXML.
    What is cXML

    ReplyDelete
  4. Thanks for sharing article about CXML Punchout
    CXML Punchout

    ReplyDelete
  5. Nice Information.
    PunchOut cXML- Vurbis Interactive used punchout cxml protocol developed by Ariba which helps for online shopping and ordering between e-procurement systems.
    PunchOut cXML

    ReplyDelete
  6. That is really nice to hear. thank you for the update and good luck. online invoice app

    ReplyDelete
  7. Thanks for sharing this great information.It is useful information for those who are looking for free invoice generator which helps in creating instant invoices.

    ReplyDelete