This discussion is archived
8 Replies Latest reply: Jan 11, 2013 12:53 AM by Paul Horth RSS

PLS-00306: wrong number or types of arguments in call to 'INIT'

979151 Newbie
Currently Being Moderated
I'm developing the PO cancellation package in database version 10.2.0.4.when I'm trying to execute the package below error appears from "MO_GLOBAL.INIT('PO');"

PLS-00306: wrong number or types of arguments in call to 'INIT'

PROCEDURE PROC_CANCEL_PO (PO_NUM VARCHAR2)
IS
CURSOR C1 IS
SELECT * FROM PO_HEADERS_ALL
WHERE SEGMENT1 = PO_NUM
AND ORG_ID = FND_PROFILE.VALUE('ORG_ID');

V_USER_ID NUMBER ;
V_RESPONSIBILITY_ID NUMBER ;
V_RESPONSIBILITY_APPL_ID NUMBER ;
V_ORG_ID VARCHAR2(20) ;
L_RETURN_STATUS VARCHAR2(1) := NULL;
L_MSG_DATA VARCHAR2(2000);
V_SUCCESS_COUNT NUMBER;
V_FAILURE_COUNT NUMBER;

BEGIN

V_SUCCESS_COUNT := 0;
V_FAILURE_COUNT := 0;

FOR i IN C1 LOOP
FND_FILE.PUT_LINE(FND_FILE.LOG ,'START OF CANCEL PO PROCESS API'||SYSDATE );
BEGIN
V_USER_ID := FND_GLOBAL.USER_ID ;
V_RESPONSIBILITY_ID := FND_GLOBAL.RESP_ID ;
V_RESPONSIBILITY_APPL_ID := FND_GLOBAL.RESP_APPL_ID;
FND_GLOBAL.APPS_INITIALIZE( V_USER_ID ,V_RESPONSIBILITY_ID,V_RESPONSIBILITY_APPL_ID);
V_ORG_ID:=FND_PROFILE.VALUE('ORG_ID');
MO_GLOBAL.INIT('PO');
MO_GLOBAL.SET_POLICY_CONTEXT('S',V_ORG_ID);
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG , 'ERROR CODE FOR INITIALIZATION IS :'||TO_NUMBER( SQLCODE )||' '|| 'ERROR MSG FOR INITIALIZATION IS :'||SUBSTR( SQLERRM , 1 , 50) ) ;
END ;

FND_MSG_PUB.INITIALIZE ;
FND_FILE.PUT_LINE(FND_FILE.LOG , 'PO NUMBER TO CANCEL IS :'||i.SEGMENT1 ) ;

IF i.AUTHORIZATION_STATUS 'APPROVED'
THEN
UPDATE PO_HEADERS_ALL
SET AUTHORIZATION_STATUS = 'APPROVED'
WHERE SEGMENT1 = i.SEGMENT1 ;
END IF;

PO_DOCUMENT_CONTROL_PUB.CONTROL_DOCUMENT
(1.0, -- P_API_VERSION
FND_API.G_TRUE, -- P_INIT_MSG_LIST
FND_API.G_TRUE, -- P_COMMIT
L_RETURN_STATUS,-- X_RETURN_STATUS
'PO', -- P_DOC_TYPE
'STANDARD', -- P_DOC_SUBTYPE
NULL, -- P_DOC_ID
i.SEGMENT1, -- PO_NUM
NULL, -- P_RELEASE_ID
NULL, -- P_RELEASE_NUM
NULL, -- P_DOC_LINE_ID
NULL, -- P_DOC_LINE_NUM
NULL, -- P_DOC_LINE_LOC_ID
NULL, -- P_DOC_SHIPMENT_NUM
'CANCEL', -- P_ACTION
SYSDATE, -- P_ACTION_DATE
NULL, -- P_CANCEL_REASON
'N', -- P_CANCEL_REQS_FLAG
NULL, -- P_PRINT_FLAG
NULL, -- P_NOTE_TO_VENDOR
'N' ); --P_USE_GLDATE

FND_FILE.PUT_LINE(FND_FILE.LOG,'API RETURN STATUS IS-' || L_RETURN_STATUS);

IF L_RETURN_STATUS = 'U' THEN --( FND_API.G_RET_STS_UNEXP_ERROR)
FND_FILE.PUT_LINE(FND_FILE.LOG, 'UNEXPECTED ERROR IN CANCEL PO PROCESS API');
FND_MSG_PUB.ADD_EXC_MSG('QP_PRICE_LIST_PUB',' UNEXPECTED ERROR IN CANCEL PO PROCESS API');
ELSIF
L_RETURN_STATUS ='E' THEN --- ( FND_API.G_RET_STS_ERROR )
FND_FILE.PUT_LINE(FND_FILE.LOG, 'ERROR IN CANCEL PO PROCESS API');
FND_MSG_PUB.ADD_EXC_MSG('QP_PRICE_LIST_PUB','ERROR IN CANCEL PO PROCESS API');
END IF;

IF L_RETURN_STATUS != 'S' THEN
V_FAILURE_COUNT := V_FAILURE_COUNT + 1;
FND_FILE.PUT_LINE(FND_FILE.LOG, 'TOTAL FAIL RECORD COUNT'||V_FAILURE_COUNT);

FOR ERR_CODE IN 1..FND_MSG_PUB.COUNT_MSG LOOP
L_MSG_DATA := SUBSTR(FND_MSG_PUB.GET(P_MSG_INDEX => 1,P_ENCODED=>'F'),1,200);
FND_FILE.PUT_LINE(FND_FILE.LOG,'CANCEL PO PROCESS API FAILED FOR REASON-'||L_MSG_DATA ) ;
END LOOP;
END IF;

IF L_RETURN_STATUS = 'S' THEN --- ( FND_API.G_RET_STS_SUCESS)
FND_FILE.PUT_LINE (FND_FILE.LOG, 'CANCEL PO PROCESS API PASSED' ) ;
V_SUCCESS_COUNT := V_SUCCESS_COUNT + 1;
FND_FILE.PUT_LINE(FND_FILE.LOG,'TOTAL SUCCESS RECORD COUNT-'||V_SUCCESS_COUNT);

-- RENAME PO NUMBER AFTER CANCELLATION
UPDATE PO_HEADERS_ALL
SET SEGMENT1 = 'D-'||i.SEGMENT1
WHERE SEGMENT1 = i.SEGMENT1 ;

UPDATE PO_HEADERS_ARCHIVE_ALL
SET SEGMENT1 = 'D-'||i.SEGMENT1
WHERE SEGMENT1 = i.SEGMENT1 ;

END IF ;

END LOOP ;

EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG, 'ERROR CODE IN THE EXECUTION OF CANCEL API IS :'||TO_NUMBER( SQLCODE )||' '||SUBSTR( SQLERRM , 1 , 50) ) ;
END PROC_CANCEL_PO;

END PKG_EXPO_PO_INTERFACE;
/

Someone please explain me the reason for this error and please suggest me a solution for it.

Regards
Pramuditha
  • 1. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    Solomon Yakobson Guru
    Currently Being Moderated
    In SQL*Plus issue:
    desc MO_GLOBAL
    Look through output for INIT procedure and check what parameters it takes.

    SY.
  • 2. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    Code written in exclusive uppercase... You seem to have a broken keyboard? Or do you struggle to find and turn off the CapsLock key on your keyboard, when writing code?

    Hint: you will find the key on the left hand side of the keyboard.
  • 3. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    979151 Newbie
    Currently Being Moderated
    Dont concern about my coding style or my keyboard. If you cant give any answer please mind your own business. If I wanted to write in any other letters, even in Greek thats my way.Don't bother about uppercase.

    Edited by: 976148 on Jan 10, 2013 8:06 PM
  • 4. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    rp0428 Guru
    Currently Being Moderated
    If you want help you should focus on answering the questions and providing the information you were ask for.
    >
    Look through output for INIT procedure and check what parameters it takes.
  • 5. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    976148 wrote:
    Dont concern about my coding style or my keyboard. If you cant give any answer please mind your own business. If I wanted to write in any other letters, even in Greek thats my way.Don't bother about uppercase.
    It is about Readability.

    Do you think the purpose of your code is to merely instruct the compiler and computer? No. Your code also need to be written to be understood by fellow programmers.Who will use your code. Who will maintain your code. Who will debug your code.

    The “<i>Fundamental Theorem of Readability</i>” (from the book <i>The Art of Readable Code</i>) states:
    >
    Code should be written to minimize the time it would take for someone else to understand it.
    >

    A large part of programming language standards addresses this exact issue - code readability. Standards such as .Net Guidelines for Names. Or Code Conventions for the Java Programming Language. Well established, proven, and mature standards based on principles learned from decades of software writing.

    Writing code in all uppercase, violates basic readability standards, and violates programming standards of today.

    And if a developer violates common readability sense and de facto programming standards, what does it say about that developer? What other fundamentals are this developer ignoring? What basic (Oracle, SQL, PL/SQL, etc) concepts are that developer shoving aside?

    Your code is a reflection of not only what type of programmer you are, but also how good a programmer you are.

    Your code above violates the Fundamental Theorem of Readability. And that should be a problem for you, as it means for others, the code is difficult to read and understand - making it more difficult for them to assist you with errors and problems in the code.

    Seems to me that you have a lot to learn about how to write good and readable code - and your belittling of coding standards and code readability, also explains why your code is not working. As with that attitude, you do not care for software engineering fundamentals and Oracle concepts either.

    I suggest an attitude change - starting by finding the CapsLock key and turning it off when coding PL/SQL.
  • 6. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    979151 Newbie
    Currently Being Moderated
    Thank for the help, Think I found the answer.

    Set org context in R12

    The SQL command to set the ORG_ID prior to running a script is:
    SQL> exec mo_global.init('PO');
    exec mo_global.set_policy_context('S','&org_id');
    Enter the org_id when prompted.

    The procedure - mo_global.set_policy_context has two parameters
    p_access_mode & p_org_id


    p_access_mode - S
    Description - In case you want your current session to work against Single ORG_ID

         
    p_access_mode - M
    Description - In case you want your current session to work against multiple ORG_IDs

    p_org_id: Only applicable if p_access_mode is passed value of "S"

    If using Toad
    Begin
    mo_global.set_policy_context(‘S’, &org_id);
    End;

    Set org context in 11i:

    The SQL command to set the ORG_ID prior to running a script is:
    SQL> execute dbms_application_info.set_client_info(&org_id);

    Enter the org_id when prompted.

    If using Toad
    Begin
    fnd_client_info.set_org_context(&org_id);
    End;

    I use Oracle Apps 11i So I should use fnd_client_info.set_org_context(&org_id); instead of mo_global.init('PO')
  • 7. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    979151 Newbie
    Currently Being Moderated
    Thanx for your advise. Since I work for particular company i must follow their rules. Past developers have used UPPERCASE letters and it remains as a standard here. So I dont have any right to change the internal standards. I will try to follow the coding standards. :)

    Regards
    Pramuditha
  • 8. Re: PLS-00306: wrong number or types of arguments in call to 'INIT'
    Paul Horth Expert
    Currently Being Moderated
    976148 wrote:
    Thanx for your advise. Since I work for particular company i must follow their rules. Past developers have used UPPERCASE letters and it remains as a standard here. So I dont have any right to change the internal standards. I will try to follow the coding standards. :)

    Regards
    Pramuditha
    Is there anything to stop you suggesting the standards are changed to reflect normal modern practise?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points