create or replace function create_ccid( p_concat_segs in varchar2) return varchar2is-- pragma autonomous_transaction; -- if you need autonomy!l_keyval_status BOOLEAN;l_coa_id NUMBER;l_err_msg varchar2(2000);l_error varchar2(255);begin--SELECT * FROM gl_sets_of_books;beginselect chart_of_accounts_idinto l_coa_idfrom gl_sets_of_bookswhere set_of_books_id = 2159;--fnd_profile.value('GL_SET_OF_BKS_ID');exceptionwhen no_data_found thendbms_output.put_line('Chart of Accounts ID not found from profile option GL_SET_OF_BKS_ID');dbms_output.put_line('Try setting up your environment with fnd_global.apps_initialize');raise;end;-- keyval_mode can be one of CREATE_COMBINATION CHECK_COMBINATION FIND_COMBINATION--create will only work if dynamic inserts on and cross validation rules not brokenl_keyval_status := fnd_flex_keyval.validate_segs('CREATE_COMBINATION','SQLGL','GL#',l_coa_id,p_concat_segs,'V',sysdate,'ALL', NULL, NULL, NULL, NULL,FALSE,FALSE, NULL, NULL, NULL);if l_keyval_status thenreturn 'S';else--return l_error;l_err_msg:=substr(fnd_flex_keyval.error_message, 1, 240); --fnd_message.get;l_error := substr(fnd_flex_keyval.error_message, 1, 240);dbms_output.put_line(l_error);dbms_output.put_line('ERROR SEGMENT :');l_error := to_char(fnd_flex_keyval.error_segment);dbms_output.put_line(l_error);dbms_output.put_line('ERROR ENCODED :');l_error := substr(fnd_flex_keyval.encoded_error_message, 1, 240);dbms_output.put_line(l_error);dbms_output.put_line('FALSE');dbms_output.put_line(l_err_msg||substr(sqlerrm,150,3));return l_error;end if;EXCEPTION WHEN OTHERS THENDBMS_OUTPUT.PUT_LINE(SQLERRM);end create_ccid;DECLAREL_RETURN VARCHAR2(2000);BEGINFOR I IN (SELECT LIABILITY_ACCOUNT FROM XX_VENDOR_API_GL) LOOPSELECT create_ccid(i.LIABILITY_ACCOUNT)INTO L_RETURNFROM DUAL;COMMIT;END LOOP;END;
This blog is sharing knowledge of my experience and others. Please do test in your test environment before deploying into prod instance.
Search This Blog
Wednesday, February 28, 2024
Apps R12 to create Code Combination from Back End.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment