Finding Sum of grouped lines / Tables EKKO, EKPO

Hi, am using the following tables:
TABLES: ekko,ekpo.
with Inner Join
select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam ekpobrtwr
   into CORRESPONDING FIELDS OF TABLE itab from ekko
    inner join EKPO on ekPOEBELN = ekkoebeln.
end-OF-SELECTION.
Basically i want to group the result of this SQL statement by Purchasing Doc (ekko~ebeln) and display the
sum of Gross value (ekpo~brtwr) for the line items of  each Purchasing Doc.
Note: i want the Purchasing Doc to appear one time only in the report
i have tried the following :
select  ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam sum(  ekpobrtwr )
   into  CORRESPONDING FIELDS OF TABLE itab from ekko
   inner join EKPO on ekPOEBELN = ekkoebeln
WHERE ekkobukrs IN S_bukrs AND ekkobsart IN s_bsart
Group By  ekkoebeln ekkobukrs ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekko~ernam.
then loop through the ITAB:
LOOP at itab.
write:/ itab-bukrs under 'Company Code',
         itab-ebeln UNDER 'PO-Number',
         itab-aedat UNDER 'Date' ,
         itab-bsart UNDER 'Doc-Type'  ,
         itab-ekgrp UNDER 'Purchase-Grp' ,
         itab-lifnr UNDER 'Vendor' ,
         itab-waers UNDER 'Currency',
         itab-wkurs UNDER 'Rate' ,
         itab-brtwr under 'Gross Value',
         itab-ernam UNDER 'Created By'.
ENDLOOP.
but it is not working with me, am not able to show the result of sum(  ekpo~brtwr ) am getting 0 in all lines
thanks a lot for your help

" My Full Code.
TABLES: ekko,ekpo,ekbe,rbkp.
data: BEGIN OF itab OCCURS 0,     "EKKO TABLE"
      inco1 like ekko-inco1,
      inco2 like ekko-inco2,
      bukrs like ekko-bukrs,
      ebeln like ekko-ebeln,
      aedat like ekko-aedat,
      bsart like ekko-bsart,
      ekgrp like ekko-ekgrp,
      lifnr like ekko-lifnr,
      waers like ekko-waers,
      wkurs like ekko-wkurs,
      ernam like ekko-ernam,
      BRTWR LIKE ekpo-brtwr,
  end of itab.
SELECT-OPTIONS : s_bukrs FOR itab-bukrs OBLIGATORY,
                 s_ebeln for itab-ebeln ,
                 s_aedat FOR itab-aedat ,
                 s_bsart for itab-bsart ,
                 s_ekgrp FOR itab-ekgrp ,
                 s_lifnr FOR itab-lifnr ,
                 s_budat FOR jtab-budat ,
                 s_bewtp for jtab-bewtp .
DATA ProceesITAB LIKE SORTED TABLE OF ITAB WITH UNIQUE KEY TABLE LINE.
AT SELECTION-SCREEN on s_bukrs.
START-OF-SELECTION.
select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam ekpobrtwr
   into CORRESPONDING FIELDS OF TABLE itab from ekko
    inner join EKPO on ekPOEBELN = ekkoebeln.
  end-OF-SELECTION.
LOOP at itab.
write:/ itab-bukrs under 'Company Code',
         itab-ebeln UNDER 'PO-Number',
         itab-aedat UNDER 'Date' ,
         itab-bsart UNDER 'Doc-Type'  ,
         itab-ekgrp UNDER 'Purchase-Grp' ,
         itab-lifnr UNDER 'Vendor' ,
         itab-waers UNDER 'Currency',
         itab-wkurs UNDER 'Rate' ,
         itab-brtwr under 'Gross Value',
         itab-ernam UNDER 'Created By'.
ENDLOOP.
TOP-OF-PAGE.
write:/70 'Company'.
uline.
skip.
write:/5 'Company Code',25 'PO-Number',40 'Date',55 'Doc-Type',70 'Purchase-Grp',85 'Vendor',100 'Currency',115 'Rate',125 'Created By',
140 'Gross Value'.
ULINE.
SKIP.
Edited by: YasinN on Mar 24, 2010 9:45 AM

Similar Messages

  • Link of table EKKO,EKPO,EKET,KONV

    Hi Experts,
    Now , i am writing a program to print purhchase order, and i met 2 problems.
    1.why it is different price between 'net price' and 'condition price'? sometimes, they are different.
    2.the net price always is wrong. so i need to get the price in condition tab in item detail.
    i sent a OSS to SAP, they told me the talbe KONV is a cluster table, so it can not be join in .
    but i need get the exact and correct price from KONV,
    would somebody please give me the link of table EKKO,EKPO,EKET and KONV?
    our system is AFS SAP. we use me23n to display the purchase order.and there is a request we must group the item by MATNR  with the same price and ex factory date (j_3aexfcp).
    thanks

    thanks first,
    yes , i fetch the data from EKKO,EKPO,EKET first, and alreayd group by them as our user request,but the problem is i can not get the item number (kposn) exactly,  the following are the code. i do not add the item number in it, it will make the wrong result .
    after group them, some different items were grouped,so i do not know how to fetch the item number exactly.
    SELECT DISTINCT EKKOEBELN EKKOBEDAT EKKOLIFNR EKKOZTERM EKKOWAERS EKKOVERKF EKKOTELF1 EKKOINCO1 EKKOINCO2 EKPOMATNR EKPOTXZ01 EKPOJ_3APGNR
    EKPOJ_3AVDAT EKPOj_3aexfcp EKPOBPRME EKPOPEINH EKETEINDT Sum( EKETMENGE ) AS SumOfMENGE EKETMEINS EKETJ_3ASIZE EKPOLOEKZ ekkoknumv
    Avg( EKETJ_3ANETP ) AS AvgOfJ_3ANETP Avg( ekponetpr ) as Avgofnetpr Sum( EKETJ_3ANETW ) AS SumOfJ_3ANETW J_3APGENJ_3AKORD1 J_3APGENJ_3AKORD2 J_3APGENJ_3AKORD3 J_3APGEN~J_3AKORDX
    INTO (EKKO_EBELN,EKKO_BEDAT,EKKO_LIFNR,EKKO_ZTERM,EKKO_WAERS,EKKO_VERKF,EKKO_TELF1,EKKO_INCO1,EKKO_INCO2,EKPO_MATNR,EKPO_TXZ01,EKPO_J_3APGNR,
          EKPO_J_3AVDAT, EKPO_j_3aexfcp, EKPO_BPRME,EKPO_PEINH,EKET_EINDT,SUMOFMENGE,EKET_MEINS,EKET_J_3ASIZE,EKPO_LOEKZ,ekko_knumv,
          AVGOFJ_3ANETP,AVGOFNETPR,SUMOFJ_3ANETW,J_3APGEN_J_3AKORD1,J_3APGEN_J_3AKORD2,J_3APGEN_J_3AKORD3,J_3APGEN_J_3AKORDX)
    FROM
    ( ( EKKO INNER JOIN EKPO ON ( EKKOEBELN = EKPOEBELN ) AND ( EKKOMANDT = EKPOMANDT ) ) INNER JOIN EKET ON ( EKPOEBELP = EKETEBELP ) AND ( EKPOEBELN = EKETEBELN ) AND ( EKPOMANDT = EKETMANDT ) ) INNER JOIN J_3APGEN ON ( EKET~J_3ASIZE =
    J_3APGENJ_3AKORDX ) AND ( EKPOMANDT = J_3APGENMANDT ) AND ( EKPOJ_3AVDAT = J_3APGENJ_3AVDAT ) AND ( EKPOJ_3APGNR = J_3APGEN~J_3APGNR )
    GROUP BY
    EKKOEBELN EKKOBEDAT EKKOLIFNR EKKOZTERM EKKOWAERS EKKOVERKF EKKOTELF1 EKKOINCO1 EKKOINCO2 EKPOMATNR EKPOTXZ01 EKPOJ_3APGNR EKPOJ_3AVDAT EKPOj_3aexfcp EKPOBPRME EKPOPEINH EKETEINDT EKETMEINS EKETJ_3ASIZE EKKOMANDT
    J_3APGENJ_3AKORD1 J_3APGENJ_3AKORD2 J_3APGENJ_3AKORD3 J_3APGENJ_3AKORDX EKPOLOEKZ ekkoknumv
    HAVING
    EKKOEBELN = ZEBELN AND EKPOMATNR = IT_EKPO1-MATNR AND EKPOj_3aexfcp = it_ekpo1-j_3aexfcp AND EKPOLOEKZ <> 'L'
    ORDER BY EKET~J_3ASIZE.
    after fetch the date , i select the KBETR from KONV, the item number is the last important problem.
    select single kbetr into kbetr from konv where knumv = ekko_knumv and krech = 'C' and kposn = ?(i can not fetch exact item number) and ZAEHK = eket-etenr .
    any further reply? thanks very much for your reply.

  • How to link tables EKKO, EKPO, EIKP and EIPO

    What I'm trying to do is create a view based on these four tables. EKPO contains multiple rows with the same values for EBELN. EKKO contains all distinct values for EBELN. I am trying to pick up all rows from both tables where EBELN in EKPO is the same as in EKKO. This is simple enough for a select statement to handle, without creating a view. The tricky part is linking the relevant rows selected from EKKO and EKPO to EIKP and EIPO. I tried using EXNUM to link EKKO, EIKP and EIPO, but I'm not sure that EXNUM contains distinct values for all 3 tables. In the case of EIKP it doesn't matter because the values for the fields I want (VORNU and VORNA) will be the same for the rows selected from EKKO and EKPO. The problem is with linking EIPO to my selections. If I knew that EXNUM was distinct for all rows in EIPO there would be no problem. However, I have seen some cases where multiple rows in EIPO have the same values for EXNUM. If I am using EXNUM in EIPO as a key field I have no way of being sure that the fields I want to pick up from EIPO (NACNU, BEHOE, NACD2, PRUEL and NACN3) contain the correct values I require. An example of what I am trying to do might make this clearer:
    Table EKKO:
    EBELN     BEDAT      WAERS
    420000001 10.08.2007 USD
    Table EKPO:
    EBELN     WERKS MATNR MENGE NETWR NETPR TXZ01
    420000001   3500  m1    q1    nw1   cnf1  mat1
    420000001   3500  m2    q2    nw2   cnf2  mat2
    420000001   3000  m3    q3    nw3   cnf3  mat3
    Table EIKP:
    VORNU  VORDA
    125/45 12.08.2007
    Table EIPO: (Corresponding to the above three rows in EKPO)
    NACNU BEHOE NACD2      PRUEL      NACN3
    1234  1001  30.08.2007 28.08.2007 xx
    1235  1002  27.08.2007 29.08.2007 yy
    1236  1003  18.08.2007 16.08.2007 zz
    So basically, given the above table entries, I want that the result of my selection should be:
                   | ROW1        | ROW2       | ROW3
    EBELN:   |  420000001   |  420000001  | 420000001
    BEDAT:   |  10.08.2007   |  10.08.2007  | 10.08.2007
    WAERS: |  USD             |  USD           | USD
    WERKS: |  3500             |  3500           | 3000
    MATNR:  |  m1               |  m2              | m3
    MENGE: |  q1                |  q2               | q3
    NETWR: |  nw1              |  nw2             | nw3      
    NETPR:  |  cnf1              |  cnf2            | cnf3
    TXZ01:    |  mat1             |  mat2           | mat3
    VORNU: |  125/45           |  125/45        | 125/45
    VORDA: |  12.08.2007     |  12.08.2007   | 12.08.2007
    NACNU: |  1234              |  1235            | 1236
    BEHOE: |  1001              |  1002            | 1003
    NACD2:  |  30.08.2007     |  27.08.2007   | 18.08.2007
    PRUEL:  |  28.08.2007   | 29.08.2007   | 16.08.2007
    NACN3:  |  xx               | yy                | zz
    Sorry for the extremely long post. If anyone can shed some light on this I'd really appreciate it. Thanks.
    Kal

    select req. fields + a~exnum
    from ekko as a
    inner join ekpo as b
    on aebeln = bebeln
    into table gt_ekko_ekpo
    where.........if u any conditions...
    select req.fields from
    eikp
    into table gt_eikp
    for all entries in gt_ekko_ekpo
    where exnum = gt_ekko_ekpo-exnum.
    select req.fields
    from eipo
    into table gt_eipo
    for all entries in gt_eikp
    where exnum = gt_eikp-exnum.
    and also ekpo and eipo are line items tables , so for each exnum, will have multiple lines items in eipo table.
    imp. the above and check whether, getting the req. result or not.
    next in view , maintain rel. among these 4 tables.
    ekko -ekpo, ekko-eikp, eikp-eiko.

  • Tables EKKO EKPO and KONP

    Hi,
        I want to link tables EKKO, EKPO and KONP. Actually i checked this tables  but i could not find link between EKKO and KNOP. Please help me in this regards. Actually we are maintaining the tax codes in the PO. I want to print different taxes in PO out put like BED, EDUCATION CESS, CST, VAT.
    NK

    Hello,
    You can link the tables by
    EKKO- KNUMV = KONP-KNUMH.
    And
    EKKO-EBELN = EKPO-EBELN.
    Hope it helps.
    Regards,
    Mansi.

  • How to write SELECT statement using tables ekko,ekpo and eket?

    Hi,
    I got a problem in  performance tuning using below tables?
    how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause)  use only fields 
                        ekko~ebeln       IN ebeln
                       ekko~loekz       EQ ' '
                       ekko~lifnr       IN lifnr
                       ekko~ekorg       IN ekorg
                      ekko~ekgrp       IN ekgrp          
                       ekpo~werks       IN werks
                       ekpo~pstyp       EQ  '3'
                       ekpo~loekz       EQ  space
                       ekpo~elikz       EQ  space
                       ekpo~menge       NE  0
                     eket~rsnum       NE space.
    Thanks in Advance.
    bye.

    Hi,
    ekko~ebeln IN ebeln
    ekko~loekz EQ ' '
    ekko~lifnr IN lifnr
    ekko~ekorg IN ekorg
    ekko~ekgrp IN ekgrp
    ekpo~werks IN werks
    ekpo~pstyp EQ '3'
    ekpo~loekz EQ space
    ekpo~elikz EQ space
    ekpo~menge NE 0          " Remove this from where clause
    eket~rsnum NE space.    " Remove this from where clause
    ' instead delete the entries after fetching into the table
    DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
    Regards
    Bala Krishna

  • Datasource for the table EKKO,EKPO, EKBE, BKPF, BSEG

    Hello Gurus,
    I am having a requirement wher i need to create report for the fields coming from the above tables.
    pls let me know if der is any such data source from which i can get data for all the tables EKKO,EKPO,EKBE,BKPF,BSEG.
    If der is no single data source then how i have to approach for the same using the standard datasource.
    and what should be the link info objects between them if iam going with the separate one.
    Regards

    Thanks for ur responses,
    Is the Belnr in the EKBE table is same as the BELNR in BKPF table of Data source (0FI_GL_4)  ???
    When i cross verifed i found multible record in BKPF w.r.t EKBE belnr.
    Whats the reason for this ? If i created a infoset by mapping the BELNR AND GJAHR of EKBE and BKPF. Do i get the correct record or i have to handle it by some exception.
    Also pls let me know how the MM and FI flow related , I means once the MIRO ie billing document is created what happen in the FI side ??
    pls update with ur suggestions.
    regards

  • Query to find sum and detail lines

    <br>
    Hi
        I have these tables po_requisition_headers poh and
    po_requisition_lines_all pol
    poh table
    header_id          req_num
    2342                  13222
    4562                  13245
    7867                  13678
    po lines table
    line_id header_id     line_num line_amount
    12334  2342            1          40,000
    12335  2342            2          61,000
    12346  4562            1          100,000
    12367  7867            1          50,000
    how do i get this output
    i want all the total line amount for a po more than or equal 100,000 and also want to see the lines records.
    like this
    13222          2342            1          40,000
    13222          2342            2          61,000
    13245          2343            1          100,000

    select equistion_num,
           requisition_header_id,
           distribution_id,
           supplier,
           CATEGORY,
           req_total,
           need_by_date,
           requestor,
           item_description,
           project_num,
           task_number,
           segment1,
           segment2,
           currency_code,
           req_total_conv,
           email_address
    -- your query (nearly) ***************************************************************************
      from (select reqdet.*,
                   pec.email_address,
             -- added next row: check sum's argument & partition by clause and modify accordingly
    SUM(req_total /* req_total_conv */) over (partition by requisition_header_id) group_sum
              from (SELECT  r.segment1 requistion_num,
                            l.requisition_header_id,
                            d.distribution_id,
                            TO_CHAR (l.line_num) line_num, v.vendor_name supplier,
                            p.concatenated_segments CATEGORY,
                            TO_CHAR (ROUND ((NVL (l.quantity, 0) * NVL (l.unit_price, 0))),'99,999,999,999.99') req_total,
                            TO_CHAR (l.need_by_date, 'MM/DD/YYYY') need_by_date,
                            pe.full_name requestor,
                            l.item_description,
                            pr.segment1 project_num,
                            t.task_number,
                            c.segment1,
                            c.segment2,
                         -- l.currency_code,
                         nvl(l.currency_code,gl.currency_code) currency_code,
                         ROUND ((NVL(gdr.conversion_rate, 1) * (NVL(l.quantity, 0) * NVL(l.unit_price,0))),fc.PRECISION) req_total_conv
                       FROM po_requisition_headers_all r,
                            po_requisition_lines_all l,
                            (SELECT project_id,
                                    task_id,
                                    code_combination_id,
                                    distribution_id,
                                    requisition_line_id,
                                    creation_date
                               FROM (SELECT project_id,
                                            task_id,
                                            code_combination_id,
                                            distribution_id,
                                            creation_date,
                                            requisition_line_id,
                                            ROW_NUMBER () OVER (PARTITION BY requisition_line_id ORDER BY requisition_line_id,distribution_id) rn
                                       FROM po_req_distributions_all pod
                              WHERE rn = 1
                            ) d,
                            gl_code_combinations c,
                         hr_operating_units o,
                         gl_sets_of_books gl,
                            por_category_lov_v p,
                            per_people_v7 pe,
                            pa_projects_all pr,
                            pa_tasks_all_v t,
                            ap_vendors_v v,
                         gl_daily_rates gdr,
                            fnd_currencies fc
                      WHERE d.creation_date >= NVL(TO_DATE ('11-APR-2008','DD-MON-YYYY HH24:MI:SS'),SYSDATE - 1)
                        AND l.requisition_header_id = r.requisition_header_id
                        AND l.requisition_line_id = d.requisition_line_id
                        AND d.code_combination_id = c.code_combination_id
                        AND r.apps_source_code = 'POR'
                        AND l.org_id = 141
                     -- and r.requisition_header_id in (352668,353113)
                        AND r.segment1='146309'
                        AND l.category_id = p.category_id
                        AND r.authorization_status IN ('IN PROCESS','PRE-APPROVED','APPROVED')
                        AND l.to_person_id = pe.person_id
                        AND pr.project_id(+) = d.project_id
                        AND t.project_id(+) = d.project_id
                        AND t.task_id(+) = d.task_id
                        AND v.vendor_id(+) = l.vendor_id
                        and     gl.set_of_books_id = o.set_of_books_id
                        and o.organization_id = l.org_id
                        and fc.currency_code = nvl(l.currency_code,gl.currency_code)
                        AND l.currency_code = gdr.from_currency(+)
                        AND TRUNC (SYSDATE) = TRUNC (gdr.conversion_date(+))
                        AND gdr.to_currency(+) = 'USD'
                        AND gdr.conversion_type(+) = 'Corporate'
                        AND l.requisition_header_id
                      GROUP BY r.segment1 ,
                               l.requisition_header_id,
                               d.distribution_id,
                               TO_CHAR(l.line_num),
                            v.vendor_name,
                               p.concatenated_segments,
                               TO_CHAR(ROUND((NVL(l.quantity, 0) * NVL (l.unit_price, 0))),'99,999,999,999.99'),
                               TO_CHAR (l.need_by_date,'MM/DD/YYYY'),
                               pe.full_name,
                            l.item_description,
                            pr.segment1,
                               t.task_number,
                               c.segment1,
                               c.segment2,
                            l.currency_code,
                            nvl(l.currency_code,gl.currency_code),
                            ROUND((NVL(gdr.conversion_rate,1) * (NVL(l.quantity,0) * NVL(l.unit_price, 0))),fc.PRECISION)
                    -- leave this out - doesn't help
    -- HAVING SUM(ROUND((NVL(gdr.conversion_rate, 1) * (NVL(l.quantity,0) * NVL(l.unit_price,0))),fc.PRECISION)) >= 100000
                   ) reqdet,
                   per_people_v7 pec
             where bio_po_ame_util.get_commodity_manager_id(reqdet.distribution_id) = pec.person_id
    -- *************************************************************************** yreuq ruoy
    where group_sum >= 100000

  • Extractor for Purchasing Conditions for tables EKKO, EKPO and KONV

    Hi Experts,
    I want to know if there is an Extractor for Purchasing Conditions with fields in tables of Origin: EKKO, EKPO and KONV.
    Or, at least an extractor with the table KONV.
    Or, how I can look for it.
    Any feedback, will be really apreciated.
    Thanks in advance

    Hi David,
    Adding to what said above.
    Observe the Fileds in the Datasources and the details.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5c/8ea0e626e442efb109232830faded9/frameset.htm
    Regards,
    Ram.

  • Query on tables EKKO, EKPO, EKET, EKES

    Hi experts,
    I have given below flow
    select * from EKKO into table GT_EKKO
                  where ANGNR = GS_INPUT-PURCHASE_ORDER.
    select * from EKPO into table GT_EKPO
        for all entries in GT_EKKO
        where EBELN = GT_EKKO-EBELN and
              LOEKZ = space.
    SORT GT_EKPO BY EBELN EBELP.
    DELETE ADJACENT DUPLICATES FROM GT_EKPO COMPARING ALL FIELDS.
    select * from EKES into table GT_EKES
    for all entries in GT_EKPO
            where EBELN = GT_EKPO-EBELN and
                  EBELP = GT_EKPO-EBELP and
                  EBTYP = 'E1'.
    SORT GT_EKES BY J_3ASIZE.
    select * from EKET into table GT_EKET
    for all entries in GT_EKES
            where EBELN = GT_EKES-EBELN and
                  EBELP = GT_EKES-EBELP and
                  J_3ASIZE = GT_EKES-J_3ASIZE.
    SORT GT_EKET BY J_3ASIZE.
    loop at GT_EKES.
    clear LV_QUANTITY.
    READ TABLE GT_EKES WITH KEY EBELN = GT_EKES-EBELN
                                 EBELP = GT_EKES-EBELP
                                 J_3ASIZE = GT_EKES-J_3ASIZE.
    READ TABLE GT_EKET WITH KEY EBELN = GT_EKES-EBELN
                                 EBELP = GT_EKES-EBELP
                                 J_3ASIZE = GT_EKES-J_3ASIZE.
      LV_QUANTITY = GT_EKET-MENGE - GT_EKES-MENGE.
      LV_TOTAL_QTY = LV_TOTAL_QTY + LV_QUANTITY.
    endloop.
    if GS_INPUT-E1_QTY = LV_TOTAL_QTY.
    if this condition satify then I have to assign LV_QUANTITY to some other table.
    But my problem is into EKET & EKES, I am not getting same no. of recoreds...
    can any one suggest me which WHERE conditions I have to give into queries on table EKET & EKES so I can get same no. of recoreds in both of them?
    Points will be rewarded...
    Thanks in advance.
    neo S.

    HI,
       its not necessary to have equal number of entries in two table.. a scheduleing agreement  and vendor confirmation is different.
    One suggestion.. when you are using for all entries ensure that you have to check that that table is not empty example .
    if not gt_ekpo[] is initial.
    select * from EKES into table GT_EKES
    for all entries in GT_EKPO
    where EBELN = GT_EKPO-EBELN and
    EBELP = GT_EKPO-EBELP and
    EBTYP = 'E1'.
    endif.
    thanks
    Mahesh

  • To find sum in an internal table - Bit urgent

    Hi SAP experts,
    I have an internal table with the following fields and data :
    Emp_number    Section    Days   
       1                      A           10
       1                      B           20
       3                      A           20
       3                      B           10
       2                      A           20
       2                      B           10
    Now I want to calculate the total days for each employee which is a sum of days of section A and days of section B.
    I want the data as below  into another internal table
    Emp_number    Total_days
        1                      30
        2                      30
        3                      30
    Could any one tell the code for the same.
    Useful answers wud be rewarded.
    Vishnu.

    Hi Vishwanath,
    In this case you have to use CONTROL BREAK STATEMENTS.
    1.At first
    2.At new
    3.At end
    4.At last
    1.At first is going to trigger at the 1st loop of the internal table.From the 2nd loop it is not going to trigger.
    It is mainly used for sub headings.
    2.At new is going to trigger at the new value of the internal table.
    3. At end is going to trigger at the end of the new value of a particular field.
    It is mainly use for subtotals.
    4.At last is going to trigger at the last loop of the internal table.
    It is mainly use for grand totals.
    So you gothrough the above 4 statements.
    In your case you have to use the third statement i.e., At end.
    At end
    ur logic
    endat.

  • Find Sum of grouped events by date

    I'm using Report Builder 10.50.2500.0
    I've been trying to do this for awhile and have run out of ideas to try.  I think it's a simple solution but I can't figure it out.
    I have a database that is used for events. A booking can have several different events associated with it, even on the same day at different times.  The events can be classified as breakfast, lunch or dinner events.
    The report is grouped by type of event, then by event date (not datetime, the overall date), then grouped by booking.
    Basically, I need the sum the total attendance of each breakfast, lunch, and dinner event by date and by booking.
    For breakfast events I have this code on the Event Classification group row:
    =iif(Fields!EventClassification.Value = "Breakfast",SUM(Fields!CurrentAttendance.Value),0) and the same for lunch and dinner. This works except when when there is more than one event per day.
    For example, on 6/11/13 there is one lunch event and one dinner event.  The report shows
    Date
    EventName
    Breakfast
    Lunch
    Dinner
    6/11/13
    EventName
    0
    50
    0
    6/11/13
    EventName
    0
    0
    50
    When what I want is:
    Date
    EventName
    Breakfast
    Lunch
    Dinner
    6/11/13
    EventName
    0
    50
    50
    Any ideas?  I've tried using group variables and passing to a report variable and acting on that but that didn't work out properly.

    Hi Jmelinda,
    In order to achieve your requirement, we can refer to the following steps:
    In the Row Groups pane, right-click the Details group to add a parent group grouped by Date field.
    Right-click the Date group to add a parent group grouped by Date field.
    Right-click the Date group to add a total row after the group.
    Delete the second and third columns with “Delete columns only” option for Date field.
    Type the expression below to the total row for Breakfast column, and the same for lunch and dinner:
    =sum(iif(Fields!EventClassification.Value = "Breakfast", Fields!CurrentAttendance.Value, 0))
    Set the visibility of second row to Hide.
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to find the open po line item by using EKKO &EKPO tables

    Hi Gurus,
        what i am doing is finding out the OPEN PO line item from EKPO table. I know it has to check the ELIKZ field from the EKPO table.Can you please clarify me on the same in more detail.I has to use the ELIKZ  EREKZ fields from EKPO table.

    Use the field ELIKZ in EKPO. If the field is Blank its an OPEN PO Line Item
    refer this link.
    How to open PO line item

  • Similar fields in table CAWN with ekko,ekpo,mara,marc,makt

    hi ppl,
             I have a requirement in which atwrt field has to be displayed.so i need a link or similar fields in cawn table with that of ekko,ekpo,mara,marc,makt,..iam unable to find the link between these tables with that of CAWN..

    Hi,
    Follow the below procedure For all the tables with CAWN table. You will come to know the relation.
    1. Use SQVI transaction,
    2. Create a View
    3. Enter title,
    4. Choose the Data source as Table Join
    5. Now use Insert table option.
    6. And insert the tables which you want. It will propose the relation between them.
    Hope it will be useful for you. If any issue let me know.
    Thanks
    Nitesh

  • Find Consignment Purchase Orders in EKKO / EKPO

    Hello all,
    have a following question: how can I find Consignment Purchase Orders in the tables EKKO or EKPO? Have tried but couldn't find the respective field...
    Thanks a lot and  best regards
    John

    Hi
    while creating Po we use item category K for consignment po
    so you should use K item category to serch your po In table EKPO
    Regards
    Kailas Ugale
    Edited by: kailasugale on May 4, 2011 6:11 PM

  • What are the common fields in table KONV = J_1IEXCHDR,EKKO,EKPO,MSEG

    Helo everyone,
    I need wht are the common fields between table of KONV and J_1IEXCHDR,EKKO,EKPO,MSEG. Pls give me details
    thanks in advance
    suresh

    check out LIFNR,KUNNR ETC

Maybe you are looking for

  • Aready had an account my computer crashed and had it repaired they put in a new hard drive now I can't install the new download how do i fix this

    Already had an account had to have a new hard drive put in my lap top they wiped out my info I need to install the new download but I keep getting an erroe message " unable to download itunes 64 setup exe. The connection to this server was reset". Wh

  • Create Stock Category

    How can I create a new stock category? Right now we have 4 separate categories.... 1 - First 2 - Second C - Closeouts S - Samples Where in SAP can I create a NEW category?  (example: "3 - Third")

  • Cannot view clips from apple homepage ?

    Hi there, have been trying to view the new i phone and top tips video clips from the apple homepage but i can only hear sound no video will play, what am I doing wrong ??? If you can help me please explain in baby language as am very backwards in the

  • Image palcement JS

    Hi folks I have one old script and it was working very fine for InDesign CS2. I am learning JavaScript, and I want to convert it in JavaScript. Can any one help me out. =============== tell application "Adobe InDesign CS3" tell document 1 set baselin

  • Regarding uploadind file , pics , etc ,etc from desktop to DMS server.

    Hi friends , I am a fresher and i dont know anything abt DMS .. I have given a task of uploading a file from desktop to DMS server ....Our requirement is not to use FTP server ......plzz guide me guys from very first step .... it wud b of gr8 help 2