11 Replies Latest reply: Nov 12, 2009 11:42 AM by 614478 RSS

    Oracle iExpense Extension

    495288
      Hi,
      We are looking at validating certain field in iexpense. However these fields are populated in different VOs.
      For example the 'account' value exists in ExpenseAllocationsVO.
      The 'amount' exists in the ExpenseReportLinesVO/EO.
      Say I want to validate between account and amount.
      I would ideally do validateentity Expense report lines as it has most of the information I need.
      How can I iterate through the AllocationsVO to seek the information I need?
      There is a common column between these two VOs which ReportLineId.
      can I do the following in the LinesEO
      Refer to the AllocationVO - I know how to do this.
      How do I do the following? This will be written and executed in the LinesEOImpl. Appriximate code will be appreciated.

      get the data that is currently populated in the AllocationsVO, Should I execute a query?
      loop through each row - How?
      Refer to the common column value like AllocationsVO_rec.getReportLineId().
      /* I will compare the lineid from AllocationsVO and the lineId from the EOImpl.
      if they are the same then the line from the VO corresponds to the line from the
      EO - so I can the compare AllocationVO.Account & LinesEO.amount.
      If validation fails raise an error.*/
      end loop;

      Thanks a lot
      Sandeep
        • 1. Re: Oracle iExpense Extension
          473963
          Hi,

          In iExpense each report line can have only one distribution information. So, in that case you may follow this approach,

          --extend the "ExpenseAllocationsVO" to get the line amount in the VO.
          --write a plsql function which would take the CODE_COMBINATION_ID and the LINE AMOUNT from the above VO. Do your validation in the PLSQL function and return appropriate value.
          --Based upon the above value, you may write your logic in the VOImpl to display required error message.

          Hope this helps.

          Cheers,
          AD
          • 2. Re: Oracle iExpense Extension
            495288
            Hi AD,
            Thank for the help. However, the line_amount is not in the ExpenseAllocationsVO. It is in the ExpenseReportLinesVO. How would I get the line_amount value from the LinesVO into the ExAllocationsVO?

            Thanks
            • 3. Re: Oracle iExpense Extension
              473963
              Extend the "ExpenseAllocationsVO" i.e. add a SQL statement to the VO wherein join AP_EXPENSE_REPORT_LINES_ALL and AP_EXP_REPORT_DISTS_ALL tables and select the AMOUNT column in the statement that would come from the LINES table.

              Hope this helps.

              Regards,
              AD
              • 4. Re: Oracle iExpense Extension
                495288
                Hi AD,
                Thanks. I'll try your suggestion.
                A question though. Please correct if my understanding of how OAF works is incorrect.

                Joining the table definitely would give access to the amount value from the lines table. However, the records we want to validate are before the save into the tables i.e. they are still in the VOs.
                So the data at the time of the validation is still in memory. Would the application understand that the amount I enter in the LinesVO attribute should be reflected in the ExpenseAllocationsVO's extended amount attribute?



                Thanks
                Sandeep
                • 5. Re: Oracle iExpense Extension
                  442947
                  Check if there is a association exists between these two EOs. If it is present you can access the other EO and do your validation.
                  • 6. Re: Oracle iExpense Extension
                    495288
                    Hi,
                    I have looked for an AO. But cannot find it. This would be the cleanest way to do this but there seems to be no AO. I'll keep looking.
                    I am assuming that there should be an AO somewhere as the EOs, LinesEO(Corresponding to LinesVO) and DistEO(Corresponding to ExpAllocVO) are FK related. Surprising that I cannot find it.
                    This is in Oracle iExpense. If you can make any suggestions from your experience that will be helpful.
                    Or can I create an AO my self? Something like extend both the EOs and create an Association between the Extended EOs. But again the join columns (Report_Line_Ids) are not created until the save/submit transaction. So I will not have them available prior to that which is the whole point-validate prior to save/doDml.

                    Thanks
                    • 7. Re: Oracle iExpense Extension
                      495288
                      Also by every indication in Oracle's documentation on OAF there should be a composite Assiciation between HeaderEO, LinesEO and ExpAllocationsEO as these are FK related.
                      How do I determine that these Associations do indeed exist?

                      Thanks
                      Sandeep
                      • 8. Re: Oracle iExpense Extension
                        495288
                        Hi,
                        I got this working. Oracle does not use associations in these cases but sets the appropriate join fields as transient attributes whose values are derived from LinesVO.
                        I added some more transient attributes to the AllocationsVO and populated them with the LinesVO attributes.
                        This gave me access to the linesVO info in the AllocationsVORowImpl.
                        Although Oracle says that all validation logic should be placed in EO's, in the Oracle iExpense there are a bunch of validations that are performed at the VORowImpl level and quite a few pl/sql packages are called here. I just went by the same paradigm.

                        Sandeep
                        • 9. Re: Oracle iExpense Extension
                          532716
                          Hi Sandeep,

                          We have a similar requirement now and would like you to share some info regarding this

                          I need to get the Cost_Center from the ExpenseAllocationsVO() and Attribute5 from AllocationsLinesVO().
                          I have created a transient variable for Attribute5 in ExpenseAllocationsVO() (thru Extension and substituted the VO)

                          As you mentioned "This gave me access to the linesVO info in the AllocationsVORowImpl ", does it mean, now I will have access to Attribute5 of linesVO() in AllocationsVORowImpl ?

                          If so can you please let me know the sample code for this.

                          ExpenseAllocationsVOImpl expvo = expallampl.getExpenseAllocationsVO();
                          Row ExpAllRow[] = expvo.getAllRowsInRange();

                          for(int i=0; i<expvo.getRowCount(); i++)
                          {
                          ExpenseAllocationsVORowImpl allocrowimpl = (ExpenseAllocationsVORowImpl)ExpAllRow;
                          String x = (String)allocrowimpl.getAttribute('Attribute5");
                          }

                          Please confirm if this is the approach to be followed

                          Thanks
                          • 10. Re: Oracle iExpense Extension
                            532716
                            Hi ,

                            Can anyone please update this thread, as its bit urgent for us

                            Thanks for the support
                            • 11. Re: Oracle iExpense Extension
                              614478
                              Hi Sundeep

                              I have a similar requrirement.
                              Please, can you share with me your solution?

                              Best Regards

                              JD