Wednesday, May 20, 2015

Service Contracts & Pricing

To create Locked price list header,line and price breaks to a  service contract line


 Declare

G_price_list_id number;
P_New_Sc_Header_Id number;
P_List_Line_Id   number;

 BEGIN
 L_Source_Price_List_Id := G_Price_List_Id; --source price_list_id
 P_Orig_System_Header_Ref := P_New_Sc_Header_Id; -- Contract_ID
 P_Source_List_Line_Id := P_List_Line_Id; --Source list line id
 P_List_Source_Code := 'OKS'; --source code OKS or QP
 P_Org_Id := 81;  -- organization_id
 Debug_p('calling Qp_Lock_Pricelist_Pvt.Lock_Price api to create locked price list header and line id');


 Qp_Lock_Pricelist_Pvt.Lock_Price(
P_Source_Price_List_Id => L_Source_Price_List_Id,
 P_Source_List_Line_Id => P_Source_List_Line_Id,
 P_Startup_Mode => P_List_Source_Code,
 P_Orig_System_Header_Ref => P_Orig_System_Header_Ref,
 P_Org_Id => P_Org_Id,
 P_Commit => 'T',
 X_Locked_Price_List_Id => X_Locked_Price_List_Id, X_Locked_List_Line_Id => X_Locked_List_Line_Id, X_Return_Status => X_Return_Status, X_Msg_Count => X_Msg_Count, X_Msg_Data => X_Msg_Data);
 IF X_Return_Status <> Fnd_Api.G_Ret_Sts_Success
 THEN
 RAISE
Fnd_Api.G_Exc_Unexpected_Error;
 ELSE
 Debug_p('Locked price list created successfully');
 Debug_p('X_Locked_Price_List_Id' || X_Locked_Price_List_Id); Debug_p('X_Locked_List_Line_Id' || X_Locked_List_Line_Id);
 Debug_p('Created Locked Price list and price list line id: ' || X_Locked_Price_List_Id || ' and ' || X_Locked_List_Line_Id);

 UPDATE Oks_k_Lines_b Oklb
 SET Locked_Price_List_Id = X_Locked_Price_List_Id,
 Locked_Price_List_Line_Id = X_Locked_List_Line_Id
 WHERE Oklb.Cle_Id = Line_Id ---contract line id
 AND Oklb.Dnz_Chr_Id = Id; -- contract id


 End;
------------------------------------------------------------------------------------------------------------------

Api to update  Service contract header


Declare
    Khrv_Rec_In             Oks_Khr_Pvt.Khrv_Rec_Type;
    Khrv_Rec_Out            Oks_Khr_Pvt.Khrv_Rec_Type;
    L_contract  number;
    l_Conversion_Type  varchar2(50);
    l_Conversion_Rate_Date date;
    l_Object_Version_Number number;
    x_Msg_Count number;
    x_Return_Status  varchar2(50);
    x_Msg_Data varchar2(50);
Begin

   --Assigning the record first
          l_Khrv_Rec_In.Id :=1234 ;-- l_Contract_Id;
          l_Khrv_Rec_In.Sts_Code := 'ACTIVE';
          l_Khrv_Rec_In.Conversion_Type       := 'Corporate';  --l_Conversion_Type;
          l_Khrv_Rec_In.Conversion_Rate_Date  :=l_Conversion_Rate_Date; -- SC startdate
          l_Khrv_Rec_In.Object_Version_Number := 1;--l_Object_Version_Number;

          --calling api to update contract header :
          Okc_Contract_Pub.Update_Contract_Header(p_Api_Version       => 1.0,
                                                  p_Init_Msg_List     => 'T',
                                                  x_Return_Status     => x_Return_Status,
                                                  x_Msg_Count         => x_Msg_Count,
                                                  x_Msg_Data          => x_Msg_Data,
                                                  p_Restricted_Update => 'T',
                                                  p_Chrv_Rec          => l_Khrv_Rec_In,
                                                  x_Chrv_Rec          => x_Khrv_Rec_Out);
          COMMIT;

End;

Tuesday, May 10, 2011

How do we extract first tuple from the set?

Use could usefunction Set.Item(0)
Example:

SELECT {{[Date].[Calendar].[Calendar Year].Members
}.Item(0)}
ON 0
FROM [Adventure Works]

How can we setup default dimension member in Calculation script?

We can use ALTER CUBE statement.

Syntax:
ALTER CUBE CurrentCube | YourCubeName UPDATE DIMENSION , DEFAULT_MEMBER='';

How to start & stop IOP Server

D:\Oracle\Middleware\user_projects\epmsystem1\bin\startIOPServer_iopinstance1.bat.
D:\Oracle\Middleware\user_projects\epmsystem1\bin\stopIOPServer_iopinstance1.bat.


where D:\Oracle\Middleware is the installation directory for EPM System

How to bring the model back to an unpublished state:

1.Export the model to a file system:
“exportmodel –u admin –p
2 Reset and restart the system:
a. Stop the server.
b. Run isreset.
c. Run startserver.
d. In a new window, run “initializesystem –u admin –p
3 Go to /custom/bin and import the exported model:
“isadmin –u admin –p -f “importmodel_export.isa””
You can then go back to the Administration Workbench, make any desired changes, and publish the model again.

How to create a script to import and publish a worksheet, a workbook, and an analysis type in IOP

Scripts are created by an administrator on the Administration / Script Templates page in the Administration Workbench.

We can create a script to import and publish a worksheet, a workbook, and an
analysis type.

alter model schema set current edit
import worksheet definition from file "xxxxxxxx.xml”
import workbook definition from file "xxxxxxxx.xml"
import analysistype definition from file "xxxxxxxxxxxx.xml"
publish metadata changes.



To execute a script:
1 In the Planning Workbench navigation panel, select Scripts.
2 Select a script and click Execute.

Monday, May 9, 2011

Scripts Templates

1.How to Set the model schema to edit mode.

Alter model schema set current edit.

2.How to Set the schema to shadow in backend and clear any previous information.

set schema shadow
clear schema shadow.

3.how to generate planning worksheet from modified XML files.

alter model schema set current edit
import worksheet definition from file "${interlace.home}\custom\workbook\worksheet_Standard Cost Delta.xml"
publish metadata changes

...more