Calculating GR quantiy and Invoiced quantity  in generic datasource .

Hi experts
Please help me out in getting this done
EBELN        EBELP  VGABE  BWART    BUDAT             MENGE             BPMNG        DMBTR             WRBTR      WAERS     AREWR            SHKZG
1101-00178   00001   1     101   31.12.2010           90.275            90.275    44,234,750.00    44,234,750.00  USD       0.00               S
1101-00178   00001   1     101   12.07.2011            0.063             0.063        30,870.00        30,870.00  USD       0.00              S
1101-00178   00001   1     102   12.07.2011            0.063             0.063        30,870.00        30,870.00  USD       0.00               H
1101-00178   00001   1     101   20.12.2011            5.274             5.274     2,584,260.00     2,584,260.00  USD       0.00               S
1101-00178   00001   2           31.12.2010           90.275            90.275    44,234,267.77    44,234,267.77  USD       44,234,750.00       S
1101-00178   00001   2           20.12.2011            5.274             5.274     2,584,225.23     2,584,225.23  USD       2,584,260.00        S
1101-00179   00001   1     101   31.12.2010           93.231            93.231       913,663.80       913,663.80  USD       0.00            S
1101-00179   00001   1     102   31.12.2010           93.231            93.231       913,663.80       913,663.80  USD       0.00           H
1101-00179   00001   1     101   31.12.2010           93.231            93.231       913,663.80       913,663.80  USD       0.00           S
1101-00179   00001   2           31.12.2010           93.231            93.231       913,650.00       913,650.00  USD       913,663.80       S
1101-00179   00001   2           31.12.2010           93.231            93.231       913,650.00       913,650.00  USD       913,663.80           S
1101-00179   00001   2           31.12.2010           93.231            93.231       913,650.00       913,650.00  USD       913,663.80       H
1101-00179   00002   1     101   31.12.2010           89.153            89.153       873,699.40       873,699.40  USD       0.00          S
1101-00179   00002   1     101   29.09.2011            9.953             9.953        97,539.40        97,539.40  USD       0.00           S
1101-00179   00002   2           31.12.2010           89.153            89.153       873,685.37       873,685.37  USD       873,699.40       S
1101-00179   00002   2           31.12.2010           89.153            89.153       873,685.37       873,685.37  USD       873,699.40       S
1101-00179   00002   2           31.12.2010           89.153            89.153       873,685.37       873,685.37  USD       873,699.40       H
1101-00179   00002   2           29.09.2011            9.953             9.953        97,530.64        97,530.64  USD       97,539.40            S
1101-00180   00001   1     101   31.12.2010           77.925            77.925     4,675,500.00     4,675,500.00  USD       0.00          S
1101-00180   00001   1     101   30.05.2011            3.467             3.467       208,020.00       208,020.00  USD       0.00          S
1101-00180   00001   1     101   29.12.2011            2.685             2.685       161,100.00       161,100.00  USD       0.00            S
1101-00180   00001   2           31.12.2010           77.925            77.925     4,675,438.00     4,675,438.00  USD       4,675,500.00       S
1101-00180   00001   2           31.05.2011            3.467             3.467       208,000.00       208,000.00  USD       208,020.00           S
1101-00180   00001   2           29.12.2011            2.685             2.685       161,100.00       161,100.00  USD       161,100.00       S
I want to calculate GR quantity,GR Amount and Invoiced Qty, Invoiced Amount  using the above 3 feilds (VGABE ,BWART ,SHKZG ).
What logic should I implement in routine .Please can anyone give me the excat ABAP code to be implemented in the routine . This is urgent requirement so please experts help me. I dont have knowledge in ABAP .Any help would be greatly appreciated

Hi,
First of all how generic datasourceis gettig data if it is getting from Deirect tabel then following soulation will work
You can add the needed fields in strcuture of datasource ( Assuming that generica datasoure is directly on table).
In Exit
c_t_data: will have all the data from the datasource before sending it to BI. So you can populate and calculate the requried fields there.
Loop c_t_data
do the calculations
Endloop
Refer :
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0eade6c-692a-2c10-ac86-80f6b2157791?QuickLink=index&overridelayout=true
If the datasourceis populated by abap program only, you can enhace directly their.
Regards
Nilesh

Similar Messages

  • Business scenarios on SD and MM modules for generic datasources and enhance

    Hi,
      Can anybody send some documents on SD and MM module on generic datasource and on enhancements.Pl send it to my MailID:[email protected]
    Thanks,
    Chinna

    Hi,
    MM Process flow:
    The typical procurement cycle for a service or material consists of the following phases:
    1. Determination of Requirements
    Materials requirements are identified either in the user departments or via materials planning and control. (This can cover both MRP proper and the demand-based approach to inventory control. The regular checking of stock levels of materials defined by master records, use of the order-point method, and forecasting on the basis of past usage are important aspects of the latter.) You can enter purchase requisitions yourself, or they can be generated automatically by the materials planning and control system.
    2. Source Determination
    The Purchasing component helps you identify potential sources of supply based on past orders and existing longer-term purchase agreements. This speeds the process of creating requests for quotation (RFQs), which can be sent to vendors electronically via SAP EDI, if desired.
    3. Vendor Selection and Comparison of Quotations
    The system is capable of simulating pricing scenarios, allowing you to compare a number of different quotations. Rejection letters can be sent automatically.
    4. Purchase Order Processing
    The Purchasing system adopts information from the requisition and the quotation to help you create a purchase order. As with purchase requisitions, you can generate Pos yourself or have the system generate them automatically. Vendor scheduling agreements and contracts (in the SAP System, types of longer-term purchase agreement) are also supported.
    5. Purchase Order Follow-Up
    The system checks the reminder periods you have specified and - if necessary - automatically prints reminders or expediters at the predefined intervals. It also provides you with an up-to-date status of all purchase requisitions, quotations, and purchase orders.
    6. Goods Receiving and Inventory Management
    Goods Receiving personnel can confirm the receipt of goods simply by entering the Po number. By specifying permissible tolerances, buyers can limit over- and underdeliveries of ordered goods.
    7. Invoice Verification
    The system supports the checking and matching of invoices. The accounts payable clerk is notified of quantity and price variances because the system has access to PO and goods receipt data. This speeds the process of auditing and clearing invoices for payment.
    Common Tables used by SAP MM:
    Below are few important Common Tables used in Materials Management Modules:
    EINA Purchasing Info Record- General Data
    EINE Purchasing Info Record- Purchasing Organization Data
    MAKT Material Descriptions
    MARA General Material Data
    MARC Plant Data for Material
    MARD Storage Location Data for Material
    MAST Material to BOM Link
    MBEW Material Valuation
    MKPF Header- Material Document
    MSEG Document Segment- Material
    MVER Material Consumption
    MVKE Sales Data for materials
    RKPF Document Header- Reservation
    T023 Mat. groups
    T024 Purchasing Groups
    T156 Movement Type
    T157H Help Texts for Movement Types
    MOFF Lists what views have not been created
    A501 Plant/Material
    EBAN Purchase Requisition
    EBKN Purchase Requisition Account Assignment
    EKAB Release Documentation
    EKBE History per Purchasing Document
    EKET Scheduling Agreement Schedule Lines
    EKKN Account Assignment in Purchasing Document
    EKKO Purchasing Document Header
    EKPO Purchasing Document Item
    IKPF Header- Physical Inventory Document
    ISEG Physical Inventory Document Items
    LFA1 Vendor Master (General section)
    LFB1 Vendor Master (Company Code)
    NRIV Number range intervals
    RESB Reservation/dependent requirements
    T161T Texts for Purchasing Document Types
    Transaction Codes:
    RFQ to Vendor - ME41
    Raising Quotation - ME47
    Comparison of Price - ME49
    Creation of PO - ME21N
    Goods Receipt - MIGO
    Invoice (Bill PAssing) - MIRO
    Goods Issue - MB1A
    Physical Inventory - MI01( Create doc)
    MI04 (Enter Count)
    MI07 (Post)
    Also please check this links.
    http://www.sapgenie.com/sapfunc/mm.htm
    http://www.sap-basis-abap.com/sapmm.htm
    SD Process Flow:
    The sales documents you create are individual documents but they can also form part of a chain of inter-related documents. For example, you may record a customer’s telephone inquiry in the system. The customer next requests a quotation, which you then create by referring to the inquiry. The customer later places an order on the basis of the quotation and you create a sales order with reference to the quotation. You ship the goods and bill the customer. After delivery of the goods, the customer claims credit for some damaged goods and you create a free-of-charge delivery with reference to the sales order. The entire chain of documents – the inquiry, the quotation, the sales order, the delivery, the invoice, and the subsequent delivery free of charge – creates a document flow or history. The flow of data from one document into another reduces manual activity and makes problem resolution easier. Inquiry and quotation management in the Sales Information System help you to plan and control your sales.
    Transaction Codes:
    Inquiry - VA11/VA12/VA13
    Quotation - VA21/VA22/VA23
    Sales Order - VA01/VA02/VA03
    Delivery - VL01N/VL02N/VL03N
    Billing/Invoicing - VF01/VF02/VF03
    Also please check this links.
    http://www.sapgenie.com/sapfunc/sd.htm
    http://www.sap-basis-abap.com/sapsd.htm
    http://www.sapgenie.com/abap/tables_sd.htm
    Production Planning:
    For example, consider a pump manufacturing plant, based on the customer requirement, planning is done for future months ( we plan for a qty on particular
    date). Pump is an assembly - were main component would be manufactured in the plant and others would be procured. As PP, we are concerned only in the inhouse
    manufacturing but the final assembly (considering BOM) can be done only if the procured components are available. MRP helps in planning the shortage, on
    particular date based on the planned date. Work center (ex. lathe) place the components are machined/assembled (were the operation is done). Sequence of
    operation is routing (lead time scheduling data is got from routing). In the MRP Run,basic or lead time scheduling (need to know when to start/finish date)
    is done. On creation of the production order, system checks for which BOM and routing to be picked up (if there are many routings or BOM for that particular
    finished product). Availabilty checks for material,PRT and capacity needs to be done. on release of the order, confirmation of the order can be done (on
    completion of the order or after manufacturing the quantities). GI and GR have to be done.PP flow ends here
    step 1: creation of master data (Material master,BOM,Work center,Routing)
    step 2: Planning - can be done by Planned independent requirement (MD61), Independent requirement (MD81).
    we plan for a quantity, on which date (it would be finish date).
    step 3: MD04 -stock/requirement lsit (plan made can be viewed in MD04)
    step 4: MRP run - MD02, PIR is converted into Planned order
    step 5:Planned order to be converted production order - CO40, CO41
    step 6: production order to be released - CA02
    step 7: confirm the production order (order confirmation-CO15 (after which GI and GR is done)
    assign pts if helpful...

  • Calculating the GR and IR quantity

    Hi Experts,
         My requirement is to calculate the Goods Receipt  and Invoice Receipt quantity for single Purchase order.
    for eg :  1 PO has quantity - > 25.
    { if GR < IR } it should go to block .
       consider 3 GR'S are there for single PO and 1 IR
    ( GR  - >  8
      GR  - >  7
      GR - >  10 )
    IR - > 25.
    in the first loop it has to check with ( 8 - 25)     (25- 8 = 17)
    then ( 7 - 17)          (17- 7 = 10)
    then (10 -10)
    how to build the logic for this?

    It is not just GR or IR quantities as there may be GR reversals and IR cancellations. So you need to consider net GR quantity (GR - Reversal if any) and net IR quantity (Invoice - Invoice Cancellation quantity) for each PO item.
    We built similar logic in one of our project.
    1. Fetch good receipts from linked PO items in EKBE where BEWTP = 'E' and VGABE = '1'
    2. Fetch invoice receipts from linked PO items in EKBE where BEWTP = 'Q' and VGABE = '2'
    3. Fetch any IR cancellations (RBKP-STBLG, STJAH) if any linked to the the IR
    4. The goods receipts will be positive if SHKZG = S and negative (reversal) if SHKZG = H
    Using the above information you can calculate total GR qty, total IR quantity and remaining GR quantity that is not invoiced.
    Rob, thank you. Advise taken!

  • Invoice Revenue and Invoice Quantity at line Item

    Hello All,
    I am pulling all the billing datasource extractors into BI - 2LIS_13_VAITM, 2LIS_13_VDHDR, 2LIS_13_VDKON.
    As per my report requirement, I want to show Invoice Number, Invoice Item, customer, division, status, invoice revenue, invoice qty and Unit price.
    I have 2 invoice qty columns - Good Qty and Reject Qty, based on status field, (GOOD/REJECT).
    I need to design and map the infoobjects to fields on datasource. could you please suggest me the solution or some documents you have for my reference.
    thanks,
    pra.

    Hi,
    I understand that you want to create a report based on the above three datasources. To start with, you need to create a infoset on them joining the fields in the datasource with join conditions. And then you may drag the fields reqd in the report to rows and columns in BEx.
    Let me know if you have any issues.
    Rgds,
    Sonal

  • Logic for fetching Quantity Delivered and Invoiced

    I am creating a Sales Order report in which I need to Fetch the delivered Quantity and Invoiced Quantity fields.
    I am currently going to VBFA table and pass SO and line item number and fetch all data. Then I perform addition/ subtraction to remove cancelled quantities.  this is making the logic complicated.
    Is there any standard Function module/ or table or BAPI which can fetch the Delivered and Invoiced quantities directly?
    Regards,
    Onkar Borkar

    Hi Experts,
    There is a  requirement where in it is required to track changes in the field 'Batch' in the deliveries. This change log report should have the option of checking the log for multiple deliveires at a time. It can be similar to the delivery change log report that we have but shoul run for multiple deliveries at a time.
    Please let me know if such a reporet is available in standard SAP or in LIS repporting.
    Thanks/ Regards,
    Onkar

  • Difference in Quantity and amount between PO and invoice

    Dear Experts,
      In my implementation, the customer puts water in the finished material BOM and wants to issue it to the production. So we made a fake PO with the required quantity and received its quantity in the inventory. The problem faces us when the monthly water invoice comes from the water company and we want to invoice in "MIRO" with reference to the purchase order. Always the quantity and amount in the incoming invoice are different from the ones in the purchase order. Please, Advise.
    Thanks,
    Magdy.

    Hi all ;
    I think that you procure water which is used your BOM. You get invoices periodically but there is inconsistency between PO and Invoice quantity and amount.
    You can benefit from M8 system messages , i created a document M8 messages for incoming invoices with tolerances that might be helpful.
    If it is used in BOM, i do not think so relation pipeline material process...
    Regards.
    M.Ozgur Unal

  • Logic to fetch delivered and invoiced Qty using sales order and line no

    Hi Experts,
    I am creating a Sales Order report in which I need to Fetch the delivered Quantity and Invoiced Quantity fields.
    I am currently going to VBFA table and pass SO and line item number and fetch all data. Then I perform addition/ subtraction to remove cancelled quantities. this is making the logic complicated.
    Is there any standard Function module/ or table or BAPI which can fetch the Delivered and Invoiced quantities directly?
    Regards,
    Onkar B

    Hi,
    First pass the sales order number into "VBFA" table into the field "VBELV".
    Execute or Press F8.
    Get the document number of the delivery from "VBELN".
    Pass the same delivery document numebr into "LIPS" table into the field "VBELN".
    Execute.
    Get the value of the delivery quantity from the field "LFIMG" in this table.
    Next got the table "VBFA".
    Pass the delivery document number into the field "VBELV".
    Execute or Press F8.
    Get the document number of the billing document from "VBELN".
    Pass the same billing document numebr into "VBRP" table into the field "VBELN".
    Execute.
    Get the value of the invoiced quantity from the field "FKIMG" in this table.
    Like this we have to get the delivery and invoice quantities.
    Regards,
    Krishna.

  • Problem with the fiells MEINS(PO Unit ) and MENGE(Quantity) .

    Hi experts
    I am having problem with the fiells MEINS(PO Unit ) and MENGE(Quantity) of the datasource 2lis_02_acc .
    I have created custom cube and have mapped the fiels MEINS to infoobject 0PO_UNIT and MENGE(Quantity) to infoobject 0CPQUAOU.
    Now the data is successfully loaded in the cube but the values of the above 2 fields are getting changed.
    In r3 the value for MEINS is "AU","EA" , "H" etc but this field value is getting converted to "LE" in the cube and also the field  MENGE(Quantity
    ) in r3 is for example "1"  it is getting converted to 3 in the cube. do u have any idea what is the problem.
    The rule type is direct assingment and there is no routine .
    Any clues.
    Thank you.

    holy devilz wrote:
    Hi experts
    > I am having problem with the fiells MEINS(PO Unit ) and MENGE(Quantity) of the datasource 2lis_02_acc .
    >
    > I have created custom cube and have mapped the fiels MEINS to infoobject 0PO_UNIT and MENGE(Quantity) to infoobject 0CPQUAOU.
    > Now the data is successfully loaded in the cube but the values of the above 2 fields are getting changed.
    > In r3 the value for MEINS is "AU","EA" , "H" etc but this field value is getting converted to "LE" in the cube and also the field  MENGE(Quantity
    > ) in r3 is for example "1"  it is getting converted to 3 in the cube. do u have any idea what is the problem.
    > The rule type is direct assingment and there is no routine .
    > Any clues.
    > Thank you.
    Hmm, your system should consider the alternative UOM maintain in the material master.
    Each material in SAP has its standard, base unit of measure (stored in MARA-MEINS). To allow using alternative units, those can be maintained per material in table MARM. So, assuming the Base UoM is only considered (for LE), it converts material quantity from one unit to another, most likely from alternative units to the base one. So, changing that settings must solve. http://goo.gl/JuZlm
    Alternative steps:
    1.Goto MM42 (Assuming there's no BAPI req?)
    2. change po unit from basic unit to other -> save OK
    3. change po unit from other to basic unit -> save OK
    Also, MD63 shows all data in the base unit of measure.
    If you want to explore basic steps, goto RSD1 > Additional > Alternative UoM.
    Best Regards, @{

  • Tax calculation on sales order and invoice is different

    2007A, SP0, PL49
    The tax on a sales order does not match the tax on the linked delivery and invoice by 1 cent. We take payment based on the sales order amount as the delivery and invoice are done after the fact. Why is the tax calculated differently on the delivery/invoice? We would want it to always match.
    Item price = $111.04. Taxcode rate 13% has combination of 5% GST + 8% ONTAX.
    On Sales Order, ONTAX = $8.88
    On Delivery/Invoice, ONTAX = $8.89
    Can someone please explain the difference? Is rounding/tax calcualtion controlled by system settings per document?

    Something must be wrong with your Sales Order tax.  The actual tax would be 8.8832.  Round up to 8.89 is correct.  Do you have any SP, FMS or add-on been used?
    Thanks,
    Gordon

  • Order has been fully supplied and invoiced but a quantity of 76 is still sh

    Hi,
    Customer order XXXXXX line30This order has been fully supplied and invoiced but a quantity of 76 is still showing as outstanding on MD04
    Total quantity is 288 out of which 212 was deliverd and invoiced once and 76 was delivered another time and invoiced the status is compleate for both
    when you see in MD04 for same material it is showing 76 under Rec/Re coluem and it is showing purchse req under MRP colum, for rest of the line items it is showing Purchase order item under MRP coluem
    user doest want this 76 in MD04
    I have searched the note in SAP note no:Note 25444
    SDRQCR21: Recovery of sales and delivery requirements
    and run but no results. the problem is still there.
    and also please guid me wether it is a sd issue are MM or any other because as to my analysis if i run SDRQCR21 it has to delete all bad requirments but this is with purchase requisistion under MRP colum in MD04 screen with a     *  mark.
    please help me find a solution
    Thanks for the help
    Regards
    Rajendra Prasad

    Hi,
    Try and click delivery completed in sale order and check MD04.
    This will not appear.
    regards
    suresh

  • Changing Production order quantity and invoicing again

    Production order was completed for less than full quanity and invoice was generated. . Now can we cancel the invoice and change the quanity in Production oredr to full quantity and then regenrate the invoice? Are there any other steps?
    Thanks

    Hi,
    SAP Confirmation for Orders is to caputre the actual activity used and goods issue (if backflushing is activated). MRP cannot sense the confirmed Qty.
    If you want the MRP to Plan the difference qty, you have to do GR for the 95, remaining 5 will be generated as planned order in next MRP run.
    You can also assign automatic GR for the last operation in your routing. So after confirming the last operation, GR will happen for the Qty. then you can run MRP, then it will generate planned order for qty 5.
    Thanks,
    JK

  • Invoiced quantity and invoice amount not updated in infosource 2LIS_02_SCL

    HI,
    I am facing one problem when i run the standard query 'Price trends in last three months' the vaue 'X' is coming in price column. When i analyzed i found in infosource 2LIS_02_SCL, invoiced qty and invoices amount is blank. These two fields are used in the above mentioned query. Why these two fields are not getting updated? Am i missing something?
    Regards,
    Manish

    Hi Sadhu,
    Thanks.
    Yes, the material statistics group is updated.
    The info structure is retrieving the amount but not the quantity.
    This is the structure for invoiced quantity.
    Rules for key fig.
    Event                VD         Billing document
    Update type          A          Cumulative updating
    Unit                 01         Base unit of measure
    Source table         MCVBRP
    Source field name    FKIMG      Billed quantity
    Source unit          03         Sales unit
    Table for date       MCVBRK
    Date field           FKDAT      Billing date
    Rules for characteristic
    Sales organization              MCVBRK     VKORG
    Distribution channel            MCVBRK     VTWEG
    Division                        MCVBRK     SPART
    Sold-to party                   MCVBPA     KUNNR
    Plant                           MCVBRP     WERKS
    Material                        MCVBRP     MATNR
    Product hierarchy               MCVBRP     PRODH
    Batch                           MCVBRP     CHARG
    Could it be possible that this is because the item is service and non-inventory?
    Thanks so much.

  • Report - quantity and value difference between delivery and invoice?

    Hello experts,
    My client use u201EProof of deliveryu201D t-code: VLPOD. There is always quantity and value difference between delivery and invoice.
    Do you know any report which will show this differences between delivery and invoice?
    Best regards,
    Maciej

    Hi,
    Note 867678 - Proof of delivery (POD), delivery and billing document will help you to understand POD flow.
    You have the tcode VLPODF/VLPODL/VLPODA, but perhaps they will not help you. So, as the before note suggests you, you can use the tables VBFA, LIKP, LIPS, VBRK, VBRP, TVPOD and TVPODG to do your own report.
    I hope this helps you
    Regard,
    Eduardo

  • Different quantity between GR and Invoice

    Hi gurus,
    If there is a different quantity between GR and Invoice, how could I handle it?
    Please tell me the process in detail for 2 cases: GR > Invoice and GR < Invoice.
    Thanks!!!

    hi
    firstly why u will pay for more quantity if u have received less ????
    if the quantity is less and bill is for more quantity then u can use invoice reduction
    or the subsequent credit or debit is good option for both cases

  • How to link Invoice Quantity and Confirmed quantity in schedule line

    Hello,
    I'm working for a report in BW. The user want to compare the invoice quantity to the confirmed quantity in schedule line for a sales order.
    I can't find any table linking these two fields.
    Could you help?
    Thanks a lot
    Jeannie

    Ashish,
    When we link these two tables by Sales Order Number / Item, we would take following result:
    Sales Order    /     Itme     /     Schedule line     /    confirmed quantity   /     actual billed quantity
    1                  /      10        /      1                     /    3                            /              5
    1                /         10      /       2                    /     2                            /             5
    But in fact, for Sales order/itm 1/10, we have only 5 PC billed, not 10.
    When billed 5 PC, I want to despatch it to the Schedule line as 3, 2.
    Regards,
    Jeannie

Maybe you are looking for