Sample script to Create Journals Using API from Backend.
--Below is the sample script to call API from backend .
declare
------------------------
--API Variables
------------------------
p_init_msg_list VARCHAR2(1):= FND_API.G_TRUE;
lx_return_status VARCHAR2(240);
lx_msg_count NUMBER;
lx_msg_data VARCHAR2(4000);
lx_msg_index_out NUMBER;
lx_completion_retcode VARCHAR2 (1) := 'N';
lx_error NUMBER := 0; -- This is for line errors count
lx_exception EXCEPTION;
LX_AE_HEADER_ID NUMBER;
LX_EVENT_ID NUMBER;
begin
-------------------------------
--Apps Initialization
-------------------------------
-- fnd_global.apps_initialize ( user_id => 24214 --User Id
-- ,resp_id => 51108 --Responsibility Id
-- ,resp_appl_id => 608 --Responsibility Application Id
-- );
XLA_JOURNAL_ENTRIES_PUB_PKG.create_journal_entry_header( p_api_version => 1.0
,p_init_msg_list => p_init_msg_list
,p_application_id => 222--ln_application_id
,p_ledger_id => 1001--ln_ledger_id
,p_legal_entity_id => null
,p_gl_date => '30-NOV-2019'--ld_accounting_date
,p_description => 'TESTING '--lc_description
,p_je_category_name => 'Accrual'--lc_je_category
,p_balance_type_code => 'A'
,p_budget_version_id => null
,p_reference_date => null
,p_budgetary_control_flag => null
,p_attribute_category => NULL
,p_attribute1 => NULL--lc_reversal_flag
,p_attribute2 => null
,p_attribute3 => null--TO_CHAR(ld_creation_date,'DD/MM/YYYY HH24:MI:SS')
,p_attribute4 => null
,p_attribute5 => null
,p_attribute6 => null
,p_attribute7 => null
,p_attribute8 => null
,p_attribute9 => null
,p_attribute10 => null
,p_attribute11 => null
,p_attribute12 => null
,p_attribute13 => null
,p_attribute14 => null
,p_attribute15 => null
,x_return_status => lx_return_status
,x_msg_count => lx_msg_count
,x_msg_data => lx_msg_data
,x_ae_header_id => lx_ae_header_id
,x_event_id => lx_event_id
);
/*--------------------------------+
|Result status and error handling |
+--------------------------------*/
FND_FILE.put_line(FND_FILE.LOG,'***************************');
FND_FILE.put_line(FND_FILE.LOG,'Header Output information ....');
FND_FILE.put_line(FND_FILE.LOG,'return_status= '||lx_return_status);
FND_FILE.put_line(FND_FILE.LOG,'msg_count= '||lx_msg_count);
FND_FILE.put_line(FND_FILE.LOG,'ae_header_id= '||lx_ae_header_id);
FND_FILE.put_line(FND_FILE.LOG,'event_id= '||lx_event_id);
FND_FILE.put_line(FND_FILE.LOG,'***************************');
DBMS_OUTPUT.put_line('***************************');
DBMS_OUTPUT.put_line('Header Output information ....');
DBMS_OUTPUT.put_line('return_status= '||lx_return_status);
DBMS_OUTPUT.put_line('msg_count= '||lx_msg_count);
DBMS_OUTPUT.put_line('ae_header_id= '||lx_ae_header_id);
DBMS_OUTPUT.put_line('event_id= '||lx_event_id);
DBMS_OUTPUT.put_line('***************************');
IF lx_return_status <> 'S' AND lx_msg_count > 0 THEN
FOR I IN 1..lx_msg_count
LOOP
FND_MSG_PUB.get (p_msg_index => i,
p_encoded => 'F',
p_data => lx_msg_data,
p_msg_index_out => lx_msg_index_out
);
DBMS_OUTPUT.put_line(lx_msg_data);
END LOOP;
END IF;
end;
No comments:
Post a Comment