Dropship_PO Receipt & AR Invoice in back date

The Business requirement is
The OU gets the Bill of Lading/Air Way Bill document offline after some time let's say within 10 days of actual Bill of Lading/Airway Bill Date. We are executing Dropshipment process. The PO receipt to be done on back date, which is the actual Bill of Lading/Air Way Bill date. The AR Invoice to be raised on the same backdated actual Bill of Lading/Air Way Bill date.
Example:
Actual Bill of Lading/Air Way Bill date: 25 Apr 2012
The documents are received on date: 05 May 2012
Dropship PO Receipt Date: 25 Apr 2012 (We will execute backdated receipt in system, on 05 May 2012 the receipt date will be entered as 25 Apr 2012)
AR Invoice Date (after Auto-import program): 25 Apr 2012
We are able to get the desired result in the open period. Just wondering, how to go about the issue when periods are closed for the last month (April).
Read that, the profile option INV:Transaction Date Validation doesn't work in case of PO receipts. Kindly advise.
With Best Regards,
Nirabh Nayan

Hi,
Once a Inv a/c period is closed, the period close process permanantly closes the period and system will not let performing any further transactions in that closed period. period can not be reopened as well.
If you know that there are pending transactions to be made in the last month of a/c year, As an exception you can keep the last period open till all the transactions are entered into the system. Normally this is the general process followed across. Accounting period is not closed sharply on the final day of the acct period.
If you are worried about std cost update and want to have updated costs for the transactions done in new a/c year, You can enter the cut off date in the inv org parameters as the last date of previous accounting period so that the transactions of the first month of new accounting period ( in your case May ) does not get costed. Once you close the previous period, you can update the cost thru std cost update and then release the cut off date for the new period transactions to get costed at updated cost.
Prabhu Chepuri

Similar Messages

  • PGI & Invoice in Back Date

    If a Sales Order is created suppose on 18-07-07, then the Requested Delivery Date should
    be >= to the Sales Order Date creation. Now, while making the D.O. system is allowing to
    do PGI even on 10-07-07, with a warning message " Date is in the past : Please Check ".
    Same case is while making the Invoice in back date. Our requirement is that system
    should give  a error message and stop the user doing PGI and Invoice in back date. We
    have checked the System variable messages but could not track. Message No. VD399.

    Hi,
    System considers the current date as actual GI date or Billing date, if the date is in past it will gives only warning message.
    If you want to restrict you need to put logic in the User exits MV50AFz1 and RV60AFzz

  • Posting of cancelled Invoice after posting date is over

    Hello Experts,
    I am stuck up with a situation and as such seek your help.
    A invoice was generated and the subsequent accounting document was also cleared. Now after the posting date was over, someone cancelled the invoice by T.code VF11 and as expected it didnt get posted .The document flow showing is as per below :
    Order - open
    Invoice - completed
    Accounting Document - Cleared
    Cancel Invoice - Open
    Now, the business and their audit policies do not allow the client to cancel the invoice in back date ( within the posting period).
    What are the options do we have to tackle the situation.
    Joy

    The issue has been temporarily addressed by changing the posting date.
    However, now the client wants us to make an ABAP development so that no user is able to cancel the invoice after posting date is over. Now for that I have the following issues. Can someone please help me out in this.
    The basic process details I am following is as per below:
    For Transaction Code VF11 (i.e for Cancellation of Invoice) , when the invoice number which is subject to cancellation is provided, the System should search in VBRK table for the following :-
    1)The System will at first search whether the entry exists or not. If the Entry is not valid then it should give an message u201C Document xxxxx does not Existu201D.This is in line to the existing practice.
    2) If the Document number is valid then it will go to the billing date field and  will fetch the value from the VBRK table . Then it will match  whether the value fetched (i.e. this Invoice date)  is in present posting period or not. The system can find the posting period from the table V_T001B.
    a.If  the  Invoice date lies in the present posting period then the system will allow the cancellation document to be saved. This is in line to the existing process.
    b.If the Invoice date lies beyond the present posting period then the system will not allow to save the cancellation of the Invoice with a pop up message of u201C The Document number subject to cancellation do not lie within the present posting periodu201D .
    Now We have looked both the tables, from VBRK we will get Doc# and Billing date(FKDAT) but when we select Posting Date from table T001B( Permitted Posting Periods) there is some issue.
    1.  What will be the condition for selecting records from T001B table.Since there is multiple key fields
        RRCTY (Record Type) ,
        BUKRS (Posting Period Variant) ,
        MKOAR (Account Type or Masking)
        BKONT (To Account). 
    So, to get unique record what will be the value of this key fields. Is there any relationship with VBRK table ? 
    2.  Which field I have to consider as Posting Date or Period. Because there are many fields related to Posting period.

  • MIGO Goods receipt accepted in back date for STO

    Hi,
    I have a S.T.O for which delivery have been created, post goods issue and excise invoice have been done on 05.09.2009 and receipt through MIGO have been done and system accepted to post the material document in back dated 07.08.2009.
    How can system accept to post the material document in the back date, even my delivery and even dispatches had been not done on 07.08.2009.
    Is this standard functionality or do i need to make any config settings to not to accept to post the MIGO document.
    Thanks in advance
    Kishore.

    Go to transaction MMRV and uncheck field "Allow posting to previous period". This will make sure MM posting cannot be done to any of the previous periods. Keep in mind the setting will only be applicable for a particular month. If you want to make sure the setting is permanently set, you want to go to OMSY and uncheck the column to allow posting to previous period.
    Revi

  • Backdated PO receipt and Invoice date in closed periods_Dropshipment

    The Business requirement is
    The OU gets the Bill of Lading/Air Way Bill document offline after some time let's say within 10 days of actual Bill of Lading/Airway Bill Date. We are executing Dropshipment process. The PO receipt to be done on back date, which is the actual Bill of Lading/Air Way Bill date. The AR Invoice to be raised on the same backdated actual Bill of Lading/Air Way Bill date.
    Example:
    Actual Bill of Lading/Air Way Bill date: 25 Apr 2012
    The documents are received on date: 05 May 2012
    Dropship PO Receipt Date: 25 Apr 2012 (We will execute backdated receipt in system, on 05 May 2012 the receipt date will be entered as 25 Apr 2012)
    AR Invoice Date (after Auto-import program): 25 Apr 2012
    We are able to get the desired result in the open period. Just wondering, how to go about the issue when periods are closed for the last month (April).
    Heard that, the profile option INV:Transaction Date Validation doesn't work in case of PO receipts. Kindly advise.
    With Best Regards,
    Nirabh Nayan

    Hi,
    Once a Inv a/c period is closed, the period close process permanantly closes the period and system will not let performing any further transactions in that closed period. period can not be reopened as well.
    If you know that there are pending transactions to be made in the last month of a/c year, As an exception you can keep the last period open till all the transactions are entered into the system. Normally this is the general process followed across. Accounting period is not closed sharply on the final day of the acct period.
    If you are worried about std cost update and want to have updated costs for the transactions done in new a/c year, You can enter the cut off date in the inv org parameters as the last date of previous accounting period so that the transactions of the first month of new accounting period ( in your case May ) does not get costed. Once you close the previous period, you can update the cost thru std cost update and then release the cut off date for the new period transactions to get costed at updated cost.
    Prabhu Chepuri

  • Create Delivery, Billing and Excise Invoice no. in back date.

    Dear all,
    i got sum problem with no. range in export excise invoicing,
    therefore to avoid this i created export invoice thru' legacy system, now i want to create the same export order in sap system
    how i create export order in back date as actual excise date lies in back date.
    what certain changes i have to made in sap system in order to create Delivery, Billing and Excise Invoice no. in back date.
    Plz suggest
    Gaurav

    Back date means how many months should be predated ?? You should be aware, you can post a document in SAP one month prior to current month but not before that. For example, now we are in August and you can post a document for July and not for June'10.
    Apart from this, you need to have back dated stock in SAP to invoice and the periods (MM & FI) should be open for previous month.
    Dear Sir,
    Back dates means 14 days back and in the same month August.
    plz , explain what is back dated stock to invoice SAP
    Gaurav

  • 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.

  • MIRO(Invoice Verification) posting date is lesser than MIGO(Goods Receipt)

    MIRO(Invoice Verification) posting date is lesser than MIGO(Goods Receipt) posting date.
    Explanation:
    Miro sholud be posted after the GRN has posted. It means that the Posting date of Miro should be greater than or equal to the Posting date of Migo. But I am facing the issue that I can able to post the Miro before the Migo date..
    For example:  I have posted the Migo(Goods receipt) document with the posting date u2013 10.8.09 and at the same time I can also able to post the Miro(Invoice Verification) posting date as u2013 5.08.09. This is should not be allowed . Kindly give me the solution. Is there any options in SAP standards to restrict this type of Postings(without using user exit).
    regards
    Varadharaj

    Hi
    you  need to use BADi for this INVOICE_UPDATE
    you can give logic as whil;e MIRO system will compare posting date with MIGO doc , then create a Z error msg in se91 nad assign it in that badi
    take help of ABAPer, check following link
    [LINK |GR date lesser than the PO date, the system should show an error message.;

  • Goods Receipt in Back date

    Hello,
    We have  closed the May month and started a running the business in SAP. But user saying  he wants to show the GR created in 01.01.2011 (Jan month) already closed that month.
    He is forcing us,  it is possible to create on back dated, make it back date and allow him to do the GR ... As per SAP system only allow for one month back to do the GR.... If suppose i did the GR for January month then,, what are the implications hit after the GR .... and is it feasible to do the GR in back dated.
    Regards
    sapman man

    Theoretically you could reopen an old period with MMPI, but  you may screw up the information from thousands of postings just to fix one. MMPI is usually used if someone closed a period accidently in the middle of the month, but not recommended to fix just one posting.
    search the forum for MMPI , search OSS on MMPI  and read all the warnings

  • Create   Sales order ,Delivery, Billing and  Invoice no. in back date.

    Hello Gurus,
    Goodevening ,
    we have a requirement , here  we need to create, Delivery on  back date. 
    Note- System should   do the  availability  check on  back date. ( 1.e on requested delivery date) and confirm quantity on that date.
    Note-What ever sales transaction happned  yesterday  day will be enterded  today on yesterday  date( this daily  happens to this industry).
    My problem is system is not doing availability check on requested  delivery date  its just doing on todays date and giving confirmation but in system stock was there on yesterday date.
    Note - Always there is one day back log  for actual sales and system entry.
    Looking for your inputs
    Thanks in advance.
    Regards
    Ravi.M

    Hi  Lakshmipathi,
      Thanks for you reply,
    This a typical kind of industry.-Poultry industry
      They do the transactions  in the night times at farms where they will not have any access for systems.so they  want to post those transactions on back date.
    Note- i  do have  idea, system  does do availability check on  current date,but is there any possiblity for back postings with  availablity check  that  I am  looking for all the possible  options  with all the possible  feed backs.
    Note- Customer is selling the semi -finished product that i have already mentioned, whether i maintain   OR not  maintain system is doing avaliblity check  in  SD , as the meaterial  is   semi -finished  maintained by PP in MRP3.
    Thanks  in advance
    Regards
    Ravi.M

  • 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

  • Error in Back date delivery

    Hi All,
    I want to create one Order in Back date with back date delivery(Picking + PGI) and Billing, i m able to create the Order& Billing  in Back date but when i enter the back delivery date in sales order it will create current date's schedule line for the material which i don't want. if i create it in current date then after the process its shows same item in two date with 0 and deliver quantity in VA05 Report. actually i want to create entire process in back date what should i do please help.
    Regards
    Vivek Sharma

    SAP will not confirm availability in the past. That makes sense.
    Maybe you should just:
    - Proceed without taking the dates in account
    - Manually change the invoice date to a past date for this specific delivery
    Anyway, if the FI period is closed, you will not be able to book the invoice in the past.

  • MIR7 - Invoice and Posting date must be = PO Date

    Dear All,
    In MIR7 Invoice Date and Posting date is allowed prior to PO date.
    e.g.
    PO Date : 21.05.2010
    We can make MIR7 in back date i.e. 20.05.2010 or any back date.
    How to restrict this.
    We don't want to allow invoice date and Posting date < PO Date.
    Thanks and Regards,
    Nirav

    Please check this answered link:
    posting date
    Invoice posting not permissible after posting MIGO
    validation
    miro problem
    Edited by: Afshad Irani on May 23, 2010 10:39 AM

  • Enhancement_CIN_Capture Incoming Excise Invoice-J1IEX bulk data upload

    Dear All,
    Sub:CIN_Capture Incoming Excise Invoice-J1IEX bulk data upload option requirement
    We are capturing the Incoming excise invoices manually in the
    transaction J1IEX with huge datau2019s and according to the volume of data
    it is very difficult for us to enter manually and now we required for
    the option of bulk data processing to upload the data from the Excel
    file(received the softcopy from the supplier).
    As per our observations we found the BAPI named
    BAPI_EXCINV_CREATE_FROMDATA but the update level of this BAPI is not
    available in our system because as per the Indian Government norms one
    ofthe current Excise Duty Tariff is as below
    1. Basic Excise Duty (BED 8%).
    2. Education Cess (ECess 2%)
    3. Secondary Education Cess (SECess 1%)
    and we observed the SECess (1%) is not covered in the above mentioned
    BAPI so we are not in a position to proceed further.
    So Kindly update us is any other relevant option will solve the purpose.
    We are in a quite difficult situation to uplaod the datas to our system
    so please do the needful.
    Regards,
    PrabuM

    Please note that CIN uses the 'MB_MIGO_BADI' definition and 'CIN_PLUG_IN_TO_MIGO' is the implementation. You can create multiple implementations of this BADI. The same BADI is used for single step Capture & Post of excise invoice in MIGO. Kindly use this BADI as per your needs. SAP std does not support any BAPIs for Goods Receipts with Excise updates

Maybe you are looking for

  • BPM alert not being generated

    Hi guys, I'm having quite a little trouble in doing one thing which has been done for several times but which is giving  me a hard time... I've created a bpm process which in an error condition will trigger a simple alert. I've tested the process and

  • Burning cds in different formats

    Hi, I have about 80 songs that i have in my library (not from itunes store) that i want to burn to a cd. as of now, it will only allow 12 or so songs because of the file size. is there any way i can convert these songs into an mp3 or some type of fil

  • Application Manager failing on new CC install

    hi i just joined CC - and am trying to download Dreamweaver - but am getting an error on the application manager, such as the following: i have seen mention of an uninstaller tool or something - i am wary of using this, as i have a previous version o

  • Regarding Web Premium 5.5 upgrade !

    Hi , I am using Web premium CS5.5. Planning for an upgrade. It seems upgrade version doesnt have flash builder . Is it possible for me to use the flash builder 4.5 available in the current version after the ugradation to CS6.0 web premium ?

  • Image organization PS 11

    I have images on a thumb drive organized in a specific format. When importing the folder into PS 11 the organizer changes everything to meet the oldest, newest choices in the app. My limges on the USB don't fit that format. They are arranged numerica