Total Amount Spend (ekbe-dmbtr) on Material & Vendor

Hi,
In My first ITAB, I have a list of Material & It's related Vendor
Like,
Material      Vendor
MM1             ABC
MM2            ABC
MM2           XYZ
MM3            MNO
In my next ITAB I need to find Total Amount Spend for this Material on It's Vendors.
(From - MIGO i.e. table EKBE )
I try to do this with following code -
IF it_comb IS NOT INITIAL.
    LOOP AT it_comb INTO wa_comb.
   SELECT a~matnr c~lifnr SUM( b~menge ) SUM( b~dmbtr )
        INTO CORRESPONDING FIELDS OF it_pssum
        FROM ekbe AS b INNER JOIN ekpo AS a ON a~ebeln = b~ebeln AND a~ebelp = b~ebelp
                                    INNER JOIN ekko AS c ON c~ebeln = a~ebeln
       WHERE a~matnr = wa_comb-matnr
        AND c~lifnr = wa_comb-lifnr
        AND b~bwart EQ '101'
        GROUP BY a~matnr c~lifnr.
      ENDSELECT.
     endloop.
     endif.
Here First ITAB is it_comb.
When I debugg - The Values are correct in IT_COMB and IT_PSSUM - matnr & lifnr but it's not fetching Values for  IT_PSSUM - menge & dmbtr.

Thank You All.
@Medha & NabheetMadan
Yes, I know it's not a good practice. But in PO table I have more than 10 Lac Records.
And If I take Loop Inside the Loop it's taking Lots of Time (going it Time Out ), Also if I use FOR ALL ENTRIES IN - Because I need to take all Records and it's Total on MATNR & LIFNR.
@ Vinod
I try it with
SELECT a~matnr c~lifnr SUM( b~menge ) AS menge SUM( b~dmbtr ) AS dmbtr
it's working. Thanks.
Yeah.. I know it's not in proper Index, but I need to do - Because I want to Work On EKBE values On Each Material & Vendor Combination.

Similar Messages

  • Budget for the vendor Vs actual amount spend on vendor

    Hi all,
    how to find the budget for the vendor and the actual amount spend on one vendor.
    What are the table names and where can we find this data.
    Thank you.

    Hi,
    What do you meand by 'budget for a vendor'? The tables for the items can be found in BSIK/BSAK tables (uncleared/cleared items).
    Regards,
    Eli

  • How can I indicate in a vendor a total amount invoice will be paid partiall

    Hello Friends,
    I'd appreciate very much you could indicate me how can I indicate in a vendor a total amount invoice will be paid partially in 12 months. I mean that for example, we have an invoice for 12000 Eur and the payment should be made 1200 Eur every month during a year.
    Thanks in advance for your help.
    Kind regards,

    Hi Shantanu,
    Installment Payment terms can be configured in OBB8 and OBB9 and that is the perfect solution to cater to this requirement.
    BUT
    What I understand from your question it looks like Prepaid Expenses scenario.. Also think of Recurring entry if you do not want to create a Vendor Invoice liability in one go..
    Regards,
    SAPFICO

  • Report to extract the total Amount that we spent for materials

    Hi Guru's,
    I was trying to find a report that gives all the following information by Company Code. Out put should have the following fields:
    1)Vendor Name,
    2) Vendor Number,
    3)Company Code,
    4) Payment Terms Code From Vendor Master,
    5) Payment Terms Description,
    6)Material Number,
    7)Material Description and
    8) Amount Spend for last 12 months
    I would appreciate any inputs on these kind of reports.
    Thanks
    Nath..........

    Sridhar,
    Thanks for your response but I am not getting Material number using report FBL1N and also I in the amount column I was looking for the total amount (total spent during the whole year) by Vendor, Company Code and Material. I am trying to execute this for three different company codes. So, will FBL1N work for us to get these total amounts.
    Thanks
    Nath

  • Need help to sum up total amount in at end of.....endat!!! Please help

    Hi,
    There is one program need to calculat the SUB-TOTAL AMOUNT FOR SAME DOCUMENT NUMBER.
    Means: Need to sumup betrg for the same belnr.
    QUESTION:
    How can I write the sorce cord In AT END OF...ENDAT.
    TO SUMUP THE AMOUNT FOR SAME DOCUMENT NUMBER.
    Please help!!
    Thanks.
    Here is the sourc code.
    DATA: BEGIN OF t OCCURS 0,
            bukrs   LIKE knb1-bukrs,
    *<<<<< CR01
            zuonr   Like bsid-zuonr,                        "sort key  "CR01
    *>>>>> CR01
            belnr   LIKE bsid-belnr,
            kunnr   LIKE kna1-kunnr,
            bldat   LIKE bsid-bldat,
            budat   LIKE bsid-budat,
            netdt   LIKE bsega-netdt,
            waers   LIKE bsid-waers,
            wrbtr   LIKE bsid-wrbtr,
            shkzg   LIKE bsid-shkzg,
            xblnr   LIKE bsid-xblnr,                            "WD041005a
            sgtxt   LIKE bsid-sgtxt,
            dmbtr   LIKE bsid-dmbtr,
          END OF t.
    Description of Interface-record RECON
    DATA: BEGIN OF s,
            belnr(10),                     " document number
    *<<<< CR01 STRAT ADD ZUONR
            zuonr(10),                     "sort key  " CR01
    *>>>> CR01 END ADD ZUONR
            filler1(1),
          KUNNR(5),                      " customer no."WD290705a
            kunnr LIKE kna1-kunnr,         " customer no."WD290705a
            filler2(1),
            bldat(10),                     " date
            filler3(1),
            budat(10),
            filler4(1),
            netdt(10),                     " due date for payment
            filler5(1),
            betrg(14),                     " amount
            filler6(1),
            waers(3),                      " currency
            filler7(1),                    " document field - blank
            compcode(4),                   " company-code         "fw070905
            filler8(1),                    " comment - blank
            sgtxt(50),                     " Text             "INS MG020207
            filler9(1),
            kmmnt(30),
            filler10(1),
            vbeln(12) ,
            filler11(1),
            xblnr(16),                     "WD041005a hier Referenznr rein
            filler12(1),
            lifn2(11),
            filler13(1),                   " remark - blank
            dmbtr(14),
            filler14(1),
            twaer(3),
          END OF s.
    DATA: BEGIN OF outtab OCCURS 1000,
                s LIKE s,
          END OF outtab.
    *<<<<< INS MG020207
    TYPES: BEGIN OF ty_outalv,
             belnr(10),                     " document number
    *<<<< CR01 START ADD ZUONR
             zuonr,                         " sort key  " CR01
    *>>>>CR01 END ADD AUONR
             kunnr LIKE kna1-kunnr,         " customer no."WD290705a
             bldat(10),                     " date
             budat(10),                     " posting date
             netdt(10),                     " due date for payment
             betrg(14),                     " amount
             waers(3),                      " currency
             compcode(4),                   " company-code         "fw070905
             sgtxt(30),                     " comment
             kmmnt(30),                     " comment
             vbeln(12),                     " delivery number
             xblnr(16),                     "WD041005a hier Referenznr rein
             lifn2(11),                     " customer number
             dmbtr(14),
             twaer(3),                     " currency company code
           END OF ty_outalv.
    DATA: gt_outalv TYPE STANDARD TABLE OF ty_outalv.
    DATA: gs_outalv TYPE ty_outalv.
    *>>>>> INS MG020207
    DATA: l_date TYPE sy-datum.
    DATA: g_date TYPE sy-datum.
    DATA: g_budat TYPE bsik-budat.
    *<<<< CR01 START   ADD DATA STATEMENT
    DATA: wk_belnr LIKE bsid-zuonr,
          wk_x_belnr LIKE bsid-zuonr,
          ZUONR LIKE BSID-ZUONR,
          WRBTR LIKE BSID-WRBTR,
          WK_ZUONR LIKE BSID-ZUONR,
          WK_WRBTR LIKE BSID-WRBTR.
    *>>>> CR01 END  ADD DATA STATEMENT
    DATA: l_it_bsik TYPE STANDARD TABLE OF bsik.               "INS MG050706
    DATA: l_wa_bsik TYPE bsik.                                 "INS MG050706
    TYPE-POOLS: slis.                                          "INS MG020207
    DATA:                                                      "INS MG020207
    gt_fieldcat TYPE slis_t_fieldcat_alv,                     "INS MG020207
    gs_layout   TYPE slis_layout_alv,                         "INS MG020207
    gs_fieldcat TYPE slis_fieldcat_alv.                       "INS MG020207
    END-OF-SELECTION.
      SORT t.
      LOOP AT t.
        AT NEW bukrs.
          CLEAR anz_dl.
          CLEAR htext-anzahl.
          CLEAR htext-datei.
          htext-text1 = ' records writen in file '.
          CLEAR p_pfad.
          CONCATENATE
              i_pfad
              'CU_CC'
              t-bukrs
              sy-datum+6(2)
              sy-datum+4(2)
              sy-datum(4)
              sy-uzeit
              '.txt'
         INTO p_pfad.
          CLEAR outtab.
          REFRESH outtab.
          REFRESH: gt_outalv.                                  "INS MG020207
        ENDAT.
       IF t-shkzg = 'H'.
         h_betrg  = t-wrbtr * -1.
       ELSE.
        h_betrg  = t-wrbtr.
        h_dmbtr  = t-dmbtr.
       ENDIF.
        s-filler1 = s-filler2 = s-filler3 = s-filler4 = s-filler5 = ';'.
        s-filler6 = s-filler7 = s-filler8 = ';'.
        s-filler9 = s-filler10 = s-filler11 = s-filler12 = s-filler13 = ';'.
        s-filler14 = ';'.
        s-belnr = t-belnr.
        IF t-xblnr NE space.                                    "WD041005a
          s-xblnr      = t-xblnr.                               "WD041005a
        ELSE.                                                   "WD041005a
          s-xblnr      = t-belnr.                               "WD041005a
        ENDIF.                                                  "WD041005a
        WHILE s-xblnr(1) EQ '0'.                            "INS MG130606
          SHIFT s-xblnr LEFT.                               "INS MG130606
        ENDWHILE.                                            "INS MG130606
        WRITE t-kunnr TO s-kunnr NO-ZERO.
        s-lifn2 = s-kunnr.
        shift s-lifn2 RIGHT.
        s-lifn2(1) = 'R'.
      S-KUNNR = T-KUNNR+5(5).
        s-bldat+2(1) = '/'.
        s-bldat+5(1) = '/'.
        s-bldat0(2) = t-bldat4(2).
        s-bldat3(2) = t-bldat6(2).
        s-bldat6(4) = t-bldat0(4).
        s-budat+2(1) = '/'.
        s-budat+5(1) = '/'.
        s-budat0(2) = t-budat4(2).
        s-budat3(2) = t-budat6(2).
        s-budat6(4) = t-budat0(4).
        s-netdt+2(1) = '/'.
        s-netdt+5(1) = '/'.
        s-netdt0(2) = t-netdt4(2).
        s-netdt3(2) = t-netdt6(2).
        s-netdt6(4) = t-netdt0(4).
        s-waers      = t-waers.
        s-dmbtr      = t-dmbtr.
        s-sgtxt      = t-sgtxt.
        CLEAR s-twaer.
        SELECT SINGLE waers INTO s-twaer
                            FROM t001
                            WHERE bukrs = t-bukrs.
        IF h_betrg < 0.
          hs_betrg+0(1) = '-'.
        ELSE.
          hs_betrg+0(1) = ' '.
        ENDIF.
        WRITE h_betrg CURRENCY t-waers TO hs_betrg+1 NO-GROUPING
                                                        NO-SIGN
                                                        LEFT-JUSTIFIED.
        REPLACE ',' WITH '.' INTO hs_betrg.
        WRITE hs_betrg TO s-betrg.
        IF h_dmbtr < 0.
          hs_betrg+0(1) = '-'.
        ELSE.
          hs_betrg+0(1) = ' '.
        ENDIF.
        WRITE h_dmbtr CURRENCY t-waers TO hs_betrg+1 NO-GROUPING
                                                        NO-SIGN
                                                        LEFT-JUSTIFIED.
        REPLACE ',' WITH '.' INTO hs_betrg.
        WRITE hs_betrg TO s-dmbtr.
        s-compcode   = t-bukrs.                                 "fw070905
        IF p_downl = 'X'.
          MOVE s TO outtab-s.
          APPEND outtab.
          ADD 1 TO anz_dl.
        ENDIF.
        gs_outalv-belnr = s-belnr.                             "INS MG020207
    *<<<< CR01 START ADD as_outalv-zuonr
        gs_outalv-zuonr = s-zuonr.                             "CR01
    *>>>> CR01 EDD   ADD as_outalv-zuonr
        gs_outalv-kunnr = s-kunnr.                             "INS MG020207
        gs_outalv-bldat = s-bldat.                             "INS MG020207
        gs_outalv-netdt = s-netdt.                             "INS MG020207
        gs_outalv-betrg = s-betrg.                             "INS MG020207
        gs_outalv-waers = s-waers.                             "INS MG020207
        gs_outalv-compcode = s-compcode.                       "INS MG020207
        gs_outalv-budat = s-budat.                             "INS MG020207
        gs_outalv-sgtxt = s-sgtxt.
        gs_outalv-kmmnt = s-kmmnt.
        gs_outalv-vbeln = s-vbeln.
        gs_outalv-xblnr = s-xblnr.
        gs_outalv-lifn2 = s-lifn2.
        gs_outalv-dmbtr = s-dmbtr.
        gs_outalv-twaer = s-twaer.
        APPEND gs_outalv TO gt_outalv.                         "INS MG020207
        AT END OF bukrs.
          WRITE anz_dl  TO htext-anzahl.
          WRITE p_pfad  TO htext-datei.
          CONDENSE htext.
          IF p_downl = 'X'.
            SKIP 2.
            WRITE: / htext.
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                filename                = p_pfad
                filetype                = 'ASC'
              TABLES
                data_tab                = outtab
              EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                no_authority            = 5
                unknown_error           = 6
                header_not_allowed      = 7
                separator_not_allowed   = 8
                filesize_not_allowed    = 9
                header_too_long         = 10
                dp_error_create         = 11
                dp_error_send           = 12
                dp_error_write          = 13
                unknown_dp_error        = 14
                access_denied           = 15
                dp_out_of_memory        = 16
                disk_full               = 17
                dp_timeout              = 18
                file_not_found          = 19
                dataprovider_exception  = 20
                control_flush_error     = 21
                OTHERS                  = 22.
            IF sy-subrc <> 0.
             write: / 'Error creating File:', P_Pfad, sy-subrc.
              MESSAGE e405 WITH text-002 p_pfad.
            ENDIF.
          ENDIF.
    *<<<<< INS MG020207
          IF p_alvd EQ 'X'.
            PERFORM build_layout_data.
            CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
              EXPORTING
                i_callback_program     = sy-repid
                i_structure_name       = 'GT_OUTALV'
                is_layout              = gs_layout
                it_fieldcat            = gt_fieldcat[]
                i_callback_top_of_page = 'TOP-OF-PAGE'
              TABLES
                t_outtab               = gt_outalv.
          ENDIF.
    *>>>>> INS MG020207
    ENDAT.
      ENDLOOP.

    HI
    Have alook at below program
    *& Report  ZINTERNALTABLE
    REPORT  zinternaltable.
    TYPES:BEGIN OF itab,
          num TYPE i,
          name(10) TYPE c,
          amt type i,
          END OF itab.
    DATA : wa_itab TYPE itab,
           it_itab TYPE STANDARD TABLE OF itab.
    DATA : v_lines TYPE i.
    wa_itab-num = 1.
    wa_itab-name = 'nag'.
    wa_itab-amt = 1000.
    append wa_itab TO it_itab.
    wa_itab-num = 1.
    wa_itab-name = 'nag'.
    wa_itab-amt = 2000.
    append wa_itab TO it_itab.
    wa_itab-num = 1.
    wa_itab-name = 'nag'.
    wa_itab-amt = 1500.
    append wa_itab TO it_itab.
    wa_itab-num = 2.
    wa_itab-name = 'sri'.
    wa_itab-amt = 500.
    append wa_itab tO it_itab.
    wa_itab-num = 2.
    wa_itab-name = 'sri'.
    wa_itab-amt = 600.
    append wa_itab TO it_itab.
    wa_itab-num = 2.
    wa_itab-name = 'sri'.
    wa_itab-amt = 700.
    append wa_itab TO it_itab.
    wa_itab-num = 3.
    wa_itab-name = 'ganesh'.
    wa_itab-amt = 1200.
    append wa_itab TO it_itab.
    wa_itab-num = 3.
    wa_itab-name = 'ganesh'.
    wa_itab-amt = 1300.
    append wa_itab TO it_itab.
    wa_itab-num = 3.
    wa_itab-name = 'ganesh'.
    wa_itab-amt = 1400.
    append wa_itab TO it_itab.
    wa_itab-num = 4.
    wa_itab-name = 'suresh'.
    wa_itab-amt = 900.
    append wa_itab TO it_itab.
    wa_itab-num = 4.
    wa_itab-name = 'suresh'.
    wa_itab-amt = 300.
    append wa_itab TO it_itab.
    sort it_itab.
    LOOP AT it_itab INTO wa_itab.
    at first.
    write :/ 'details of sales order:'.
    uline.
    endat.
    at new num.
    write :/ 'serial num:', wa_itab-num.
    uline.
    endat.
    WRITE :/ wa_itab-num , wa_itab-name , wa_itab-amt.
    at end of num.
    uline.
    sum.
    write :/ 'total amount:',wa_itab-amt.
    uline.
    endat.
    at last.
    sum.
    uline.
    write:/ 'grand total:',wa_itab-amt.
    endat.
    ENDLOOP.
    describe table it_itab lines  v_lines.
    WRITE:/'no of records :', v_lines.
    Regards
    Nagesh.Paruchuri

  • PO is getting released even if the total amount is less than the last PO am

    Purchase Order is getting released even if the total amount is less than the last PO amount. The release strategy is only working for the first Purchase Order and if the PO amount is greater than the last PO amount.
    Please let me know how to correct this scenario (release strategy).
    Regards,
    Prishu

    Hi,
    Release strategy has nothing do with the previous PO amount. May be, Co-incidently the amount in previous PO which you are referring and the characteristics value maintained in the release strategy is same.
    1) Please go in release strategy by the path mentioned below
    IMG u2013 Material Management u2013 Purchasing u2013 Purchase Requisition u2013 Release Procedure u2013 Procedure with Classification u2013 Set Up Procedure with Classification
    2) Then go to release strategy. Here the total available release strategies would be displayed. Double click the strategy which is getting reflected in the PO you want and go the classifiction tab. There you will get the PO value. Based on this characteristic value the respective release streategy gets refelected.
    I hope this clarifies.
    Regards
    sachin

  • Report that generates total amount for cost elements/department

    Dear Experts,
    I have been using report GR55 in which generates the total amounts via cost centers and cost elements groups however, it displays a detailed distribution of cost rather than by department, example below.
    Mining
        Labor 500
        Material 1000
    Development
        Labor 500
        Material 500
    While business requires a report that displays the total cost per department rather than the example above, the report should display the following example.
    Mining 1500
    Development 1000
    Is there a report in standard SAP that generates the example above?
    Appreciate your help
    Jan
    Edited by: UserID on Jul 20, 2011 4:48 AM

    HI,
    You will get the cost center wise report by using T code KSB1.
    Please check and confirm.
    Thanks and Regards
    Binoj M D

  • How to add pack charges in purchaseorder total amount befor BED Calculation

    Dear All,
             My supplier will also charge packing charges for  raw material
    It should be add with the total amount
    For Ex,
            Quantity = 10
            Unit Price = 1000
            Packing Charge = 300
            Total = (Quantity*Unit price)+Packing charge
             Total after packing = 10300
              Then i want to calculate the BED for the total after packing 10300 amount
    How can i add these packing charge with total amount
    Regrads,
    Vijay
    Edited by: Vijay Guru on Oct 14, 2008 7:32 AM

    Thank u Gordon but my P&F Amount is changable
    Following solution may suitable for this problem
    *What we do as a workaround is create a UDF called 'Packing & Forwarding Charges' in Rowlevel and Write a Formatted Search Query to Add this value of 'Packing & Forwarding Charges' with unitprice * Quantity and assign this to Assessble Value of an Item.*
    *Assessable Value = unitprice * Quantity + Packing & Forwarding Charges*
    Now calculate the BED, CEss, CEHH HE, VAT for this Assable value.
    But how can i create the formatted search for adding the value of pack& forward with assessable value
    Help me out
    Regads,
    Vijay

  • How does RV45A-ENDBK (Total Amount) React in pricing?

    Sample . Service Fee = 560 using a service material number
    It must react in Net as = 500
    Tax = 60
    The acounting entry will be
    Customer AR 560
    Tax Adjustment 60
    Equity 500
                  Service Income 500
                  Tax Payable 60
                  Customer AR 560
    The RV45A-ENDBK (Total Amount) always react as Zero). What should i do  if I need to show still 560 in the total amount header data? How does both Customer AR be in debit and credit.
    I can get Tax=60
    Tax Adjustment 60
    Equity 500
                  Service Income 500
                  Tax Payable 60
    Unable to show RV45A-ENDBK (Total Amount) = 560

    Revising the entry for debit and credit
    Customer AR 560
    Tax Adjustment 60
    Equity 500
    Service Income -500
    Tax Payable -60
    Customer AR -560

  • My total amount of DOWNLOADED APPS. do NOT show up on iPhone HOME pages.

    My total amount of DOWNLOADED APPS. do NOT show up on iPhone HOME pages.
    I have the BIG DOG 16 gig iPhone and I am only limitted to 9 pages of APPS.
    For what I PAID for this GREAT Phone, there should be NO LIMIT as to how many APPS. that I can download until and UNLESS my memory is FULL, which it is NOT even half full yet.
    APPLE: Please change this LIMITATION, because there seems to be thousands of APPS. to choose from. Just as you have NO-LIMIT on the number of songs that I can download, I would like it to be the SAME for my APPS.
    Thank you.

    This ***** badly
    http://discussions.apple.com/thread.jspa?threadID=1807300&tstart=0

  • Po list showing the total amount with advances given & open GR quantity

    Hi Gurus,
    My client need to know the list of total p/os showing its gross total amount only (& not with the line items) with the advances rendered to them & its open GR quantity against total qunatity mentioned.
    I hv tried in ME80FN, ME2N, ME2L ME2M..etc and all other reports but the system is showing the same with the line items. Kindly advise.
    Regds
    Prashant Bijutkar

    Prashant,
    All three informations will not be available in one report(gross total amount  not with the line items and the advances rendered to them & its open GR quantity against total qunatity mentioned).
    You have to dovelop this report. please take help from technical consultant.
    One more thing the open GR quantity will always at PO line item level not at header level.
    Regards,
    Manish

  • Purchase Order Total Amount at Header level and Report Execution

    Dear Experts,
    Here by i am facing problem with Purchase Order Total amount.
    I have local Pricing Procedure for price stipulations (like discounts, Freight, packaging). the calculation at item level is correct. tax calculation is done by tax code. The total PO Price is including all items in PO and tax amount. But at header level conditions net value is showing only gross price.
    How to pick up total price including tax amount at header level conditions?
    Please provide me solution on it ?

    Dear Experts,
    Here by i am facing problem with Purchase Order Total amount.
    I have local Pricing Procedure for price stipulations (like discounts, Freight, packaging). the calculation at item level is correct. tax calculation is done by tax code. The total PO Price is including all items in PO and tax amount. But at header level conditions net value is showing only gross price.
    How to pick up total price including tax amount at header level conditions?
    Please provide me solution on it ?
    Edited by: Kiran Mujumdar on Feb 23, 2009 7:08 PM

  • The page total amount is not correct on discoverer plus 10.1.1.48.18

    on my discoverer report, there is sunnary field based on a column.
    for example, I have a salesrep expense discoverer report.
    the salesrep name is the page item, each page has one salesrep, under the page item there are many line which show the expense detail amount, there is a column called expense, under the expense column there is a total amount summary field to sum the expense for this salesrep.
    Sometimes, the total amount is not the sum of the expense column, sometimes the total amount show negative zero as: -0.00. What I thought this maybe a number round issue.
    Does anybody has similar issue? how to fix this ?
    Thanks

    I actually used toad to run the query and exported to EXCEL then sum it in excel, I got the correct total amount.
    the following is the SQL query, we use the total feature to sum the commission:
    select
    pt.payee_salesrep_id,
    sr.name||','||sr.attribute9 salesrep_name,
    sr.attribute15 employee_number,
    pt.payrun_id,
    pr.name payrun_name,
    decode(pt.incentive_type_code,'COMMISSION',2,'PMTPLN',4,'PMTPLN_REC',1,'MANUAL_PAY_ADJ',2) Sort,
    decode(pt.incentive_type_code, 'PMTPLN','To be Applied in Future','PMTPLN_REC','Previous Payments Affecting Commissions',q.description) Variable,
    sum(decode(pt.incentive_type_code,
    'COMMISSION',decode(q.attribute3,'ARR 12-36',apps.sg_oic_reports.get_multiple(q.name,to_number(ch.attribute16)),1) sign(pt.payment_amount) abs(pt.input_achieved) ,
    pt.payment_amount)
    ) Revenue,
    sum(pt.payment_amount) commission
    from apps.cn_payment_transactions pt,
    apps.cn_commission_headers ch,
    apps.jtf_rs_salesreps sr,
    apps.cn_quotas q,
    apps.cn_payruns pr
    WHERE pt.quota_id = q.quota_id
    and ch.commission_header_id(+) = pt.commission_header_id
    and pt.payee_salesrep_id = sr.salesrep_id
    and pt.payrun_id = pr.payrun_id
    and hold_flag <> 'Y'
    and pr.accounting_period_id>2005012
    and pt.payment_amount<>0
    group by
    pt.payee_salesrep_id,
    sr.name||','||sr.attribute9,
    sr.attribute15,
    pt.payrun_id,
    pr.name,
    pt.incentive_type_code,
    decode(pt.incentive_type_code,'COMMISSION',2,'PMTPLN',4,'PMTPLN_REC',1,'MANUAL_PAY_ADJ',2) ,
    decode(pt.incentive_type_code, 'PMTPLN','To be Applied in Future','PMTPLN_REC','Previous Payments Affecting Commissions',q.description)
    having sum(pt.payment_amount) <>0

  • How to print total amount in last page of purchase orde using xml publisher

    Hi
    I customizing purchase order report using xml publisher.
    i have to print total amount at last every purchse order.
    how to compare carry forward amount in xml publisher

    I think the guys overhere :
    BI Publisher
    can help you a lot better

  • Ssrs 2008 r2 display only final total amount

    In an existing ssrs 2008 r2 report, I want the final grand total to appear as the last amount displayed in the SSRS report.
    In the 'main' matrix of the report, I have created an outside group row below the last line of the matrix.
    The expresion for this statement looks the the following:
    ="Grand Total: $"+str(sum(cdec(Fields!TransactionAmount.Value),"datasetname")).
    The total amount is correct, but this total amount line appears after every control break. Basically the amount appears every
    time the control break changes by date, teacher, or student number.
    The extra row I added does contain grouping references to date, teacher, and student number. Thus to solve my problem:
    1. Can you tell me how to remove the grouping references to date, teacher, and student number so that the last row will be the only place the total amount will be displayed?
    2. If the above is not an option, can you tell me how to add an extra row to the 'main' matrix so the report groupings do not appear on the final total line?
    3. If the above 2 choices are not an option, would you tell me how to add the final total line in the final report footer and/or any place you believe the final total amount will appear only one time?

    Hi Wendy,
    According to your description, you want to add a row into your matrix to get the total value of TransactionAmount. This can be final total value which appears only one time in your matrix. Right?
    In this scenario, the reason why the total amount line appears after each break change (data, teacher..) because this total amount line is still within the parent group. I guess you didn't add the outside group row on the top parent group. So we just need
    to right click on the textbox which is top parent group, insert a row outside of group. Then put your expression into the added row. Now the total amount will appear only one time in the matrix. It looks like below:
    Reference:
    Understanding Groups (Report Builder and SSRS)
    If you have any feedback on our support, please click
    here.
    Best Regards,
    Simon Hou 

Maybe you are looking for