Thursday, March 28, 2019

Oracle AP Invoice Account Generator - Projects

This is From oracle Support

https://support.oracle.com/epmos/faces/DocumentDisplay?id=1344854.1


Customizing Supplier invoice account generator is one of the mandatory steps to generate an account for the project related invoice created in Payables.
Without customizing workflow system will not allow you to create a project related supplier invoice.

If we do not customize the PAAPINVW workflow, when we save the project related invoice distribution following error is raised.
"The default workflow for the Oracle Payables Account function Project Supplier Invoice Charge Account has not been customized.
Please replace the dummy function in the default process for account generation by your own account generation method"
Sample examples on how to customize PAAPINVW workflow.
  • Example 1 - Customizing the workflow with all the constant segment Values.
  • Example 2 - Customizing the workflow with one segment value derived from Lookup Set and rest are constant values.
  • Example 3 - Customizing the workflow to use user-entered account in the invoice distributions screen.

Note: Even if users manually enter the account segments in the invoice distribution screen the workflow has to be customized.


The workflow file related to Project Supplier Invoice Account Generator which we need to customize is: PAAPINVW.wft

The following points should be noted while customizing the workflow.
  1. The process must have result type of "Flexfield Result"
  2. The first node should be "Start Generating Code Combinations" and must be a "Start" Node
  3. The "Validate Code Combination" activity should be used before ending workflow with Success result.
  4. The end generating Code Combination must be an "End" node and should have result set to "Success"
  5. To abort generating Code Combination there should be a branch to an "End" node with result set to "Failure"

Before we start customizing the workflow we should know the number of segments to use in the workflow file. To determine number of segments go to the applications.

In Projects navigate to: Setup-->Flexfields-->Key-->Segments and search using
  • Application: General Ledger
  • Flexfield Title: Accounting Flexfield
Select the Accounting Structure that you are using and click on Segments



Example 1 - Customizing the workflow with all the constant segment Values.


1. Open the workflow file PAAPINVW.wft using Oracle Workflow Builder.

2. Create the process
Goto Node PAAPINVW-->Processes

Right Click on Processes Node and select "New Process" and input the following details
  • Internal Name
  • Display Name
  • Result Type - Flexfield Result
Click Ok.



3. Create the Start node
Open the process that you have defined. It will open a blank page
Right click on the page and select "New Function".  In the "Function" Tab, select following details
  • Item Type: Standard Flexifield Workflow
  • Internal Name: FND_FLEX_START_GENERATION




Next go to the "Node" tab. For Start/End - select "Start" since this is the start node.




Click Ok. It will create a Start node.



4. Next define other nodes and assign values to the segments. In this example we have 4 segments to which we must assign values.
  • Services Company
  • Services Department
  • Services Account
  • Services Product
To assign values to the above segments, right click on the page and select "New Function"

In the "Function" Tab, select the values as below:
  • Item Type: Standard Flexifield Workflow
  • Internal Name: FND_FLEX_ASSIGN_TO_SEGMENT



Go to the "Node Attributes" tab. Here we have four attributes:
  • Segment Identifier - whether segment is identified by "Qualifier" (like Balancing Segment) or "Name"
  • Segment - either the specific qualifier or specific name
  • Value - value to be assigned
  • Replace existing value - use "True" to copy value regardless of existing value,
    "False" to only copy the value if no value is currently assigned to the segment

We will use the name as our Segment Identifier.



For the "Segment" attribute input the value of the fisrt segment i,e "Services Company"
Since we are identifying segment using Name, segment value would be the internal name of the Segment.



For Value input a constant value to be assigned to the "Services Company" segment.
Replace existing value - use "True" to copy value regardless of existing value,"False" to only copy the value if no value is currently assigned to the segment





Once done click Ok.
5. Similarly assign values to other 3 segments.
  • Services Department
  • Services Account
  • Services Product







6. Once values are assigned to the segments, add the activity "Validate Code Combination"

Right click on the page and select "New Function"

In the "Function" Tab, select the values below:
  • Item Type: Standard Flexfield Workflow
  • Internal Name: FND_FLEX_VALIDATE_COMBINATION



Go to the "Node Attributes" and input the required values
  • Validation Type: Set to "Generate Code Combination ID" to do full validation and return the CCID, set to "Validate Segments with Values only" to validate the individual segment values that have values assigned
  • New code combinations are allowed:  Set to "True" if you have dynamic inserts enabled for your accounting flexfield and wish for new combinations to be created.  Set to "False" otherwise. 
Note: Even if new combinations are allowed, this node does not insert the combination into GL_CODE_COMBINATIONS or create the new CCID. Rather it validates the combination and returns -1 as the CCID to the calling module if the combination is otherwise valid.




7. Create the End node

Right click on the page and select "New Function".  In the "Function" tab, select the values below:
  • Item Type: Standard Flexfield Workflow
  • Internal Name: FND_FLEX_END_GENERATION



Go to the "Node" tab. For "Start/End" select "End" since this is the end node.
For "Result" select  "Success".



Click ok and it will create an End Node.

8. Link all the nodes we have created to derive the process flow



9. Once the Customization is complete, we need load the workflow file to the data base.

This can be done directly in workflow builder by saving the workflow to the database, or you can save the workflow to a file and use the below command to load the workflow file to the database.

WFLOAD apps/apps 0 Y UPLOAD <filename>.wft
10. Assign our account generator process to the appropriate account generation function in the application.
Sign into applications
In Projects: Setup > Flexfields > Key > Accounts, search using the following
  • Application: General Ledger
  • Flexfiled Title: Accounting Flexfield
Select the Accounting Structure that you are using.

Select appropriate account generator i.e., "Project Supplier Invoice Account Generator", and assign the new custom process that you defined.

11. Now when we create a project related supplier invoice the process will create a supplier charge account using the workflow customization we have created and assigned.


Example 2 - Customizing the workflow with one segment value derived from Lookup Set and rest are constant values.

In the above example all values assigned to the segments were constant values.  In this example, we will show how we can also get the values for the segments from lookup sets defined in Projects.

In this example, we will show how the value for segment2 ("Services Department") can be dervied from a lookup set, with the other values remaining the same.

1. First we need to define a lookup set in the application.
In Projects navigate to: Setup > AutoAccounting > Lookup sets
Define a lookup set, providing the lookup set name and optionally a description.
Define at least one intermediate value and segment value.  These values will map application related information to an accounting segment value


2. Create a new node which uses the lookup set to determine the segment value
Open the Workflow and goto the process that we have defined.  Right click on the page and select "New Function"

In the "Function" Tab, select the values below:
  • Item Type: Project Supplier Invoice Account Generation
  • Internal Name: SEGMENT_LOOKUP_SET



Go to the "Node Attributes" tab and input "Lookup Set Name". Here input the lookup set which is defined in the previous step (or any well defined lookup set).



The intermediate value you select depends on your business requirement and the way lookup set is defined.  This will be the value you are using to map to the segment values.  For example, if we need to get the segment values based on Expenditure type we would use the following:
  • Type: Item Attribute
  • Value: Expenditure Type



When the workflow is called, the expenditure type attribute for the current transaction will be compared against the assigned lookup set, and if a corresponding intermediate value is found there, it will return the mapped segment value.

In our example, if the invoice distribution being processed has an assigned expenditure type of "Clerical", then the corresponding segment value "02" will be returned.
If the intermediate value (in this case expenditure type) is not found in the lookup set, the process will return an error.

3. Create branches to handle the return values based on success or failure results
If the value has been found, we will create a node to assign the value to segment.

Right click on the page and select "New Function".  In the "Function" Tab, select the values below
  • Item Type: Standard Flexifield Workflow
  • Internal Name: FND_FLEX_ASSIGN_TO_SEGMENT
Go to the "Node Attributes".
For the "Segment" attribute input the value of the segment for which the lookupset value needs to be assigned.  Since we are using the segment name to identify our segments this would be  "Services Department".

For the "Value" section the type would be "Item Attribute" and the value would be "Lookup Set Value"
Note:  The "Assign Value to Segment" node should immediately follow the "Segment Lookup Set value" node in the flow, or at least should occur prior to any subsequent "Segment Lookup Set value" nodes.



When the value is not found or there is an error we should abort the process.
Right click on the page and select "New Function" and in the "Function" Tab, select the values below
  • Item Type: Standard Flexifield Workflow
  • Internal Name: FND_FLEX_ABORT_GENERATION



Go to the "Node" tab and enter the values
  • Start/End: End
  • Result: Failure



Once all the nodes are defined link all the nodes to complete the workflow setup




Example 3 - Customizing the workflow to use the account entered manually in the Invoice Workbench distributions screen.


In the Invoice Workbench we have an option to manually enter the supplier invoice account, to retain this account we need to customize the workflow as follows.
Note: On 11i, you may need to apply periodic patch 5847631 in order for this example to work correctly

1. Set the value of the profile option "PA: Allow Override of PA Distributions in AP/PO" to "Yes".

2. Create a branching node which will use the function "Comparenumber" to determine the appropriate branch of the workflow based on the existence of a passed in code combination id (CCID).  This node should be placed after the "Start" node of the process.

Open the workflow file and goto the process that we have defined. Right click on the page and select "New Function" In the "Function" tab, select the values below
  • Item Type: Standard
  • Internal Name: Compare Number



Go to the "Node Attributes" tab.
For the attribute "Test Value" input the following details:
  • Type: Attribute
  • Value: Supplier Invoice Account Ccid



For the attribute "Reference Value" input the following details:
  • Type: Constant
  • Value: 0



Since we are entering account manually in the invoice screen, the ccid will be already populated and will get assigned to "Supplier Invoice Account Ccid" when the workflow is called.
Here by using the "Compare number" we are validating whether or not an account has already been entered.

Because the "Test Value"  is "Supplier Invoice Account Ccid" and the "Reference Value"  is 0 the comparison will be a match when the "Supplier Invoice Account Ccid" value is 0.  This will be the value if no CCID has been passed in, meaning that no account was entered manually.
In this case we need to follow a path that will generate a valid account.

If, on the other hand, the value of "Supplier Invoice Account Ccid" is not 0, this implies that an account has been entered manually in invoice screen.  In this case we will branch to a path that will accept the values from the passed in CCID and exit.


3.  Define a node to copy the passed in CCID when this is available from manual entry of the account.

Right click on the page and select "New Function" and in the "Function" tab, select the values below
  • Item Type: Standard Flexfield Workflow
  • Internal Name: FND_FLEX_COPY_FROM_COMB



Go to the "Node Attributes" tab and for attribute "Code Combination ID" input the following details:
  • Type: Attribute
  • Value: Supplier Invoice Account Ccid



For attribute "Replace existing value" input the following details:
  • Type: Constant
  • Value: True



Link the nodes as shown in the below screen shot below which has 2 paths:
  1. To generate account using the standard workflow customization logic when no account combination is passed in
  2. To retain the account entered manually in the invoice screen when this is passed in




Note - Please note that all the above are merely examples using dummy values assigned to the segments. Based on your business requirements the values you use and number of segments will obviously differ. Your actual customizations will have to be created in accordance with your requirements.

2 comments:

  1. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.
    account generator

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete