Skip to Content
avatar image
Former Member

Calculate total Gross Value of all sales order Based on Customer !!

Dear all,

I want to calculate total gross value of all sales order of particular Customer.

Suppose i have created one sales order and i have selected one customer XYZ  and the gross value of this SO is 20000rs, again i have created a new sales order and this time i have selected same Customer XYZ and the Gross Value of this Sales Order is 30000rs.

now i want to calculate total gross value of both sales order of XYZ customer .

Means I want to calculate total gross value of sales order based on Particular Customer .

Please Help me.

Thanks & Regards,

Manoj Kannaujiya.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 08, 2015 at 01:15 PM

    Hello Manoj,

    When shall this calcualtion start? Triggering on Save of the SO?

    Where shall the value be persisted? Own Custom BO, extension field of SAP BO Customer, ...

    Bye,

       Horst

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 28, 2016 at 09:07 AM

    Hi Horst,

    Thanks for your help.

    I fixed that issue.

    Please find the following code.

    import ABSL;

    import AP.CRM.Global;

    import AP.Common.GDT;

    var NetAmount = 0;

    var NetCurrency ="";

    if(this.IsSet())

    {

           var salesOrderQry = CustomerQuote.QueryByElements;

           var salesOrderParams = salesOrderQry.CreateSelectionParams();

           salesOrderParams.Add(salesOrderQry.PartyBuyerPartyKey.PartyID.content,"I","EQ",this.InternalID);

           var salesOrderRes = salesOrderQry.Execute(salesOrderParams);

          

           if(salesOrderRes.Count() > 0 )

           {

                  foreach(var eachSalesOrder in salesOrderRes)

                  {

                         var totalValue = eachSalesOrder.TotalValues;

                         NetAmount = NetAmount + (totalValue.NetAmount.content);

                         NetCurrency = totalValue.NetAmount.currencyCode;

                  }

           }

           this.CurrentCommon.SalesVolume = NetAmount.ToString().TrimRight("0")+" "+ NetCurrency;

    }

    Thanks & Regards,

    SRINIVAS BORRA

    Add comment
    10|10000 characters needed characters exceeded