Item wise sum

hi experts,
              I have an itab where i have
delivno     matnr      weight
1              A         1000
1              A         500
1              B          2000
i need an output like this
delivno     matnr    weight
1                A         1500
1                B         2000
sort itab by delivno matnr.
loop at itab.
at new matnr.
sum.
write:/ itab-delivno,itab-matnr,itab-weight.
endat.
endloop.
but it is not working ..what mey be the reason ..
what shall i do to get the output.
regards,
mani

Hi Manik,
You can use the Collect Statement.
The collect statement inserts the contents of a work area wa either as single row into an internal table itab or adds the values of its numeric components to the corresponding values of existing rows with the same key.
*So in your case the delivno matnr should be character*
and the  weight field should be numeric.
and also the order of fields in the internal table should be like that
first character fields then all the numeric fields.
SELECT BUKRS LIFNR BELNR BLART WAERS WRBTR
       FROM BSIK INTO CORRESPONDING FIELDS OF
       TABLE ITAB FOR ALL ENTRIES IN FILETAB WHERE
       BUKRS = FILETAB-BUKRS AND
       LIFNR = FILETAB-LIFNR AND
       BELNR = FILETAB-BELNR AND
       BLART = 'KR'.
LOOP AT FILETAB.
  LOOP AT ITAB WHERE LIFNR = FILETAB-LIFNR AND
       BELNR = FILETAB-BELNR.
      MOVE ITAB-BUKRS TO ITAB_FD-BUKRS.
      MOVE ITAB-LIFNR TO ITAB_FD-LIFNR.
      MOVE ITAB-BELNR TO ITAB_FD-BELNR.
      MOVE ITAB-BLART TO ITAB_FD-BLART.
      MOVE ITAB-WAERS TO ITAB_FD-WAERS.
      MOVE ITAB-WRBTR TO ITAB_FD-WRBTR.
      COLLECT ITAB_FD.
  ENDLOOP.
Reward Points, if helpful.
Regards,
Manoj Kumar

Similar Messages

  • Query for Item wise sales report

    Hi Guys,
    Below is the query i have used to run Sales Register.
    But we need Item wise sales register  and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
    (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
    FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
    GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal

    Hi experts..
    Pls   Update the Query

  • Print out of line item wise tax for each material code.

    hello all,
    Requirement is that my client want to print tax of all item in purchase order seperatelyi.e.line item wise tax for each material type.
    is there any standard procedure available in sap?
    Your valuable input will be apperciable.
    Regards
    sumit bisla

    Take the help from ABAPer and give your requirment to print the tax at item level.

  • Item wise total quantity prob

    hi experts,
    i made an alv,which shows o/p like this:
    truckno(likp-traid)| dono(likpvbeln)|party nm(kna1-name1)|skucode(lips-arktx)| qty(lips-lfimg)
    wb03-7809         |  80000345       | msaha                      |  frooti_pet            |   40,000  cs
    wb03-7809         |  80000346      | msaha                      |  frooti_ tetra          |   20,000  cs
    wb03-7809         |  80000345       | msaha                      |  appy1 ltr             |   60,000  cs,
    but client requirement is that,
    they need item wise total ie say, frooti_pet       is assigned against dono(80000345), bt this item can also be assigned against another do say(80000389) with sum qty in it.
    they want total sum of a particular skucode(item) means  frooti_pet(item wise)  , that may be assigned in diff dono  , but duff dono may be assigned in same truck
    o/p will show,
    like
    truck no| skucode| total(partycular item wise).
    how to do it?
    thnx in advance.

    Declare the fields in the internal table in the below order.
    dono(likpvbeln)|
    skucode(lips-arktx)|
    truckno(likp-traid)|
    party nm(kna1-name1)|
    qty(lips-lfimg)
    Above the loop sort the internal table as follows.
    Sort itab by dono skucode.
    Loop at itab.
    at end of skucode.
    sum.
    here move the Quantity  to another variable.
    endat.
    endloop.
    Edited by: Poorna Chandrasekhar on Jan 23, 2009 12:07 PM

  • Query for Item wise Sales.......

    *Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
    Pls update the query ...*
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal

    Closing this ...
    Edited by: Parimis on Jun 25, 2010 5:44 PM

  • Item wise payment terms in Purchase order

    hi
    Is it possible to have item wise different payment terms in Single Purchase Order?
    Thanks in Advance
    Rajendra

    Hi Prasad,,
    It is not possible to maintain different payment terms item wise <b>in single PO</b>
    Thanks
    suresh
    Message was edited by:
            suresh kallur

  • Item wise Invoice cancellation in case of same IR document

    MM Guru’s,
    I have an issue for one of my PO, when I look at Purchase order in PO history tab page by selecting chronolg.order and observed that initially GR was posted for qty – 1 (as same as PO qty&price) with price - 11.941.000 and material document created successfully.
    Later IR was posted by user for amount - 11.491.000 and IR document created - successfully.
    Based on my analysis I understand that the IR posted by user amount - 11.491.000 has been entered wrongly while posting invoice hence there is a difference of amount which I can able to view in PO history tab page.
    Since the PO has two line items and for item 2 IR is posted by user correctly only for item 1 user posted with wrong amount.
    When I cancel the invoice document in MR8M both the items in IR are getting canceled.
    My requirement is I need to cancel IR item wise.
    Please let me know is there any transaction I can able to cancel the IR item wise.
    I look forward to your valuable input.
    Regards,
    Kumar.S

    Jurgen,
    We have a separate accounts team specifically for posting invoices.
    In this case IR has been posted by user manually in T code MIRO.
    We have also case where IR posted via Workflow/EDI/Batchjob..
    Yes as u said rightly it was a typo while entering invoice.
    I have given the same solution but wanted to know if we have item wise IR cancellation in standard SAP.
    Regards,
    Kumar .S

  • Line item wise Qty in Handling Unit Management

    Dear All,
    I am working and testing Handling Unit Management. As per the client requirement, he wants Multilevel Packaging (Manually) for materials as-
    E.g. 100 Pieces will be packed in 1 Small Carton.
           100 Small Cartons will be packed in 1 Big Carton.
           10 Big Cartons will be packed in 1 Pallet.
    Now while creating delivery I packed 2 materials separately. And in the item level it is showing as a whole, means total 1100 PC packed in 11 Small carton, 11 Small cartons packed in 5 Big cartons and 5 Big cartons packed in 2 Pallets. Please find the below screen shot.
    Now when I check this delivery number in tables LIPS-VBELN, it is showing the entire qty of Small carton, Big carton and Pallets as 11, 5, 2 respectively. But actually it has show each material or line item wise No. of Small carton, Big carton and pallet used.
    E.g. For 1st material Small Boxes = 5
                                   Big Carton = 2
                                   Pallet = 1
          For 2nd material Small Boxes = 6
                                   Big Carton = 3
                                   Pallet = 1
    My question is, is there any table or logic where I can fetch all these details for all material that how many packaging material and qty has been used. Because in packing list the same needs to get printed each line item wise. I checked in VEPO and VEKP table as well but not getting any input.
    Kindly help.
    Regards:
    Abhishek

    First of all, why you don't have any quantities assigned against Small cartons, big cartons and pallets?
    Well, for your requirement. As functional consultant, you should be smart enough to interpret & analysis the data when you have tables and data in hand. Anyways, in your case,
    As Pallet is the highest level pack material.
    Pass HU no of pallet in VEKP- EXIDV, in your case for one of the pallet, it is 1000013558.
    For that you will get, Internal HU no. VEKP-VENUM, say, 86.
    Pass VEKP-VENUM = VEPO-VENUM.
    With that you will get Lower-level HU, VEPO-UNVEL, that will be internal HU No for Big Cartons & VEPO-VEANZ for packing material quantity.
    Then pass VEPO-UNVEL = VEPO-VENUM, by this you will get internal HU No for Small Cartons in VEPO-UNVEL & VEPO-VEANZ for packing material quantity.
    Again, pass VEPO-UNVEL = VEPO-VENUM, by this you will get following info:
    Table - Fields
    Field Desc
    VEPO-VEPOS
    HU item
    VEPO-VBELN
    Delivery
    VEPO-POSNR
    Delivery Item
    VEPO-VEMNG
    Packed quantities
    Try and share your feedback.
    Thanks, JP

  • PO Line Item wise gross value for combination of WBS and Material Group

    Hello,
    Our requirement is to get report for PO Line Item wise gross value for combination of WBS and Material Group. Standard report ME2J gives net price but not gross value for Material Line items. Please let me know if any standard report( or ME2J) will suffice this requirement.
    Regards,
    Milind Dumbre

    Dear Milind
    No standard report available to get the PO Line Item wise gross value for combination of WBS and Material Group. Please go for development by taking reference ME2J.
    Warm regards
    Ramakrishna

  • PO (Line Items wise) Payment Status Report

    Hi Friends,
    Is it possible to get a PO (Line Items wise) Payment Status Report.
    My client wants PO Line wise payment status as a MM report development.
    We have Down Payment, Residual & Retention money as a business practise with our vendors
    Following is the MM-FI flow in our company code..
    Create & Release PR u2013 MM - Creating PR
    Create & Release PO (ME21N) u2013 MM u2013 Creating PO
    F-47 Down Payment Request u2013 MM u2013 Creating DPR
    F-48 Post Vendor Down Payment u2013 FI - Posting DPR
    FBZ5 Print Check for Payment Document u2013 FI - For printing cheques for DP only
    MIGO/ML81N, GR u2013 MM u2013 SES/GR for PO
    MIR7/MIR6 IR - MM/FI u2013 Parking & IR
    F-44 Clear Vendor u2013 Linking advance with IR (as residual clearing)
    F-53/F-58 u2013 Posting Payments after deducting Retention
    F-04 Post with Clearing u2013 Clearing Outgoing account entries with Main account
    Thanks in advance.
    Regards,
    Vikrant Sood

    as per my knowledge you can configue a new Z table or prepare a Query using EKPO table you will your desired result.
    regards,
    Ninad Kshirsagar

  • JIiJ : depot sale: Delivery item wise Excise invoice number

    Dear all
    we are using J1ij for depot sale/stock transfer between main plant and its depot outside state.
    we have unique delivery item which corresponds to unique material code. after doing PGI when we go to J1ij and choose the different line items, the excise invoice number that is saved is delivery wise and not delivery item wise. that is for each delivery we get one excise invoice.
    the requirement is that this should be delivery item wise. we have tried trying to save one delivery item but it does ask for the 2nd delivery item and once we delete that 2nd delivery item and save the Ji1j, it allows to save but while going in for the 2nd delivery item, it says the delivery is already excised out.
    did any of the gurus come aross this requirement. if yes how did you resolve this.
    there is one batch program J_1IJCHK but we are that saves without asking for any information.
    Kindly help.
    regards

    Hi Sreekanth,
    If this is first time you are doing look for OSS notes, Please escalate this issue to your basic and apap consultants.
    R u following the following flow in case of stock transfer from mfg plant to depot plant.
    PlantA:
    ME21N 
    VL10B
    VL02N
    VF01
    J1IIN
    Plant B:
    MIGO - (Goods Reciept & Excise Capture)
    VA01
    VL01N
    J1IJ
    VF01
    Here at goods reciept you need to capture excise inviove same will populate when you make a sales from plant B using J1IJ transaction.
    Thanks,
    Swamy H P

  • Goods Receipt Value line item wise

    Hi Experts,
    My client wants show Goods Receipt Value line item wise at the time of GR entries.
    He wants show GR Value before saving the GR document.
    Please advise me how it is possible.
    Thanks in advance,
    Chandhu

    and what will be the benefit of such request? do you think a receiver (warehouse personell) can valuate whether the Po price is correct maintained by a buyer?
    Maybe it is better to create check reports for the buyers instead.
    you can certainly check in a user exit if price is far away from the price maintained in material master and can issue a warning or even an error.

  • Line item wise billing

    Hi All,
    Can we do sale order related billing for individual line item wise and quantity wise?
    If this is for delivery related billing then the setting will be in item category, billing relevance as K. But what will be the settings for order related billing?
    Kumar

    Hi,
    In two ways you can achieve your requirement.
    1.Goto the T.Code VF01
    Enter your sales order number.Donot press Enter.
    Click on "Selection list".
    Select your items.Click on Copy.
    Save the invoice.In "VOV7" T.Code maintain the billing relevance as "C".
    2.Goto the T.Code "VA02".
    Double click on the item.Goto Billing document tab.
    Maintain the billing block under "Billing" tab.
    Save.
    Goto the T.Code "VF01".Enter your order number.
    Create the billing document.
    Next Goto VA02 and remove the another block.
    Create the invoice.
    Regards,
    Krishna.

  • Print out the delivery schedule item wise

    Hi friends..
    can any one pl tell me how to take the printout of the delivery schedules item wise.
    i have checked the ME80RN but it doesnt work for me.
    client want to print delivery schedule not SCHEDULING AGGREMENT.
    Your help will be highly appreciated..with points..
    Regards,
    Anil

    Hi,
    Hope you can create an access sequence with material as a field and create a condition record based on this...
    Bcoz mess determination takes place at header level.
    Reg,
    Deepak

  • Fbl1n and fbl5n line item wise display the cutomer and vendor name

    Hi,
    My user is asking report for fbl5n and fbl1n line itemwise dispaly vendor and customer.See the report for one time vendor and customer name displaythe line item wise display in FBL!N/FBL5N. but not the display the regular vendors/customer.So one time table name BSEC
    Please advise
    Regards.
    Edited by: yps y on Nov 13, 2008 1:26 PM

    Hi,
    line item reports FBL1N/FBL5N are reading the line items (wow, what a big surpise ) and displaying information on line item level.
    As the vendor/customer name is NOT stored in the line items, you cannot display this in the lines (along with other item level information., like amount, posting key, doc.type, etc.). You may find a field called "Name 1) in the field catalog when configuring the ALV layout but this is empty for normal customers/vendors. It is only filled in for one time (Cpd) customers - the reason is as explained above: for these special accounts, the name IS stored on line item level (it varies from item to item),, that's why it can be read and displayed in the items.
    Now how about normal customers/vendors?
    You have to activate Business Transaction Event 1650 and implement a simple code so that depending on the account type (D = customer, K = vendor), you get the business partners name from table KNA1 / LFA1 and put it into field Name1.
    Hope that helps, points welcome
    Csaba

Maybe you are looking for