SOA Report With Dynamically Run Based on parameters
Create Replace procedure SOA_Report(P_C_Name Varchar2,P_Org_Id Number,P_GC_Name Varchar2,P_Currency_Code Varchar2)
--RETURN Number
Is
lc_boolean BOOLEAN;
ln_request_id NUMBER;
lc_printer_name VARCHAR2 (100);
lc_boolean1 BOOLEAN;
lc_boolean2 BOOLEAN;
V_CName VARCHAR2 (100);
V_Currency VARCHAR2 (100);
L_Org_Id Number;
P_PAY_GROUP Varchar2(100);
L_APPLICATION_ID Number;
L_RESPONSIBILITY_ID Number;
L_C_Org_ID Number;
Cursor C1 Is
Select Distinct Party_Name,G.Org_Id,Invoice_Currency_Code,Corporation_Class From Apps.Hz_Parties A,Apps.Hz_Cust_Accounts B,Apps.Hz_Party_Sites C,Apps.Hz_Locations D,Apps.Hz_Cust_Acct_Sites_All E,Apps.Hz_Cust_Site_Uses_All F, Apps.Ra_Customer_Trx_All G,
Hz_Organization_Profiles CG
Where A.Party_Id = B.Party_Id And C.Party_Id = B.Party_Id And C.Location_Id = D.Location_Id And C.Party_Site_Id = E.Party_Site_Id And E.Cust_Acct_Site_Id = F.Cust_Acct_Site_Id
And E.Cust_Account_Id = B.Cust_Account_Id
And G.Bill_To_Site_Use_Id=F.Site_Use_Id And Cg.Organization_Name=A.Party_Name And Cg.Party_Id=A.Party_Id
And Party_Name =Nvl(P_C_Name, Party_Name) And G.Org_Id=P_Org_Id
And INVOICE_CURRENCY_CODE=Nvl(P_Currency_Code,INVOICE_CURRENCY_CODE) And CORPORATION_CLASS=Nvl(P_GC_Name,CORPORATION_CLASS);
BEGIN
For i In C1
Loop
Begin
Select Distinct A.APPLICATION_ID,RESPONSIBILITY_ID,RIL.Org_Id as C_Org_ID
Into L_APPLICATION_ID,L_RESPONSIBILITY_ID,L_C_Org_ID
From ra_Customer_Trx_all RIL,Hr_Operating_Units OOD,
Fnd_Responsibility_Vl A,fnd_profile_option_values B
Where RIL.Org_Id=OOD.Organization_Id
And A.responsibility_id(+) = B.level_value
And RESPONSIBILITY_KEY Like '%RECEIVABLE%SUPER USER%'
And B.PROFILE_OPTION_VALUE=To_Char(RIL.Org_Id)
And RIL.Org_Id=P_Org_Id;
End;
Mo_Global.Init('AR');
Mo_Global.Set_Policy_Context ('S', L_C_ORG_ID);
Fnd_Global.Apps_Initialize(1110,L_RESPONSIBILITY_ID,L_APPLICATION_ID);
lc_boolean :=
fnd_submit.set_print_options (printer => lc_printer_name
,style => 'PDF Publisher'
,copies => 1
);
lc_boolean2 :=
FND_REQUEST.add_layout(template_appl_name => 'SQLAP'
,template_code => 'APXINDIA_XML'
,template_language => 'en'
' ,template_territory => 'US'
,output_format => 'PDF');
ln_request_id := APPS.FND_REQUEST.SUBMIT_REQUEST('SQLAP',
'APXINDIA_XML',
'',
TO_CHAR(SYSDATE,'DD-MON-RR HH24:MI:SS'),
FALSE,
i.Party_Name,
i.Org_Id,
i.Invoice_Currency_Code);
-- RETURN ln_request_id;
COMMIT;
End Loop;
--RETURN ln_request_id;
END;
Create Replace procedure SOA_Report(P_C_Name Varchar2,P_Org_Id Number,P_GC_Name Varchar2,P_Currency_Code Varchar2)
--RETURN Number
Is
lc_boolean BOOLEAN;
ln_request_id NUMBER;
lc_printer_name VARCHAR2 (100);
lc_boolean1 BOOLEAN;
lc_boolean2 BOOLEAN;
V_CName VARCHAR2 (100);
V_Currency VARCHAR2 (100);
L_Org_Id Number;
P_PAY_GROUP Varchar2(100);
L_APPLICATION_ID Number;
L_RESPONSIBILITY_ID Number;
L_C_Org_ID Number;
Cursor C1 Is
Select Distinct Party_Name,G.Org_Id,Invoice_Currency_Code,Corporation_Class From Apps.Hz_Parties A,Apps.Hz_Cust_Accounts B,Apps.Hz_Party_Sites C,Apps.Hz_Locations D,Apps.Hz_Cust_Acct_Sites_All E,Apps.Hz_Cust_Site_Uses_All F, Apps.Ra_Customer_Trx_All G,
Hz_Organization_Profiles CG
Where A.Party_Id = B.Party_Id And C.Party_Id = B.Party_Id And C.Location_Id = D.Location_Id And C.Party_Site_Id = E.Party_Site_Id And E.Cust_Acct_Site_Id = F.Cust_Acct_Site_Id
And E.Cust_Account_Id = B.Cust_Account_Id
And G.Bill_To_Site_Use_Id=F.Site_Use_Id And Cg.Organization_Name=A.Party_Name And Cg.Party_Id=A.Party_Id
And Party_Name =Nvl(P_C_Name, Party_Name) And G.Org_Id=P_Org_Id
And INVOICE_CURRENCY_CODE=Nvl(P_Currency_Code,INVOICE_CURRENCY_CODE) And CORPORATION_CLASS=Nvl(P_GC_Name,CORPORATION_CLASS);
BEGIN
For i In C1
Loop
Begin
Select Distinct A.APPLICATION_ID,RESPONSIBILITY_ID,RIL.Org_Id as C_Org_ID
Into L_APPLICATION_ID,L_RESPONSIBILITY_ID,L_C_Org_ID
From ra_Customer_Trx_all RIL,Hr_Operating_Units OOD,
Fnd_Responsibility_Vl A,fnd_profile_option_values B
Where RIL.Org_Id=OOD.Organization_Id
And A.responsibility_id(+) = B.level_value
And RESPONSIBILITY_KEY Like '%RECEIVABLE%SUPER USER%'
And B.PROFILE_OPTION_VALUE=To_Char(RIL.Org_Id)
And RIL.Org_Id=P_Org_Id;
End;
Mo_Global.Init('AR');
Mo_Global.Set_Policy_Context ('S', L_C_ORG_ID);
Fnd_Global.Apps_Initialize(1110,L_RESPONSIBILITY_ID,L_APPLICATION_ID);
lc_boolean :=
fnd_submit.set_print_options (printer => lc_printer_name
,style => 'PDF Publisher'
,copies => 1
);
lc_boolean2 :=
FND_REQUEST.add_layout(template_appl_name => 'SQLAP'
,template_code => 'APXINDIA_XML'
,template_language => 'en'
' ,template_territory => 'US'
,output_format => 'PDF');
ln_request_id := APPS.FND_REQUEST.SUBMIT_REQUEST('SQLAP',
'APXINDIA_XML',
'',
TO_CHAR(SYSDATE,'DD-MON-RR HH24:MI:SS'),
FALSE,
i.Party_Name,
i.Org_Id,
i.Invoice_Currency_Code);
-- RETURN ln_request_id;
COMMIT;
End Loop;
--RETURN ln_request_id;
END;
No comments:
Post a Comment