Wednesday 3 June 2015

AP Interface With Dynamic Loader With Back End


Function AP_Invoice_Submit
Return Number

Is

PRAGMA AUTONOMOUS_TRANSACTION;

v_request_id NUMBER;

Cursor AP_Invoice
Is

    Select Distinct RESPONSIBILITY_KEY,PROFILE_OPTION_VALUE,A.APPLICATION_ID,RESPONSIBILITY_ID, ORGANIZATION_ID as Org_Id,Source
    From AP_INVOICES_INTERFACE API,
    Apps.Hr_Operating_Units HOU,Fnd_Responsibility_Vl A,fnd_profile_option_values B
    Where  API.OPERATING_UNIT=HOU.NAME
    And A.responsibility_id(+) = B.level_value
    And PROFILE_OPTION_VALUE=To_Char(HOU.ORGANIZATION_ID)
    And RESPONSIBILITY_KEY Like '%PAYA%SUPER USER'
    And Nvl(Status,0)!='PROCESSED';



BEGIN

For i In AP_Invoice
Loop
            Fnd_Global.Apps_Initialize(1110,i.RESPONSIBILITY_ID,i.APPLICATION_ID);
       
            v_request_id := APPS.FND_REQUEST.SUBMIT_REQUEST(
                'SQLAP',
                'APXIIMPT',
                'Payables Open Interface Import',
                TO_CHAR(SYSDATE,'DD-MON-RR HH24:MI:SS'),
                FALSE,
                i.ORG_ID,
                i.Source,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                'Y',
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL     );
         
             
    COMMIT;
 
End Loop;
Return v_request_id;      
END;

No comments:

Post a Comment