Mistakenly reversed goods receipt after invoice posted

Hi experts,
I already post this question in EAM forum, but moved to here as I think I will get more useful replies.
I have a PO that was goods receipted and invoiced receipted. Later on, the GR was reversed, and now that entry needs to be reverse... We're having a negative value in our reports that should not be there.
What would be the way to fix this? Is it OK that the goods receipted may be reversed after invoice receipted.. i.e. after an invoice has been posted? In Tx. OMBZ the Mvt. 102 has "RevGR desp. IR" unchecked.
Kind Regards,
Andres.
Original thread: Reverse goods receipt after invoice posted.

Just do a GR again for the PO and this should fix your problem. The original document and reversal documents will remain there with another GR document against PO.
Unless the payment against the invoice hasnt been made, your preceding documents can be changed. Once the payment has been made, you should not be able to change any preceding document.
Edited by: Afshad Irani on May 31, 2010 9:08 AM

Similar Messages

  • Reverse goods receipt after invoice posted

    Hi experts,
    I have a PO that was goods receipted and invoiced receipted (work was done). Someone has then un-goods receipted the PO, and now that entry needs to be reverse (the work order has status closed).
    What would be the way to fix this? Re-open the work order? Is it OK that the goods receipted may be reversed after invoice receipted.. i.e. after an invoice has been posted?
    I am starting to get familiar with this, so bear with me.
    Regards,
    Andres.

    Andres,
    First check whether the PR/PO has been created within the workorder at Operation level or it is created outside the work order and just the account assignment in the PR/PO has been done to the workorder.
    Since PO is the superior purchasing document and preceeds the PR , standard application dont have any dependancy between PO and work order..Dependency stops at PR release and when Quotation/PO has been created and released..So i dont think u need to undo TECO...
    For any reversal of the material documents after posting, subsequent Fi document should be revresed only then reverse Goods movement becomes effective as it needs to update the stock levels and inventory value in the systemm.
    However u need to check the way system has been configured and Mapped...
    For better response please post this question in MM---Inventory management forum.....
    If u r satisfied with this answer please close and rate..
    Thanks,
    Shaikh Murad....

  • Reverse Goods receipt after Quality Inspection...

    Hi Expets,
    I'm able to do the GR reverse  after the Quality inspection Lot also using mb01 and mov type 102.The stcok is also updating as soon as i do the reverse. Here my questions are.......
    1)Why  I need to do the cancel of Inspection Lot since there is no effect on stock postings by cancellation and stock postings are effected by GR only.
    2) GR = 10 qty
        Inspection  Lot  = 5 Unrestricted, and for remaining UD for 5 has not been made.
    here I'm able to do the reversal of GR  for 10 Qty and I did also. and same time I,M  not able to do the cancellation of Lot because the qty 5 is still pending, for this If i post the qty 5 to un restricted in the Lot  and do the cancellation  lot , the stock will be duplicated in mmbe. kindly guide me how to handle this type of issue....
    where reversal of GR for full qty before partial Inspection qty for the lot and completing the inspection lot after GR reversal and cancellation of full Lot
    Regards,
    Sri.........

    Hi Manu,
    For wht Z-Tcode and programme has to be developed ?
    Regards,
    Sri......

  • SAP cancellation goods receipt after posting unplanned delivery cost

    Dear all,
    I created one SAP purchase order, quantity 10 pcs, net price = 10 usd for one pc. Invoice receipt & goods receipts is done. When goods receipt, accounting movement as following:
    debit stock account: 100
    credit GR/IR: 100
    Invoice receipt as following:
    credit AP: 100
    debit GRIR: 100
    After that I had another invoice for unplanned delivery cost: 10 usd
    its accounting movement is:
    credit AP: 10
    debit stock account: 10
    After receiving invoice for unplanned delivery cost I must cancel goods receipt document, the SAP system has accounting movement as follow:
    credit stock: 110
    debit GRIR: 110
    But my customer want that it must be accounted as below:
    credit stock: 100
    debit GRIR: 110
    credit XXX: 10
    HOW CAN I DO FOR THIS SITUATION????? PLEASE HELP!!!!!

    Thanks Chandra Shekhar!
    But when I did as you suggested (In SPRO Goto MM-LIV- Incoming Invoice- Configure How Unplanned Delivery Costs Are Posted here against the company code put the option 2. Configure your system to post the unplanned delivery costs separately.)
    Subsequent debit for unplanned delivery cost as below:
    Credit AP: 10
    Debit Unplan. delivery cost: 10
    when I cancel goods receipt, its accounting document as follow:
    Credit stock: 100
    Debit GRIR: 100
    HOWEVER, my customer want that Subsequent debit for unplanned delivery cost as below:
    Credit AP: 10
    Debit stock: 10
    Until cancellation for goods receipt (after invoice receipt (100usd) & Subsequent debit for unplanned delivery cost (10 usd). It must be as below:
    credit stock: 100
    debit GRIR: 110
    credit XXX: 10
    HOW CAN I DO FOR THIS SITUATION????? PLEASE HELP!!!!!

  • Prevent PO item from beeing changed after goods receipt or invoice receipt

    Hi all,
    Users had the good idea to change the description of the goods to be purchased, after a partial goods entry was already posted. Now they complain that what they get is not what they ordered (...)
    Is it possible to prevent a PO item line from beeing changed with ME22N, after e.g. a partial goods receipt has been posted, or the MIRO posting has been done?
    Thanks for information!

    Kurt,
    Standard SAP doesnt restrict you to PO changes when subsequent documents are posted.
    You can have a Customer Exit to check in MSEG Table if any subsequent document exists for the PO entered in the PO number field. the exit could be used to check PO if MIRO/ MIGO have been posted or not.
    Also define error messages if the documents are posted, user should get error message.
    Raghavan

  • Problem with the Posting Date of Goods Receipt or Invoice Receipt for PO

    Hi All,
    I am working on 2LIS_02_SCL - Purchasing Data (Schedule Line Level),
    For our report, we should get the scheduled PO quantity,actual PO qty, Scheduled date and actual date in the report.
    we are getting all these fields from the above extractor...
    For a PO which is opened (Delivery Completion indicator not set) - we where getting all field as in ECC(ME23N)
    But for a PO which is finished(Delivery completion indicator is set) - we where are getting actual GR qty,planned qty,planned or scheduled date at schedule line level.But we are not getting the Posting Date of Goods Receipt or Invoice Receipt for PO from history EKBE for all the schedule line.
    ex:
    for open PO
    PO num         item num   schedule line    Planned date   actual date  difference  actual qty  planned qty  difference
    450002432   10                        1              01/10/2011    02/10/2011       1 day          100             100             0
                                                     2              02/10/2011    04/10/2011       2 days        200             400            200
                                                     3              03/10/2011    07/10/2011       4 days         300            300              0
    For the same PO when it is Finished or completed(Delivery completion indicator is set)
    PO num         item num   schedule line    Planned date   actual date  difference  actual qty  planned qty  difference
    450002432   10                        1              01/10/2011    07/10/2011       6 day          100             100             0
                                                     2              02/10/2011    07/10/2011       5 days        200             400            200
                                                                    03/10/2011    07/10/2011       4 days         300            300              0
    for all the schedule line its displaying the last posting date(i think its taking from EKKO table)
    Is there any possibility to get that posting date history ....

    You can have multiple receipts against a PO schedule line, but this extractor is not meant to go to that level of granularity.  Please try to use 2lis_02_sgr instead which provides goods receipts per PO schedule line.

  • No goods-receipt-based invoice verification

    I need some guidance on a new process.
    We are a north american company.
    1- We create a PO to China and we unchecked the GR based IV flag
    2- we send it...
    3- When the stock is delivered to the China Port, we receive the invoice from the vendor and pay
    4-6 weeks after we do the GR in our plant.
    At GR time, if the quantity doesn't match what we ordered or paid, is there a way to control that?
    What is the standard process to deal with quantity variance when the invoice is already paid?
    Thank you!

    hi Luc,
    Quantity differences between goods receipt and invoice receipt for a purchase order result in a balance on the GR/IR clearing account.
    If the quantity invoiced is larger than the quantity received, the system then expects further goods receipts for this purchase order to clear the balance.
    If the quantity received is larger than the quantity invoiced, the system then expects further invoices for this purchase order to clear the balance.
    You can also clear differences for delivery costs.
    If no more goods or invoices are to be received, you must clear the balance manually.
    This can be done in different ways:
    You can return the extra goods to the vendor.
    You can cancel the invoice and post a corrected invoice or a credit memo for the surplus posted quantity.
    You can clear the GR/IR clearing account manually.
    Hope this Clear.
    Anil patreddy

  • Variance Journal Appear in Reversal Goods Receipt of CO Production Order

    Good afternoon
    Currently we face a problem that variance journal appear when doing Reversal Goods Receipt (MBST) of CO Production Order.
    But the variance journal appear after we reverse goods receipt for the second time, third time, and so on.
    No problem for the first time cancellation.
    Here is the example:
    Step 1. We do the Goods Receipt on CO Production Order #1
    Journal
         Inventory (Db)                       36000
              COGM Allocation (Cr)                  36000
    Step 2. We do the Goods Receipt Reversal on CO Production Order #1 (with reference to Step 1)
    Journal
         COGM Allocation (Db)          36000
              Inventory (Cr)                               36000
    Step 3. We do the Goods Receipt again on CO Production Order #1
    Journal
         Inventory (Db)                      36000
              COGM Allocation (Cr)                  36000
    Step 4 (Problem). We do the Goods Receipt Reversal again on CO Production Order #1 (with reference to Step 3)
    Journal
              Inventory (Cr)                                   36000
         COGM Allocation (Db)         54000
              Purchase Price Variant (Cr)              18000
    Why Variance appear in Step 4 ? Is there any mistake ?
    Note:
    *We use Price Control "V" for this material
    *No Goods Issue were made
    *No Settlement Process were made
    *Only this 4 transaction for this CO Production Order
    Thanks in advance for your help

    Done... Closed... Please refer to SAP Notes 1666871.
    Thx...

  • Good receipt without Invoice

    Hi all
    Let me know about Report for Goods receipt without Invoice for Purchase order? ie. PO pending for Invoice?
    If anybody a report, pls send it to me. I have used 101-102, 105-106 movement types?
    So any one send that reports?

    Hi Muthu
    I am sending you one source code regarding the Goods receipt without invoice.
    Pls reward pts if help.
    Regards
    Deepanker.
    FUNCTION zrfc_vcs_get_goodsreceipt.
    *& Program Name    : ZRFC_VCS_GET_GOODSRECEIPT                        *
    *& Title           : Function Module for getting the GOODSRECEIPT     *
    *&                     Details                                        *
    *& Author          : M.Jayasree                                         *
    *& Create Date     : 21/03/2007                                       *
    *& Logical DB      : None                                             *
    *& Program Type    : FM                                               *
    *& SAP Release     : 4.6                                              *
    *& Description     : This is a program used for retrieving the        *
    *&                     GOODSRECEIPT Details.                          *
    *& REVISION LOG                                                       *
    *& LOG#               DATE                   AUTHOR                   *
    *& 0000               21/03/2007            Jayasree.M                *
                                 Tables                                  *
    TABLES : mkpf,komv,mseg.
                            Data declarations                            *
      DATA: lv_suc_date       TYPE d,
            lv_suc_time       TYPE t,
            lv_fileloc        TYPE char40,
            lv_filename       TYPE char40,
            lv_date           TYPE d,
            lv_time           TYPE t,
            lv_filepath       TYPE string,
            lv_error          TYPE char50,
            lv_fileloc1       TYPE char20,
            lv_filename1      TYPE char40,
            lv_filepath1      TYPE string,
            lv_value          TYPE zvcsconfig-zvalue,
            lv_value_h        TYPE zvcsconfig-zvalue,
            lv_value1         TYPE zvcsconfig-zvalue,
            lv_fileloc_d      TYPE char40,
            lv_filename_d     TYPE char40,
            lv_filepath_d     TYPE string,
            lv_value_d        TYPE zvcsconfig-zvalue,
            lv_fileloc_d1     TYPE char40,
            lv_filename_d1    TYPE char40,
            lv_filepath_d1    TYPE string,
            lv_value_d1       TYPE zvcsconfig-zvalue,
            lv_taxamt         TYPE bseg-wrbtr,
            lv_elikz          TYPE mseg-elikz,
            lv_waers          TYPE mseg-waers,
            lv_emlif          TYPE mseg-emlif,
            lv_dmbtr          TYPE mseg-dmbtr,
            lv_vkwrt          TYPE mseg-vkwrt,
            lv_menge_acc      TYPE mseg-menge,
            lv_ebeln          TYPE ebeln,
            lv_lifnr          TYPE ekko-lifnr,
            lv_wkurs          TYPE ekko-wkurs,
            lv_ekgrp          TYPE ekko-ekgrp,
            lv_bsart          TYPE ekko-bsart,
            lv_inco1          TYPE ekko-inco1,
            lv_land1          TYPE lfa1-land1,
            lv_eknam          TYPE eknam,
            lv_knumv           TYPE ekko-knumv,
            lv_lifnr_t        TYPE komv-lifnr,
            lv_kwert          TYPE kwert,
            lv_changenr       TYPE cdchangenr,
            lv_flag           TYPE c,
            lv_sum_a          TYPE kwert,
            lv_sum_a1         TYPE kwert,
            lv_sum_a1_a       TYPE kwert,
            lv_sum_a_a        TYPE kwert,
            lv_count          TYPE n,
            lv_wempf          TYPE wempf,
            lv_add            TYPE kwert,
            lv_werks_p        TYPE werks_d,
            lv_maktx          TYPE maktx,
            lv_wemng          TYPE wemng,
            lv_ebelp_b        TYPE ebelp,
            lv_erfmg_b        TYPE erfmg,
            lv_menge_r        TYPE menge_d,
            lv_remng          TYPE remng,
            lv_rewrt          TYPE rewrt,
            lv_wrbtr          TYPE wrbtr,
            lv_mwskz          TYPE mwskz,
            lv_wmwst          TYPE wmwst,
            lv_lifnr_sc       TYPE lifnr,
            lv_pstyp          TYPE pstyp,
            lv_menge          TYPE menge_d,
            lv_budat          TYPE budat,
            lv_waers_bc       TYPE waers,
            lv_netwr_tbv      TYPE netwr,
            lv_wrbtr_ai       TYPE wrbtr,
            lv_sum            TYPE rewrt,
            lv_netpr_bv       TYPE netpr,
            lv_etenr          TYPE etenr,
            lv_bstyp          TYPE bstyp,
            lv_grtxt          TYPE grtxt,
            lv_ebelp          TYPE ebelp,
            lv_basicv         TYPE netwr,
            lv_smbln          TYPE mseg-smbln,
            lv_waers_c        TYPE ekko-waers,
            lv_kwert_a        TYPE konv-kwert,
            lv_knumv_a        TYPE ekko-knumv,
            lv_knumv_a_a      TYPE ekko-knumv,
            lv_netwr_a        TYPE ekpo-netwr,
            lv_netwr_a_a      TYPE ekpo-netwr,
            lv_kwert_a1       TYPE konv-kwert,
            lv_knumv_a1       TYPE ekko-knumv,
            lv_netwr_a1       TYPE ekpo-netwr,
            lv_netwr_a1_a     TYPE ekpo-netwr,
            lv_knumv_a1_a     TYPE ekko-knumv,
            lv_sum_b          TYPE konv-kwert,
            lv_fwnav          TYPE bset-fwste,
            lv_sum_b_a        TYPE konv-kwert,
            lv_netpr_a        TYPE ekpo-netpr,
            lv_erfmg_add      TYPE mseg-erfmg,
            lv_erfmg_add_a    TYPE mseg-erfmg,
            lv_netpr_a_a      TYPE ekpo-netpr,
            lv_netpr_a1       TYPE ekpo-netpr,
            lv_netpr_a1_a     TYPE ekpo-netpr,
            lv_erfmg_add1     TYPE mseg-erfmg,
            lv_erfmg_add1_a   TYPE mseg-erfmg,
            lv_menge_inv      TYPE menge_d,
            lv_wrbtr_inv      TYPE wrbtr,
            lv_netpr_tax      TYPE netpr,
            lv_kwert_total    TYPE konv-kwert,
            lv_kwert_total_a  TYPE konv-kwert,
            lv_kwert_total_r  TYPE konv-kwert,
            lv_kwert_total_r_a   TYPE konv-kwert,
            lv_bukrs_tax      TYPE bukrs,
            lv_waers_tax      TYPE waers,
            lv_erfmg_ret      TYPE mseg-erfmg,
            lv_server         TYPE tsle4-server,
            lv_bwart_rev      TYPE mseg-bwart,
            lv_erfmg_rev1     TYPE mseg-erfmg,
            lv_bukrs          TYPE bukrs,
            lv_land1_t        TYPE land1,
            lv_kalsm          TYPE kalsm,
            lv_text1          TYPE text1,
            lv_netpr_tax1     TYPE netpr,
            lv_netpr_tax1_r   TYPE netpr,
            lv_mwskz_r        TYPE mwskz,
            lv_mwskz_tax      TYPE mwskz,
            lv_taxamt_t       TYPE bseg-wrbtr,
            lv_tax_tot        TYPE netpr,
            lv_fwnav_tax      TYPE bset-fwste,
            lv_taxamt_t_r     TYPE bseg-wrbtr,
            lv_tax_tot_r      TYPE netpr,
            lv_fwnav_tax_r    TYPE bset-fwste,
            lv_bukrs_tax_r    TYPE bukrs,
            lv_waers_tax_r    TYPE waers,
            lv_mblnr_rev      TYPE mblnr,
            lv_erfmg_rej      TYPE erfmg,
            lv_budat_m        TYPE budat,
            lv_bldat_m        TYPE bldat,
            lv_year1(4),
            lv_mth1(2),
            lv_day1(2),
            lv_base           TYPE waers,
            lv_base_t         TYPE waers,
            lv_waers_t        TYPE waers,
            lv_wkurs_b        TYPE wkurs,
            lv_stblg_re       TYPE stblg,
            lv_belnr          TYPE belnr_d.
                            Structures                                   *
    Structures for storing the output HEADER file
      TYPES: BEGIN OF t_fintab1,
                mblnr(30)     TYPE c,   "GRNumber
                ebeln(20)     TYPE c,   "PONumber
                changenr(38)  TYPE c,   "POAmendmentNumber
                lifnr(22)     TYPE c,   "SupplierCode     
                adr_code(20)  TYPE c,   "AddressCode
                plt_code(22)  TYPE c,   "PlantCode
                land1(3)      TYPE c,   "CountryCode
                elikz(25)     TYPE c,   "GoodsReceiptStatus     
                waers(3)      TYPE c,   "CurrencyCode     
                wkurs(34)     TYPE c,   "ExchRateValue
                server(100)   TYPE c,   "ERPSource
                ekgrp(22)     TYPE c,   "BuyerCode     
                eknam(240)    TYPE c,   "BuyerName     
                bldat(20)     TYPE c,   "GoodsReceiptDate     
                bsart(25)     TYPE c,   "DocType     
                bsart_c(50)   TYPE c,   "ContractType
                asnno(8)      TYPE c,   "ASNNo
                asndate(20)   TYPE c,   "ASNDate
                xblnr(16)     TYPE c,   "DCNo     
                dc_date(20)   TYPE c,   "DCDate
                bktxt(25)     TYPE c,   "PreGRNo
                pre_date(20)  TYPE c,   "PreGRDate
                emlif(22)     TYPE c,   "ReceiverCode
                re_name(240)  TYPE c,   "ReceiverName     
                lifnr_t(10)   TYPE c,   "ThreePLCode
                inco1(8)      TYPE c,   "CommercialTerms
                dmbtr(34)     TYPE c,   "TotalValue     
                vkwrt(34)     TYPE c,   "TotalBasicValue     
                kwert(34)     TYPE c,   "TotalAdditionalCharges
                base(3)       TYPE c,   "BaseCurrencyCode     
                   END OF t_fintab1.
    Structures for storing the output HEADER for STATUS file
      TYPES: BEGIN OF t_fintab_s,
                mblnr(30)     TYPE c,   "GRNumber
                ebeln(20)     TYPE c,   "PONumber
                changenr(38)  TYPE c,   "POAmendmentNumber
                lifnr(22)     TYPE c,   "SupplierCode     
                adr_code(20)  TYPE c,   "AddressCode
                plt_code(22)  TYPE c,   "PlantCode
                land1(3)      TYPE c,   "CountryCode
                elikz(25)     TYPE c,   "GoodsReceiptStatus     
                waers(3)      TYPE c,   "CurrencyCode     
                wkurs(34)     TYPE c,   "ExchRateValue
                server(100)   TYPE c,   "ERPSource
                ekgrp(22)     TYPE c,   "BuyerCode     
                eknam(240)    TYPE c,   "BuyerName     
                bldat(20)     TYPE c,   "GoodsReceiptDate     
                bsart(25)     TYPE c,   "DocType     
                bsart_c(50)   TYPE c,   "ContractType
                asnno(8)      TYPE c,   "ASNNo
                asndate(20)   TYPE c,   "ASNDate
                xblnr(16)     TYPE c,   "DCNo     
                dc_date(20)   TYPE c,   "DCDate
                bktxt(25)     TYPE c,   "PreGRNo
                pre_date(20)  TYPE c,   "PreGRDate
                emlif(22)     TYPE c,   "ReceiverCode
                re_name(240)  TYPE c,   "ReceiverName     
                lifnr_t(10)   TYPE c,   "ThreePLCode
                inco1(8)      TYPE c,   "CommercialTerms
                dmbtr(34)     TYPE c,   "TotalValue     
                vkwrt(34)     TYPE c,   "TotalBasicValue     
                kwert(34)     TYPE c,   "TotalAdditionalCharges
                smbln   TYPE mseg-smbln,"For reversal status
             END OF t_fintab_s.
    Structures for storing the output DETAIL file
      TYPES: BEGIN OF t_fintab2,
                zeile(22)     TYPE c,   "GRLineNumber
              mblnr(30)     TYPE c,   "GRNumber
                server(100)   TYPE c,   "ERPSource       
                ebelp(38)     TYPE c,   "POLineNumber
                ebeln(20)     TYPE c,   "PONumber
                changenr(38)  TYPE c,   "POAmendmentNumber
                scheculenumber(38) TYPE c, "ScheduleNumber
                meins(25)     TYPE c,   "UOM
                lgort(22)     TYPE c,   "WarehouseCode
                waers(3)      TYPE c,   "Currency Code
                matnr(40)     TYPE c,       "PartNumber
                 maktx(240)    TYPE c,   "PartDescription           
              kostl(22)     TYPE c,   "CostCenterCode
              bukrs(15)     TYPE c,       "CompanyCode
                menge_i(22)   TYPE c,   "InspectedQuantity
                wemng(22)     TYPE c,   "GRRecievedQuantity     
                menge_a(22)   TYPE c,   "GRAcceptedQuantity          
              menge_g(22)   TYPE c,   "GRRejectedQuantity
                grrework(22)  TYPE c,       "GRReworkQuantity               
              menge_r(22)   TYPE c,       "GRReturnedQuantity
                grund(25)     TYPE c,   "RejnReason     
                remng(22)     TYPE c,   "QuantityInvoiced
                rewrt(34)     TYPE c,       "AmountInvoiced
                wrbtr(34)     TYPE c,       "AmountPaid
                mwskz_t(100)  TYPE c,   "TaxCode
                wmwst_w(34)   TYPE c,   "TaxValue
                lifnr_sc(22)  TYPE c,   "SupplierCode
                adr_code(20)  TYPE c,       "AddressCode     
                taxdiscount(34) TYPE c, "TaxChargeDiscount
                mwskz_v(22)   TYPE c,   "VATCode
                wmwst_v(34)   TYPE c,   "VATValue
                vatoption(1)  TYPE c,   "VATOption
                kwert_i(34)   TYPE c,   "InspectionCost
                pstyp(25)     TYPE c,   "IssueType
                pendingschdqty(22) TYPE c, "PendingSchdQuantity
                menge_o(22)   TYPE c,   "POOrderQty
                erfmg(22)     TYPE c,   "MovedQty
                tobemovedqty(22)   TYPE c, "TobeMovedQty
                balanceqty(22)     TYPE c, "BalanceQty
                netpr_bv(34)  TYPE c,   "BasicValue
                kwert_a(34)   TYPE c,   "AdditionalCharges
                budat_i(20)   TYPE c,   "InspectionDate
                budat_m(20)   TYPE c,   "MovedDate
                elikz(25)     TYPE c,   "GRItemStatus
                budat_g(20)   TYPE c,   "GRRecdDate
               END OF t_fintab2.
    Structures for storing the MKPF
      TYPES: BEGIN OF t_mkpf,
                 mblnr   TYPE mkpf-mblnr,
                 budat   TYPE mkpf-budat,
                 xblnr   TYPE mkpf-xblnr,
                 bldat   TYPE mkpf-bldat,
                END OF t_mkpf.
    Structures for storing the MSEG
      TYPES: BEGIN OF t_mseg,
                matnr   TYPE mseg-matnr,
                zeile   TYPE mblpo,
                menge   TYPE menge_d,
                meins   TYPE mseg-meins,
                lgort   TYPE mseg-lgort,
                mblnr   TYPE mseg-mblnr,
                bukrs   TYPE mseg-bukrs,
                ebeln   TYPE bstnr,
                ebelp   TYPE ekpo-ebelp,
                kostl   TYPE mseg-kostl,
                waers   TYPE mseg-waers,
                erfmg   TYPE mseg-erfmg,
                vkwrt   TYPE mseg-vkwrt,
                elikz   TYPE mseg-elikz,
                insmk   TYPE mseg-insmk,
                bwart   TYPE mseg-bwart,
                grund   TYPE mseg-grund,
             END OF t_mseg.
    Structures for storing the log file
      TYPES: BEGIN OF t_logfile,
              desc    TYPE char50,
               END OF t_logfile.
    Structures for storing the RSEG file
      TYPES: BEGIN OF t_rseg,
              menge    TYPE menge_d,
              wrbtr    TYPE wrbtr,
             END OF t_rseg.
      TYPES: BEGIN OF t_add,
              ebeln    TYPE ebeln,
             END OF t_add.
      TYPES: BEGIN OF t_add1,
              ebeln    TYPE ebeln,
              ebelp    TYPE ebelp,
             END OF t_add1.
      TYPES: BEGIN OF t_total,
              dmbtr    TYPE dmbtr,
             END OF t_total.
      TYPES: BEGIN OF t_total1,
              dmbtr    TYPE dmbtr,
             END OF t_total1.
      TYPES: BEGIN OF t_basictotal,
              erfmg    TYPE erfmg,
             END OF t_basictotal.
      TYPES: BEGIN OF t_basic,
              ebeln    TYPE ebeln,
              ebelp    TYPE ebelp,
              erfmg    TYPE erfmg,
             END OF t_basic.
      TYPES: BEGIN OF t_zcond,
              zcond1   TYPE kscha,
              zcond2   TYPE kscha,
              zcond3   TYPE kscha,
              zcond4   TYPE kscha,
              zcond5   TYPE kscha,
              zcond6   TYPE kscha,
              zcond7   TYPE kscha,
              zcond8   TYPE kscha,
              zcond9   TYPE kscha,
              zcond10  TYPE kscha,
             END OF t_zcond.
      TYPES: BEGIN OF t_add_k,
              kwert    TYPE konv-kwert,
             END OF t_add_k.
      TYPES: BEGIN OF t_tax,
              ebeln   TYPE mseg-ebeln,
              ebelp   TYPE mseg-ebelp,
              menge   TYPE mseg-menge,
             END OF t_tax.
      TYPES: BEGIN OF t_mseg_m,
              mblnr   TYPE mblnr,
              elikz   TYPE elikz,
              wempf   TYPE wempf,
              ebeln   TYPE ebeln,
              ebelp   TYPE ebelp,
              werks   TYPE werks,
              erfmg   TYPE erfmg,
              bwart   TYPE bwart,
              bukrs   TYPE bukrs,
              lfbnr   TYPE lfbnr,
             END OF t_mseg_m.
      TYPES: BEGIN OF t_erfmg,
              erfmg   TYPE erfmg,
             END OF t_erfmg.
                              Internal tables                            *
      DATA: i_zrfcinfo    LIKE zrfcinfo OCCURS 0 WITH HEADER LINE,
            i_fintab1     TYPE TABLE OF t_fintab1 WITH HEADER LINE,
            i_fintab_s    TYPE TABLE OF t_fintab_s WITH HEADER LINE,
            i_fintab2     TYPE TABLE OF t_fintab2 WITH HEADER LINE,
            i_mkpf        TYPE TABLE OF t_mkpf WITH HEADER LINE,
            i_mseg        TYPE TABLE OF t_mseg WITH HEADER LINE,
            i_rseg        TYPE TABLE OF t_rseg WITH HEADER LINE,
            i_total       TYPE TABLE OF t_total WITH HEADER LINE,
            i_basictotal  TYPE TABLE OF t_basictotal WITH HEADER LINE,
            i_erfmg       TYPE TABLE OF t_erfmg WITH HEADER LINE,
            i_erfmg1      TYPE TABLE OF t_erfmg WITH HEADER LINE,
            i_basic       TYPE TABLE OF t_basic WITH HEADER LINE,
            i_total1      TYPE TABLE OF t_total1 WITH HEADER LINE,
            i_tax         TYPE TABLE OF t_tax WITH HEADER LINE,
            i_tax_r       TYPE TABLE OF t_tax WITH HEADER LINE,
            i_mseg_m      TYPE TABLE OF t_mseg_m WITH HEADER LINE,
            i_add         TYPE TABLE OF t_add1 WITH HEADER LINE,
            i_add_a       TYPE TABLE OF t_add1 WITH HEADER LINE,
            i_add1        TYPE TABLE OF t_add1 WITH HEADER LINE,
            i_zcond       TYPE TABLE OF t_zcond  WITH HEADER LINE,
            i_zcond_r     TYPE TABLE OF t_zcond  WITH HEADER LINE,
            i_add_cond    TYPE TABLE OF t_add_k  WITH HEADER LINE,
            i_add_cond_r  TYPE TABLE OF t_add_k    WITH HEADER LINE,
            i_add_cond_r_a  TYPE TABLE OF t_add_k    WITH HEADER LINE,
            i_zcond_a     TYPE TABLE OF t_zcond  WITH HEADER LINE,
            i_add_cond_a  TYPE TABLE OF t_add_k  WITH HEADER LINE,
            i_add1_a      TYPE TABLE OF t_add1 WITH HEADER LINE,
            i_zcond_r_a   TYPE TABLE OF t_zcond  WITH HEADER LINE,
            i_logfile     TYPE TABLE OF t_logfile WITH HEADER LINE,
            i_fintab1_h   TYPE TABLE OF t_fintab1 WITH HEADER LINE,
            i_fintab2_h   TYPE TABLE OF t_fintab2 WITH HEADER LINE.
      DATA: BEGIN OF i_mwdat OCCURS 0.
              INCLUDE STRUCTURE rtax1u15.
      DATA: END OF i_mwdat.
      DATA: BEGIN OF i_mwdat_t OCCURS 0.
              INCLUDE STRUCTURE rtax1u15.
      DATA: END OF i_mwdat_t.
      DATA: BEGIN OF i_mwdat_t_r OCCURS 0.
              INCLUDE STRUCTURE rtax1u15.
      DATA: END OF i_mwdat_t_r.
                             Work areas                                  *
      DATA : wa_zrfcinfo TYPE zrfcinfo.
    Get the last execution date/time from ZTABLE
    SELECT *
           FROM zrfcinfo
           INTO TABLE i_zrfcinfo
           WHERE
             name = 'ZRFC_VCS_GET_GOODSRECEIPT' AND
             status = '1'.
    DESCRIBE TABLE i_zrfcinfo LINES sy-tabix.
    Sort the table for retrieving the latest date/time
    SORT i_zrfcinfo BY exc_date DESCENDING exc_time  DESCENDING.
    READ TABLE i_zrfcinfo INDEX 1.
    IF sy-subrc = 0.
       lv_suc_date = i_zrfcinfo-exc_date.
       lv_suc_time = i_zrfcinfo-exc_time.
    ENDIF.
    Fetch the updated records from the table MKPF between the latest
    *date/time
    lv_suc_date = '20070529'.
      SELECT mblnr
             budat
             xblnr
             bldat
             FROM mkpf
             INTO TABLE i_mkpf
             WHERE
             cpudt GE lv_suc_date AND
             cputm GE lv_suc_time.
    HEADER
    For multiple PO
      IF NOT i_mkpf[] IS INITIAL.
        SELECT mblnr
               elikz
               wempf
               ebeln
               ebelp
               werks
               erfmg
               bwart
               bukrs
               lfbnr
               FROM mseg
               INTO TABLE i_mseg_m
               FOR ALL ENTRIES IN i_mkpf
               WHERE mblnr = i_mkpf-mblnr
               and bwart NE '543'.
        IF NOT lv_suc_date IS INITIAL.
          SELECT mblnr
                 elikz
                 wempf
                 ebeln
                 ebelp
                 werks
                 erfmg
                 bwart
                 bukrs
                 FROM mseg
                 INTO TABLE i_mseg_m
                 FOR ALL ENTRIES IN i_mseg_m
                 WHERE mblnr = i_mseg_m-lfbnr
        ENDIF.
      ENDIF.
    For Selecting the ERP Source
      SELECT SINGLE server INTO lv_server FROM tsle4.
    Appending all the fields  to the output HEADER file layout
      LOOP AT i_mseg_m.
        MOVE-CORRESPONDING i_mseg_m TO i_fintab1.
        CONCATENATE i_mseg_m-mblnr '-' i_mseg_m-ebeln '-' i_mseg_m-ebelp
    INTO i_fintab1-mblnr.
        CLEAR : lv_budat_m , lv_bldat_m .
    For GR Date
        SELECT SINGLE budat bldat INTO (lv_budat_m , lv_bldat_m) FROM mkpf
        WHERE   mblnr = i_mseg_m-mblnr.
        IF sy-subrc = 0.
          i_fintab1-bldat = lv_budat_m.
          lv_year1 = lv_bldat_m+0(4).
          lv_mth1  = lv_bldat_m+4(2).
          lv_day1  = lv_bldat_m+6(2).
        CONCATENATE lv_day1 '/' lv_mth1 '/' lv_year1 INTO i_fintab1-dc_date.
        ENDIF.
    Retrieve the base currency code
        CLEAR lv_base.
        SELECT SINGLE waers INTO lv_base FROM t001 WHERE bukrs =
      i_mseg_m-bukrs.
             IF sy-subrc = 0.
        i_fintab1-base = lv_base.
      ENDIF.
    For the Receiver Name
      i_fintab1-re_name = i_mseg_m-wempf.
    For the Plant Code
      i_fintab1-plt_code = i_mseg_m-werks.
    For the ERP Source
      i_fintab1-server = lv_server.
    For The Address Code
      i_fintab1-adr_code = 'A1'.
    For the Quantity ( ebeln - PO number , Elelp -  PO line number,
    erfmg - Quantity, bwart - Movement type ).
      SELECT ebeln ebelp erfmg INTO TABLE i_basic FROM mseg WHERE mblnr =
           i_mseg_m-mblnr AND bwart NE '543' AND ebeln = i_mseg_m-ebeln AND
           ebelp = i_mseg_m-ebelp.
      CLEAR lv_basicv.
      LOOP AT i_basic.
    Retrieve from table EKPO (Po LineItem) for total basic value( netpr
    - Net price )
        SELECT SINGLE netpr
               INTO lv_netwr_tbv
               FROM ekpo WHERE ebeln = i_basic-ebeln
                AND ebelp = i_basic-ebelp.
        IF sy-subrc = 0.
          lv_basicv = lv_basicv + i_basic-erfmg * lv_netwr_tbv.
        ENDIF.
    Retrieve the basic value for Reversal
        SELECT erfmg INTO TABLE i_basictotal FROM mseg
        WHERE ( bwart = '122' OR bwart = '124' OR bwart = '161' )
        AND lfbnr = i_mseg_m-mblnr AND ebelp = i_basic-ebelp
        AND ebeln = i_basic-ebeln.
        LOOP AT i_basictotal.
          lv_basicv = lv_basicv - ( i_basictotal-erfmg * lv_netwr_tbv ).
        ENDLOOP.
      ENDLOOP.
    lv_basicv move to total basic value i.e i_fintab1-vkwrt
      MOVE lv_basicv TO i_fintab1-vkwrt.
      CONDENSE i_fintab1-vkwrt NO-GAPS.
    Retrieve the total value from table MSEG ( GR Line item )
      SELECT dmbtr INTO TABLE i_total FROM mseg
      WHERE mblnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp.
      LOOP AT i_total.
        lv_dmbtr = lv_dmbtr + i_total-dmbtr.
      ENDLOOP.
    Calculating the total value for reversal
      SELECT dmbtr INTO TABLE i_total1 FROM mseg
      WHERE  ( bwart = '122' OR bwart = '124' OR bwart = '161' )
      AND lfbnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp .
      LOOP AT i_total1.
        lv_dmbtr = lv_dmbtr - i_total1-dmbtr.
      ENDLOOP.
    For getting the exchange Rate ( wkurs - Exchange Rate )
      SELECT SINGLE wkurs INTO lv_wkurs_b FROM ekko
      WHERE ebeln = i_mseg_m-ebeln .
      IF sy-subrc = 0.
        lv_dmbtr = lv_dmbtr / lv_wkurs_b.
      ENDIF.
    Calculate the tax
      CLEAR : i_tax, lv_netpr_tax1 , lv_mwskz, lv_taxamt_t , lv_tax_tot ,
              lv_fwnav_tax, lv_bukrs_tax , lv_waers_tax.
    *****( menge - Quantity ).
      SELECT ebeln ebelp menge FROM mseg INTO TABLE i_tax
      WHERE mblnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp.
      LOOP AT i_tax.
    ( bukrs - Company Code , waers - Currency Key ).
        SELECT SINGLE bukrs waers INTO (lv_bukrs_tax , lv_waers_tax)
        FROM ekko WHERE ebeln = i_tax-ebeln.
    *****( netpr - net price , mwskz - tax on sales).
        SELECT SINGLE netpr mwskz INTO (lv_netpr_tax1 , lv_mwskz)
        FROM ekpo WHERE ebeln = i_tax-ebeln AND ebelp = i_tax-ebelp.
        IF sy-subrc = 0.
          lv_taxamt_t = i_tax-menge * lv_netpr_tax1.
        ENDIF.
        IF NOT lv_mwskz IS INITIAL.
          CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
               EXPORTING
                    i_bukrs = lv_bukrs_tax
                    i_mwskz = lv_mwskz
                    i_waers = lv_waers_tax
                    i_wrbtr = lv_taxamt_t
               IMPORTING
                    e_fwnav = lv_fwnav_tax
               TABLES
                    t_mwdat = i_mwdat_t.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
        lv_tax_tot = lv_tax_tot + lv_fwnav_tax.
        CLEAR lv_fwnav_tax.
      ENDLOOP.
    For reversal
      CLEAR : i_tax_r, lv_netpr_tax1_r, lv_mwskz_r, lv_taxamt_t_r,
              lv_tax_tot_r, lv_fwnav_tax_r, lv_bukrs_tax_r, lv_waers_tax_r
      SELECT  ebeln ebelp menge FROM mseg
      INTO TABLE i_tax_r WHERE ( bwart = '122' OR bwart = '124' OR bwart =
    '161' )
      AND lfbnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp.
      LOOP AT i_tax_r.
        SELECT SINGLE bukrs waers INTO (lv_bukrs_tax_r , lv_waers_tax_r)
        FROM ekko WHERE ebeln = i_tax_r-ebeln.
        SELECT SINGLE netpr mwskz INTO (lv_netpr_tax1_r , lv_mwskz_r)
        FROM ekpo WHERE ebeln = i_tax_r-ebeln AND ebelp = i_tax_r-ebelp.
        IF sy-subrc = 0.
          lv_taxamt_t_r = i_tax_r-menge * lv_netpr_tax1_r.
        ENDIF.
        IF NOT lv_mwskz_r IS INITIAL.
          CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
               EXPORTING
                    i_bukrs = lv_bukrs_tax_r
                    i_mwskz = lv_mwskz_r
                    i_waers = lv_waers_tax_r
                    i_wrbtr = lv_taxamt_t_r
               IMPORTING
                    e_fwnav = lv_fwnav_tax_r
               TABLES
                    t_mwdat = i_mwdat_t_r.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
        lv_tax_tot_r = lv_tax_tot_r + lv_fwnav_tax_r.
        CLEAR lv_fwnav_tax_r.
      ENDLOOP.
    Finally the Total value is moving to i_fintab-dmbtr
      i_fintab1-dmbtr = lv_dmbtr + lv_tax_tot - lv_tax_tot_r.
      CONDENSE i_fintab1-dmbtr NO-GAPS.
      IF i_fintab1-dmbtr = ' '.
        i_fintab1-dmbtr = '0.0000'.
      ENDIF.
      IF i_fintab1-vkwrt = ' '.
        i_fintab1-vkwrt = '0.0000'.
      ENDIF.
      SELECT SINGLE mblnr INTO lv_mblnr_rev FROM mseg
      WHERE ( bwart = '102' OR bwart = '104' OR  bwart = '106' )
      AND lfbnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp =  i_mseg_m-ebelp.
      IF sy-subrc = 0.
        i_fintab1-elikz = 'Reversed'.
      ELSEIF i_fintab1-elikz = 'X'.
        i_fintab1-elikz = 'Completed'.
      ELSEIF i_fintab1-elikz = ' '.
        i_fintab1-elikz = 'NotCompleted'.
      ENDIF.
    Retrieve from table EKKO for Supplier Code , Exchange Rate,
    Purchasing Group, Purchasing Document Type,
      SELECT SINGLE lifnr
                     wkurs
                     ekgrp
                     bsart
                     inco1
                     knumv
                     waers
             INTO (lv_lifnr , lv_wkurs, lv_ekgrp , lv_bsart ,
                   lv_inco1 , lv_knumv , lv_waers_c)
             FROM ekko
             WHERE ebeln = i_mseg_m-ebeln.
      IF sy-subrc = 0.
        i_fintab1-lifnr = lv_lifnr.
        i_fintab1-ekgrp = lv_ekgrp.
        i_fintab1-waers = lv_waers_c.
        i_fintab1-bsart = lv_bsart.
        i_fintab1-inco1 = lv_inco1.
        i_fintab1-bsart_c = lv_bsart.
        MOVE lv_wkurs TO i_fintab1-wkurs.
        CONDENSE i_fintab1-wkurs NO-GAPS.
      ENDIF.
    Retreive for Land
      SELECT SINGLE land1 INTO lv_land1 FROM lfa1 WHERE lifnr = lv_lifnr .
      IF sy-subrc = 0.
        i_fintab1-land1 = lv_land1.
      ENDIF.
    Retrieve from table T024 for BuyerCode
      SELECT SINGLE  eknam INTO lv_eknam FROM t024 WHERE ekgrp = lv_ekgrp.
      IF sy-subrc = 0.
        i_fintab1-eknam = lv_eknam.
      ENDIF.
    Retrieve from table KONV for AdditionalCharges
    Retrieve PO Number, PO Line Number from GR Line Item
      SELECT ebeln ebelp INTO TABLE i_add FROM mseg
      WHERE mblnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp.
      DELETE ADJACENT DUPLICATES FROM i_add COMPARING ebeln ebelp .
      LOOP AT i_add.
    ********( knumv - number of document condition )
        SELECT SINGLE knumv INTO lv_knumv_a FROM ekko
        WHERE ebeln = i_add-ebeln.
        IF sy-subrc = 0.
          CLEAR : i_zcond,i_add_cond[], lv_kwert_total.
          SELECT zcond1
                 zcond2
                 zcond3
                 zcond4
                 zcond5
                 zcond6
                 zcond7
                 zcond8
                 zcond9
                 zcond10
          FROM zvcs_con_config
          INTO TABLE i_zcond
          WHERE ( zid = '001' ) OR
                ( zid = '002' ) OR
                ( zid = '003' ) OR
                ( zid = '004' ) OR
                ( zid = '005' ).
          LOOP AT i_zcond.
            SELECT kwert APPENDING TABLE i_add_cond FROM konv
            WHERE knumv = lv_knumv_a AND kposn = i_add-ebelp
            AND   ( ( kschl EQ i_zcond-zcond1 ) OR
                    ( kschl EQ i_zcond-zcond2 ) OR
                    ( kschl EQ i_zcond-zcond3 ) OR
                    ( kschl EQ i_zcond-zcond4 ) OR
                    ( kschl EQ i_zcond-zcond5 ) OR
                    ( kschl EQ i_zcond-zcond6 ) OR
                    ( kschl EQ i_zcond-zcond7 ) OR
                    ( kschl EQ i_zcond-zcond8 ) OR
                    ( kschl EQ i_zcond-zcond9 ) OR
                    ( kschl EQ i_zcond-zcond10 ) ).
          ENDLOOP.
          CLEAR : lv_kwert_total.
          LOOP AT i_add_cond.
            lv_kwert_total = lv_kwert_total + i_add_cond-kwert.
          ENDLOOP.
          CLEAR : lv_sum_a.
          IF sy-subrc = 0.
            lv_sum_a =  lv_sum_a  + lv_kwert_total.
            SELECT SINGLE netwr netpr INTO (lv_netwr_a , lv_netpr_a)
            FROM ekpo WHERE ebeln = i_add-ebeln AND ebelp = i_add-ebelp.
            SELECT SINGLE erfmg INTO lv_erfmg_add FROM mseg
            WHERE mblnr = i_mseg_m-mblnr AND ebeln = i_add-ebeln
            AND ebelp  = i_add-ebelp.
            lv_sum_b = lv_sum_b + ( lv_erfmg_add * lv_netpr_a ) *
            lv_sum_a / lv_netwr_a .
          ENDIF.
        ENDIF.
        CLEAR : lv_kwert_a, lv_knumv_a , lv_netwr_a , lv_netpr_a ,
                lv_erfmg_add.
      ENDLOOP.
      CLEAR: lv_sum_a.
    Retrieve the returned
      SELECT ebeln ebelp INTO TABLE i_add1 FROM mseg
      WHERE ( bwart = '122' OR bwart = '124' OR bwart = '161' )
      AND lfbnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
      AND ebelp = i_mseg_m-ebelp.
      DELETE ADJACENT DUPLICATES FROM i_add1 COMPARING ebeln.
      LOOP AT i_add1.
        SELECT SINGLE knumv INTO lv_knumv_a1 FROM ekko
        WHERE ebeln = i_add-ebeln.
        IF sy-subrc = 0.
          CLEAR : i_zcond_r,i_add_cond_r[], lv_kwert_total_r.
          SELECT zcond1
                 zcond2
                 zcond3
                 zcond4
                 zcond5
                 zcond6
                 zcond7
                 zcond8
                 zcond9
                 zcond10
          FROM zvcs_con_config
          INTO TABLE i_zcond_r
          WHERE ( zid = '001' ) OR
                ( zid = '002' ) OR
                ( zid = '003' ) OR
                ( zid = '004' ) OR
                ( zid = '005' ).
          LOOP AT i_zcond_r.
            SELECT kwert APPENDING TABLE i_add_cond_r FROM konv
            WHERE knumv = lv_knumv_a1 AND kposn = i_add1-ebelp
            AND ( ( kschl EQ i_zcond_r-zcond1 ) OR
                  ( kschl EQ i_zcond_r-zcond2 ) OR
                  ( kschl EQ i_zcond_r-zcond3 ) OR
                  ( kschl EQ i_zcond_r-zcond4 ) OR
                  ( kschl EQ i_zcond_r-zcond5 ) OR
                  ( kschl EQ i_zcond_r-zcond6 ) OR
                  ( kschl EQ i_zcond_r-zcond7 ) OR
                  ( kschl EQ i_zcond_r-zcond8 ) OR
                  ( kschl EQ i_zcond_r-zcond9 ) OR
                  ( kschl EQ i_zcond_r-zcond10 ) ).
    append i_add_cond.
          ENDLOOP.
          LOOP AT i_add_cond_r.
            lv_kwert_total_r = lv_kwert_total_r + i_add_cond_r-kwert.
          ENDLOOP.
          IF sy-subrc = 0.
            lv_sum_a1 =  lv_sum_a1  + lv_kwert_total_r .
            SELECT SINGLE netwr netpr INTO (lv_netwr_a1 , lv_netpr_a1)
            FROM ekpo WHERE ebeln = i_add-ebeln.
            CLEAR : i_erfmg.
            SELECT erfmg INTO TABLE i_erfmg FROM mseg
            WHERE ( bwart = '122' OR bwart = '124' OR bwart = '161' )
            AND lfbnr = i_mseg_m-mblnr AND ebeln = i_mseg_m-ebeln
            AND ebelp = i_mseg_m-ebelp.

  • 2LIS_02_SCL: goods receipt and invoice document number

    Hi,
    the BI Content documentation for the [Purchasing Data (Schedule Line Level) (2LIS_02_SCL)|http://help.sap.com/saphelp_nw04/helpdata/en/8d/bc383fe58d5900e10000000a114084/frameset.htm] DataSource reads:
    The DataSource also provides information about the documents that are posted with regard to the purchase order, such as goods receipts and invoices.
    The point is: where are the documents' numbers ?
    When I test the extraction, I get the expected number of records, provided that those records with ROCANCEL=X (cancellation of Data Record) are taken into account.
    For example, for a Purchase Order (PO) Schedule Line that has 3 Goods Receipts (GR) and 1 Invoce (IR), I get:
    - 1 record with BWVORG=1 (SAP BW - Transaction Key) and ROCANCEL blank, for the PO document;
    - 6 records for the 3 GR documents (BWVORG=2);
    - 2 records for the 2 IR documents (BWVORG=3).
    Therefore the DataSource provides the needed level of granularity. Just the field I need is missing, i.e. BELNR!  Is there any trick to get it or the only way out is enhancing the DataSource?
    Thanks, [Davide|https://wiki.sdn.sap.com/wiki/display/profile/Davide+Cavallari]
    Edited by: Davide Cavallari on Jan 18, 2008 5:38 PM

    I think I would choose the option that takes advantage of 3 DataSources:
    - 2LIS_02_SGR, for GR number;
    - 2LIS_06_INV, for IV number;
    - 0FI_GL_4, for document amount, as well as some other informative characteristics, such as document type (useful when the document is an invoice), referred document (the field that contains the supplier's document number), document date, posting date
    The Logistic DataSources would basically provide the link between GR and IV, while the General Ledger DataSource would provide the financial information.
    In fact an analysis for controlling purchase expenditures at a detailed level is required. Not just a simple analysis of expenses for vendor, or even purchase document, but for any financial document posted to the General Ledger. This analysis has sort of a financial perspective. Probably it's not the kind of strategic analysis best suited to BI. It has a more tactical, operational nature. And maybe BI is not the best platform for developing this kind of application.
    Anyway, if you have better ideas or any suggestion on this topic, please feel free to comment!
    Cheers, [Davide|https://wiki.sdn.sap.com/wiki/display/profile/Davide+Cavallari|My wiki profile]
    Edited by: Davide Cavallari on Jan 19, 2008  8:16 PM

  • SUS POs update with Goods Receipts and Invoices Information

    Hi SRM Experts,
    We have a SRM - SUS - R/3 landscape.
    1. We create POs in SRM (extended classic scenario) and transfer them to R/3 (via RFC) and to SUS (via XI – Interfaces PurchaseOrderRequest_Out and PurchaseOrderChangeRequest_Out).
    2. We post Goods Receipts into SRM (or alternatively into R/3).
    3. We post Invoices into R/3.
    Is it possible to update SUS POs with Goods Receipts and Invoices Information?
    If yes, what do we have to do to update this information into SUS POs?
    Thank you very much and kind regards,
    Marco.

    Hi Marco,
    you want to update SUS POs with GR / IV data?
    In a SUS environment each document counts as an own document and needs to
    be customized. I am not sure about understanding your requirement.
    Using the SUS-MM scenario in a classic environment enables the exchange of
    documents for PO / GR / IV in a "ping-pong" mode. SUS always needs a document,
    on which the next action can be based on.
    Thanks,
    Claudia

  • Intercompany billing RD04 with goods-receipt-based invoice verification

    Hi members,
    we think about making use of the automated intercompany billing functionality with the RD04.
    In our logistic processes we apply the goods-receipt-based invoice verification. This is a very important requirement. That means that invoices can be only posted if the goods receipt has taken place.
    Is there a possibility to configure the automated intercompany billing so that this requirement is met?
    Any ideas? Any documents? Helpful links?
    Thank`s in advance.
    Best regards.

    Hi Imer,
    I believe you must be following any one of below process steps for Inter company Billing:
    Sales Order
    Delivery
    Customer Invoice
    Inter-company Invoice
    Or
    Inter company STO
    Delivery
    Invoice
    GR Based on Inter Company STO
    Automatic Vendor Posting (RD04)
    If you are following first process then no need for GR at all.
    If it is second process then assign Requirement Routine (Logic: Check GR has been completed or not for STO, if completed Pass the requirement else fail. take MM consultant's help for exact table and field details if needed.)
    Change the RD04 trigger based on Background Job processing and Run Background job for processing of the Output type.
    Regards,
    MJ.

  • Goods-receipt-based invoice verification default for material group

    Hello experts,
    I put by default the option Goods-receipt-based invoice verification when creating a purchase order by tcode ME21N. Now, I would like if possible to only insert the option Goods-receipt-based invoice verification by default for some material group. Is this possible? This behaviour needs to be automatic.
    How can I achieve this behaviour?
    Thanks in advance,
    Best Regards,
    JP
    Edited by: Jeyakanthan A on Nov 20, 2011 11:11 PM

    Dear JP,
    In standard system this is not possible to default this indicator based on Material Group. This can be defaulted from Vendor Master record or Purchasing Info Record or Ticked Manually PO Item Details.
    If you look to enhance you system to do this, I would not advisable you to go with this default option because there can be situation that you order some material without Material Master Record (Like a frame work Order) in that case you will not be able to do GR and there can be conflict.
    You can create Material Group Info. record and default it from there, but again this for scenario where Material Master Record does not exists(Non Stock).
    Hope you find this useful.
    Regards,
    Reetesh

  • GR- Based IV - Goods receipt-based Invoice verification

    Hi,
    I am trying to make a new purchase order type all equal to the standart type. I only want an exception: the GR-based IV indicator must be, by default, off.
    This indicator specifies that prevision has been made for goods -receipt base invoice verification.
    So the goal is to have two kinds of purchase orders with a default GR-base IV indicator.
                              Best Regards
                                     João Fernandes

    Hi Kore,
    I forget to tell you one thing...in order to use the master record i must to change the info record...but i have to many materials...
    Do you know some mean of clean de info record of all materials of a vendor?
                 Best Regards
                        João Fernandes

  • Good Receipt after Delivery Completion Indicator on

    Dear ALL,
    In our Client there is a setting that if Delivery indicator Tick is on then the system is allowing the Goods Receipt . I want that if Delv. indicator is on then System should not allow GR.
    Please provide the Config setting.
    Regards,
    Kapil.

    Hi
    This is a standard functionality  incase PO qty is 100  and you set delivery completed indicator when goods receipt done for  90.then system will still allow receipt of another 10 qty. but not more than that.i.e. total receipt can be 100 only.
    But can use user exit to stop further goods receipt after delivery comple indicator is on.
    Vishal....

Maybe you are looking for

  • I solved excel file  download from jsp or javabean

    first jexcel api download i used the jexcel api here sample ; using jexcel api This code is servlet ================================================================== SaleAgent sa = null; public void init(ServletConfig config) throws ServletException

  • Installing DBMS_JAVA package

    Hi All, in my database Oracle 9.2.0.6 on solaris DBMS_JAVA package is missing. As i want to install the package so i ran initjvm.sql script and spooled the log. I am pasting the spool file for your reference as it's giving an error and terminates the

  • Payload different in SXMB_MONI and Message Monitoring

    Hi All,           I am facing a problem. My message Payload in SXMB_MONI (after mapping) is different from what i got from Message Monitoring tab of RWB. In the message monitoring some entries are missing from my actual payload. Payload from SXMB_MON

  • Model="${data.someUIModel.someColumn}" Behavior

    Good Afternoon, I understand stateless behavior was not implemented in the preview. But, when I invoke a mutator on a row column and commit that transaction, is there a way to [u][i]manually force the model to reload? My struts:action event returns n

  • Diff betwwen CRM 4.0 and 5.0

    Hi guys can any of you help me out in giving a document between 4.0 and 5.0 and i will be very helpfull if anyone send me some docs regarding global  roll out project..............