Accounting document in MIGO

Hi,
When we are seeing the accounting document in migo (display mode) or FB03, it shows the entries line item wise. If there are 100 items in a PO along with other po conditions where migo is done, then it is vary difficult to analyise.
Is any way to bring this into consolidated form rather than line item wise?
regards

Hello Neeru,
I am not sure if this will help but you can utilize the FS10N and FBL3N to review the account line item in a more consolidated form.  The assignment field on the layout can sometimes store the purchasing document number along with line item if you want to try to consolidate/group line items together.  If your accounts are not set to open item managed (e.g. inventory), then these reports would not suffice.  Then you are left with viewing the data within the FB03 but still have the option to pull in more fields on your layout for analysis.

Similar Messages

  • Separate line item for taxes in accounting document of MIGO

    All SAP Gurus,
    As we can have separate line item for Freight amount (Freight amt credited) in accounting document for MIGO.
    Similarly is it possible to have separate line item for tax amount which is inventoried.
    Regards,

    Hi Rajan,
    Freight is from pricing procedure whereas tax is from taxing procedure.
    Tax cannot be shown in separate g/l in MIGO.
    Reason:
    If u wanna show tax as separate item then we need to debit tax a/c in migo as well as it has to go to inventory which is not possible(double accounting enrty on debit side).
    I too tried to do the same by specifying 2 for posting indicator and selecting non deductible for the nonsetoff account key used in the taxing proceudre in OBCN but it is behaving like setoff tax.
    U can also try doing the same and then check.
    Reg
    Raja

  • Accounting document during MIGO or MIRO

    hi
    all an accounting document is generated ,when it is generated during MIRO or MIGO ?
    can we able to view these in MB51 ?
    Regards
    Leo Thilak.MS

    Hi,
    While posting stock posting movement in MIGO - accounting document has generated .
    You can view the material document in t.code MB51 - Material document for a material
    MR51- Accounting document for a material
    MBAL -Archieved material document
    MBSM-Cancelled Material document
    MB03- Material document list
    MIRO- accounting document posting
    All the stock update in your plant accounting document has generated except 101K, 541, etc
    FB03 - There choose List option, you can view the accounting document for the MIRO posting by select document type RE-Invoice
    Fiscal year, Material etc
    Thanks,
    Thiru
    Edited by: thiru on Jan 18, 2011 11:33 AM

  • Sync of Material document and accounting document during MIGO

    Hi Friends,
    Can we synchronize the Document numbers between Material document (WE) for GR (101) and Accounting documents created for the MIGO transaction????
    We have 50 is assigned to WE. But, we have a gap in numbers of Material document number and Accounting document numbers??? though the document type WE is common for both.
    I have seen that "Buffer" is the culprit. But, not sure how to fix that.
    Appreciate your help in this regard.
    Dev.

    When the document type is same (WE) for both, how come the accounting doc has continuous numbers and Material doc has breaks ( from buffer)????
    document type WE is same for GR for material document and accounting docu but number range are stored diffrentely.
    OMBT is where u store the number range for material document
    and this number range is assigned to group of materia doc we wf wo ww
    OMBA is where u create diffrent number range for accounting document hear U assign WE to ur transaction code and in turn WE is assigned a number range what is created in OMBA, this number range is nothing to do with number range u have created in OMBT.
    when ever u post the docunemt in system
    SAp hav efixed the document type for GR that is WE
    it goes in OMBA in the group of Material documents for goods receipts
    check what is the year and number range assigned and current number so it assignes this number first
    than it go to OMBA  cheks what is the Tcode u are using and what is document type u have assigned to that tcode and it can be any WE or what ever u have assigned to that tcode
    taking that doc type it goes and see what Number range is assigned say 50 and then checks company code and year for this 50 and get the number for accounting doc
    so i think its is clear that material and account are 2 diffrent ranges
    skiping of numbers might be due to buffer
    also go throught following post it will be helpfull
    GR NO SEQUENCE - MISMATCH
    hope this helps

  • Enhancement for updating accounting document in MIGO

    When doing MIGO, material document gets generated in background. I would like to pass this material document num (mkpf-mblnr) to the assignment field of GR/IR line item of accounting document (BSEG-ZUONR)

    Hi, Thanks for u r response. it is giving problem
    My requirement :  Transaction is : MIGO
    Before posting of material document, update material document number in assignment field of GR/IR line item of accounting document (WE) at number commitment stage
    Update MKPF-MBLNR (Material Document Number) in BSEG-ZUONR
    but already i tried AC_DOCUMENT i got a problem .
    What i did,
    first use MB_DOCUMENT_BADI  with  method
                 mb_document_before_update.
    here i tried to get the material document and export into memory
    after use AC_DOCUMENT With method
                   change_after_check.
    here Import the material document doc num and pass it to Assignment field in
    but it is not working
    when i debug first trigger the   AC_DOCUMENT   And then it goes to   MB_DOCUMENT_BADI
    Plese help me regarding this.
    Edited by: vsreelakshmi on Feb 9, 2012 5:23 AM
    Edited by: vsreelakshmi on Feb 9, 2012 5:29 AM

  • Purchase Order item text not present in accounting documents after MIGO

    Hello all,
    in ECC 5.0 I create a PO using ME21N. Afterwards the GR is done with MIGO.
    For the moment the PO item text is not transferred to the FI documents. The field BESEG-SGTXT is empty. Is there a possibility to copy the text during GR from the PO item to SGTXT?
    In fact I am looking for a customizing path and not a User Exit.
    Thanks and regards
    AD

    Hi,
    You can fill the field header text on the 'Details' tab
    (This is field INVFO-BKTXT) and this field will be copied into
    the FI document fields BSEG-SGTXT for the vendor line and BKPF-BKTXT.
    You can fill directly the field SGTXT for the account lines ( if you
    post directly to an account) and for the purchase order lines."
    Also please review attached notes.
    453027     MIRO: Segment text for vendor line
    366412     MIRO: Enhancement LMR1M004 item text
    MIRO and the FI Enjoy transactions were designed seperately to meet the
    needs of their respective components - FI and MM. As they were not
    designed in conjunction, there are differences in their functionality.
    Not all information in one component will be updated in the other.
    Best Regards,
    Arminda
    Please also review attached note 42615 as this explains how settings
    in transaction ob14/ob41 effect the field INVFO-SGTXT in Miro.

  • Validation for accounting document during MIGO

    Hello experts,
    I would like to force the user to choose document type: FR while trying to post a credit memo via MIGO.
    How can I do it ?
    Thanks a lot.

    Hi, sorry, I wrote for miro.
    But for migo you can use badi MB_MIGO_BADI, method CHECK_HEADER.
    Also you can try ob28, but the main problem is how to know movement type.
    And 'post a credit memo via MIGO' - you mean move type 102?

  • No accounting doc generated @ migo

    Dear All,
    No accounting doc is generated despite of making GRS of valuated Asset (Settings for A type for PO)
    Kindly tell me if any customizing is missing?
    Regards,
    Sany.

    Hi
    Regarding the problem of "Missing cost accounting document in MIGO for    
    Asset PO", please kindly check the attached note:                                                                               
    9175   No value update is performed for goods movements                                                                               
    This note enumerates the different cases in which no accounting           
    documents are created. One of these cases is the following one:                                                                               
    4.  Possibility:                                                         
         In goods received for assigned order items with zero price as well   
         as with the indicator 'non-valuated goods receipt' no accounting     
         document is created.                                                 
    Therefore, please, kindly check whether the 'non-valuated goods receipt'  
    indicator (EKPO-WEUNB) has been set at item detail level for the          
    relevant purchase order item. Please also kindly check carefully the      
    remaining possibilities for the problem.                                  
    Blaz

  • CIN: Excise invoice accounting document is incorrect - MIGO

    Dear All,
    In MIGO, the Material document has two items (both are Consumables with the same chapter ID) for which the excise invoice has been posted successfully. The RG23C Part 2 register is updated correctly.
    But the accounting document so created has postings for only the second item. The posting for the first item is missing.
    We have checked for the settings for 'Multiple goods receipt, Multiple credits' in Plant Settings and also in Excise Registration which is set.
    Both the items in the Material document have the same tax code.
    We have checked for the excise GL accounts.
    The Excise GL accounts have been configured to GRPO
    We have also checked the J_1IPART2 table. and the accounting document updated with BED, AED, ECS and SeCEss amounts are correct.
    But what puzzles me is, when we check the accounting document in FB03, it has postings for only one item.
    We have checked the configurations and everything seems fine. We have simulated this situation in Quality system and it works fine, i.e .the accounting document has postings for both the items. Problem here looks like, itu2019s a manual error. Since all the tables are updated, and only the accounting part is missing, is it ok, if we create a manual accounting document?
    Can you please suggest?
    Many thanks in advance
    Vinod P

    You are saying materials are consumables and registered in RG23C.  This register is for Captial goods and not for consumables.  I think it could be RG23A.  check once again.
    Check J1ID for both materials and compare.  I am sure some of the details were missed here.  Even blank field will not allow to post
    Srinivas

  • No accounting document for 561E via MB1C and MIGO

    Dear All
    We are in MTO Scenario.
    we are trying to post initial stock against sales order through MB1C VIA 561E movement.
    the material document is not having an accounting document.
    Please help out.
    I've checked all setting as follows:
    1.) [OMJJ]
    for  Account grouping-561E - val update-qty update-val string(WA01)-Cn(2)-GBB-BSA
           Account grouping-561E -val update-qty update-val string(WA01)-Cn(2)-PRD-PRA
    2.)[OMJJ]
    Update control / WM movement types
          val  qty
    561 -    -     E                    In.ent.st.bal:slsOrd
    561 -     -     E               E     In.ent.st.bal:slsOrd
    561 -    -/     E                    In.ent.st.bal:slsOrd
    561 -    -/     E               E     In.ent.st.bal:slsOrd
    561 -/    -/     E                    In.ent.st.bal:slsOrd
    561 -/    -/     E               E     In.ent.st.bal:slsOrd
    3.)Logistics - General>Material Master>Basic Settings>Material Types>Define Attributes of Material Types
                                             -->FERT     Finished Product
                                                                    -->Quantity/value updating
                                                                                    qty    val
                                                                                1001     FERT  -/       -/
    4.) [OME9] settings
       for account assign cat 'E'  account modifier  'VKA'
    5.) [OBYC]
        for GBB-BSA- chart of a/c-val class-G/L accounts
             PRD-PRA- chart of a/c-val class-G/L accounts
                   are done and OK.
    still we are not able to generate accounting document for initial posting via [MB1C]
    WE HAVE EVEN TRIED TO POST VIA [MIGO], there also no accounting.
    hence, we are also not able to get accounting doc for PGI via 601.
    Please suggest me a solution at the earlist, I will be glad for the same.
    N.B:- if posting through 561, it is ok.
    Regards
    Maheshoe

    Maybe your SO special stock is not valuated that's why you won't get the accounting document.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/4d/2b92b743ad11d189410000e829fbbd/frameset.htm
    You can manage valuated or non-valuated sales order stock.
    Edited by: Csaba Szommer on Mar 6, 2010 2:02 PM

  • Migo & Miro Accounting Documents Report

    Hello Abapers,
    I have made the new ALV report as shown below :-
    Report zaccounting no standard page heading line-size 300 line-count 40.
    tables : mkpf, "Header: Material Document
             mseg, "Document Segment: Material
             bkpf, "Accounting Document Header
             ekbe. "PO History Table
    type-pools slis.
    *DATA DECLARATION
    data : pos type i,
           l_layout type slis_layout_alv.
    data  gt_fieldcat type slis_t_fieldcat_alv.
    data  gt_sort type slis_t_sortinfo_alv.
    data  ls_fieldcat type slis_fieldcat_alv.
    data  is_print type slis_print_alv.
    data  it_events type slis_alv_event occurs 5.
    data  gs_variant type disvariant.
    data  t_list_top_of_page type slis_t_listheader.
    data  title like sy-title.
    data : l_title(105) type c,
           l_list(105)  type c,         "Store the Top-of-page headings
           l_date(10)   type c,         "Store date in top-of-page
           l_time(8)    type c,         "Store time in top-of-page
           title1 like sy-title,
           title2 like sy-title,
           title3 like sy-title.
    *-- Data Declaration
    data : repid  like sy-repid.
    constants: x  type c value 'X'.
    data zawkey like bkpf-awkey.
    types : begin of x_mkpf,
    mblnr like mkpf-mblnr,
    mjahr like mkpf-mjahr,
    budat like mkpf-budat,
    ebeln like mseg-ebeln,
    ebelp like mseg-ebelp,
    bwart like mseg-bwart,
    matnr like mseg-matnr,
    gsber like mseg-gsber,
    werks like mseg-werks,
    bukrs like bkpf-bukrs,
    belnr like bkpf-belnr,
    gjahr like bkpf-gjahr,
    bukrs1 like bkpf-bukrs,
    belnr1 like bkpf-belnr,
    gjahr1 like bkpf-gjahr,
    belnr2 like bkpf-belnr,
    gjahr2 like bkpf-gjahr,
    end of x_mkpf.
    data : t_mkpf type standard table of x_mkpf with header line.
    S E L E C T I O N - S C R E E N *
    selection-screen begin of block b1 with frame title text-009.
    select-options:  s_budat for mkpf-budat obligatory.
    select-options:  s_bwart for mseg-bwart.
    select-options:  s_matnr for mseg-matnr.
    select-options:  s_gsber for mseg-gsber.
    select-options:  s_werks for mseg-werks.
    selection-screen end of block b1.
    start-of-selection.
    break abapdev1.
    select msegmblnr msegmjahr mkpf~budat
    msegebeln msegebelp msegbwart msegmatnr mseggsber msegwerks
    into table t_mkpf
    from mkpf inner join mseg
    on mkpfmblnr = msegmblnr
    where budat in s_budat
    and bwart in s_bwart
    and matnr in s_matnr
    and gsber in s_gsber
    and werks in s_werks.
    loop at t_mkpf.
    select single belnr gjahr into (t_mkpf-belnr, t_mkpf-gjahr) from ekbe where ebeln = t_mkpf-ebeln
                                  and ebelp = t_mkpf-ebelp
                                  and lfbnr = t_mkpf-mblnr
                                  and lfgja = t_mkpf-mjahr
                                  and bewtp = 'Q'.
    modify t_mkpf transporting belnr gjahr.
    endloop.
    loop at t_mkpf.
    clear : zawkey.
    concatenate t_mkpf-mblnr t_mkpf-mjahr into zawkey.
    select single belnr gjahr into (t_mkpf-belnr1,t_mkpf-gjahr1) from bkpf
                       where awtyp = 'MKPF'
                       and awkey = zawkey.
    break abapdev1.
    clear : zawkey.
    concatenate t_mkpf-belnr t_mkpf-gjahr into zawkey.
    select single belnr gjahr into (t_mkpf-belnr2,t_mkpf-gjahr2) from bkpf
                       where awtyp = 'RMRP'
                       and awkey = zawkey.
    modify t_mkpf transporting belnr1 gjahr1 belnr2 gjahr2.
    endloop.
    ls_fieldcat-col_pos       =  '1'.
      ls_fieldcat-fieldname     = 'BUDAT'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'BUDAT'.
      ls_fieldcat-ref_tabname   = 'MKPF'.
      ls_fieldcat-seltext_l     = 'PSG DATE'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos       =  '2'.
      ls_fieldcat-fieldname     = 'MBLNR'.
      ls_fieldcat-tabname       = 'X_MSEG'.
      ls_fieldcat-ref_fieldname = 'MBLNR'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MIGO MAT DOCNO.'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '3'.
      ls_fieldcat-fieldname     = 'BELNR1'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'BELNR1'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'FI DocNo.'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '4'.
      ls_fieldcat-fieldname     = 'GJAHR1'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'GJAHR1'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'FI FiscalYr'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '2'.
    ls_fieldcat-fieldname     = 'MJAHR'.
    ls_fieldcat-tabname       = 'X_MKPF'.
    ls_fieldcat-ref_fieldname = 'MJAHR'.
    ls_fieldcat-ref_tabname   = 'MSEG'.
    ls_fieldcat-seltext_l     = 'MIGO MATERIAL DOC. YEAR'.
    append ls_fieldcat to gt_fieldcat.
    clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '5'.
      ls_fieldcat-fieldname     = 'EBELN'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'EBELN'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'PO No.'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '6'.
      ls_fieldcat-fieldname     = 'EBELP'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'EBELP'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'PO ItemNo.'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '7'.
      ls_fieldcat-fieldname     = 'BWART'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'BWART'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'Mvt.Type'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '8'.
      ls_fieldcat-fieldname     = 'BELNR'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'BELNR'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MIRO DocNo.'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '9'.
      ls_fieldcat-fieldname     = 'GJAHR'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'GJAHR'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MIRO FiscalYr'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '10'.
      ls_fieldcat-fieldname     = 'GSBER'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'GSBER'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'BUS.AREA'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '11'.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'WERKS'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'PLANT'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '12'.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'MATNR'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MAT.NO'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '13'.
      ls_fieldcat-fieldname     = 'BELNR2'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'BELNR2'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MIRO FI Doc.No'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    ls_fieldcat-col_pos       =  '14'.
      ls_fieldcat-fieldname     = 'GJAHR2'.
      ls_fieldcat-tabname       = 'T_MSEG'.
      ls_fieldcat-ref_fieldname = 'GJAHR2'.
      ls_fieldcat-ref_tabname   = 'MSEG'.
      ls_fieldcat-seltext_l     = 'MIRO FI FiscalYr'.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
    *&      Form  ALV_GRID_DISPLAY
    form alv_grid_display .
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
          i_callback_program                =  sy-repid   " 'ZRD_DD'
          it_fieldcat                       =  gt_fieldcat  "catalogue field
          i_callback_top_of_page            =  'TOP_PAGE'
          is_layout                         =  l_layout
         it_sort                           =  gt_sort
          i_default                         = 'X'
         i_save                            = 'A'
         is_variant                        = gs_variant
         it_events                         = it_events
         is_print                          = is_print
        tables
          t_outtab                          = t_mkpf
        exceptions
         program_error                      = 1
         others                             = 2
      if sy-subrc <> 0.
        message id sy-msgid type 'I' number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " ALV_GRID_DISPLAY
    **&      Form  ALV_LAYOUT
    *FORM alv_layout USING   ps_layout TYPE slis_layout_alv.
    ps_layout-get_selinfos      = x.
    ps_layout-colwidth_optimize = x.
    ps_layout-detail_popup      = x.
    ps_layout-no_keyfix         = x.
    ps_layout-coltab_fieldname    = 'CLR'.
    ps_layout-key_hotspot       = x.
    ps_layout-group_change_edit = x.
    ps_layout-zebra  = 'X'.
    *ENDFORM.                    " ALV_LAYOUT
    **&      Form  ALV_PRINT
    *FORM alv_print .
    is_print-no_print_selinfos = x. " display no selection infos
    is_print-no_coverpage = x.
    is_print-no_new_page  = x.
    is_print-no_print_listinfos = x. " display no listinfos
    *ENDFORM.                    " ALV_PRINT
    **&      Form  TOP_OF_PAGE
    form top_page.
      data: ls_line type slis_listheader,
            i_top_of_page type slis_t_listheader.
      title = sy-title.
      ls_line-typ  = 'H'.
      ls_line-info = title.
      append ls_line to i_top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = i_top_of_page.
    endform.                    "TOP_OF_PAGE
    In this report , i have faced some problems :-
    1. In MIGO numbers some cases MIRO doc. numbers are not shown against some migo doc. numbers whereas actually MIRO is already done.
    2. The Problem in downloading the report, its not accurate download & the MIGO Document Number not shown when we download the report.
    Thanks,
    Sumit.

    Hi Sumit,
    Im not sure if it will completely support ur needs but check it out
    This is for MIRO.Note here business area is hardcoded.
    REPORT  zmm_miro_track.
    TABLES : rseg, bkpf, bseg, lfa1, ekbe, skat, bsis .
    AlV related data declarations
    Type Pools
    TYPE-POOLS: slis.
    CONSTANTS:
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
          Data Declaration file                                         *
    DATA  : BEGIN OF it_rseg OCCURS 0,
             belnr TYPE rseg-belnr,
             gjahr TYPE rseg-gjahr,
             ebeln TYPE rseg-ebeln,
             ebelp TYPE rseg-ebelp,
             bukrs TYPE rseg-bukrs,
             awkey TYPE bkpf-awkey,
             END OF it_rseg.
    DATA :  BEGIN OF it_bkpf OCCURS 0,
             belnr TYPE bkpf-belnr,
             gjahr TYPE bkpf-gjahr,
             xblnr TYPE bkpf-xblnr,
             budat TYPE bkpf-budat,
             awkey TYPE bkpf-awkey,
             bukrs TYPE bkpf-bukrs,
             belnr1 TYPE bkpf-belnr,
             blart TYPE bkpf-blart,
            END OF it_bkpf.
    DATA :  BEGIN OF it_bseg OCCURS 0,
             belnr TYPE bseg-belnr,
             gjahr TYPE bseg-gjahr,
             bupla TYPE bseg-bupla,
             lifnr TYPE bseg-lifnr,
             hkont TYPE bseg-hkont,
             koart TYPE bseg-koart,
             mwskz TYPE bseg-mwskz,
             pswbt TYPE bseg-pswbt,
             ebeln TYPE bseg-ebeln,
             ebelp TYPE bseg-ebelp,
             xref3 TYPE bseg-xref3,
             bschl TYPE bseg-bschl,
             shkzg TYPE bseg-shkzg,
             miro_accnt TYPE bseg-hkont,
             xblnr TYPE bkpf-xblnr,
             budat TYPE bkpf-budat,
             belnr1 TYPE bseg-belnr,
             acdes(50),
             belnr2 TYPE bseg-belnr,
             belnr3 TYPE bseg-belnr,
             gjahr1 TYPE bseg-gjahr,
             hkont1 TYPE bseg-hkont,
             pswbt1 TYPE bseg-pswbt,
             budat1 TYPE ekbe-budat,
             acdes1(50),
            END OF it_bseg.
    DATA :  it_bseg1 LIKE it_bseg OCCURS 0 WITH HEADER LINE.
    DATA :  BEGIN OF it_bsis OCCURS 0,
             belnr TYPE bsis-belnr,
             gjahr TYPE bsis-gjahr,
             bschl TYPE bsis-bschl,
             xref3 TYPE bsis-xref3,
            END OF it_bsis.
    DATA :  BEGIN OF it_lfa1 OCCURS 0,
             lifnr TYPE lfa1-lifnr,
             name1 TYPE lfa1-name1,
             spras TYPE lfa1-spras,
            END OF it_lfa1.
    DATA :  BEGIN OF it_skat OCCURS 0,
             saknr TYPE skat-saknr,
             txt20 TYPE skat-txt20,
             txt50 TYPE skat-txt50,
             spras TYPE skat-spras,
             ktopl TYPE skat-ktopl,
            END OF it_skat.
    DATA :  BEGIN OF it_ekbe OCCURS 0,
             ebeln TYPE ekbe-ebeln,
             ebelp TYPE ekbe-ebelp,
             budat TYPE ekbe-budat,
             bewtp TYPE ekbe-bewtp,
            END OF it_ekbe.
    DATA : fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           gd_repid LIKE sy-repid.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
          gs_layout   TYPE slis_layout_alv ,
          gs_print    TYPE slis_print_alv,
          gt_sort     TYPE slis_t_sortinfo_alv ,
          gt_filter   TYPE slis_t_filter_alv,
          gt_sp_group TYPE slis_t_sp_group_alv,
          gt_alv_graphics TYPE dtc_t_tc,
          gt_excluding  TYPE slis_t_extab ,
          gt_events   TYPE slis_t_event .
    DATA: g_repid LIKE sy-repid.
    DATA: gt_list_top_of_page TYPE slis_t_listheader.
    DATA:       g_boxnam TYPE slis_fieldname VALUE  'BOX',
                p_f2code LIKE sy-ucomm       VALUE  '&ETA',
                p_lignam TYPE slis_fieldname VALUE  'LIGHTS',
                g_save(1) TYPE c,
                g_default(1) TYPE c,
                g_exit(1) TYPE c,
                gx_variant LIKE disvariant,
                g_variant LIKE disvariant.
          USER ENTRY PARAMETERS                                         *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_belnr FOR rseg-belnr OBLIGATORY,
                     s_gjahr FOR rseg-gjahr OBLIGATORY,
                     s_budat FOR bkpf-budat.
    SELECTION-SCREEN END OF BLOCK blk1.
          START-OF-SELECTION                                            *
    START-OF-SELECTION.
      PERFORM data_retrive.
      PERFORM data_call_alv.
      PERFORM build_layout.
    END-OF-SELECTION.
    *&      Form  DATA_CALL_ALV
          text
    -->  p1        text
    <--  p2        text
    FORM data_call_alv .
      g_repid = sy-repid.
      PERFORM e01_fieldcat_init USING gt_fieldcat[].
      PERFORM eventtab_build CHANGING gt_events.
      PERFORM e04_comment_build USING gt_list_top_of_page[].
      PERFORM display_report.
    ENDFORM.                    " DATA_CALL_ALV
    *&      Form  E01_FIELDCAT_INIT
          text
         -->P_GT_FIELDCAT[]  text
    FORM e01_fieldcat_init  USING    e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR'.
      ls_fieldcat-key = 'X'. "SUBTOTAL KEY
      ls_fieldcat-col_pos      = '1'.
      ls_fieldcat-seltext_l    = 'Accounting Doc'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR1'.
      ls_fieldcat-col_pos      = '2'.
      ls_fieldcat-seltext_l    = 'IR Doc'.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'XBLNR'.
      ls_fieldcat-col_pos      = '3'.
      ls_fieldcat-seltext_l    = 'IR Reference'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BUDAT'.
      ls_fieldcat-col_pos      = '4'.
      ls_fieldcat-seltext_l    = 'IR Posting Date'.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BUPLA'.
      ls_fieldcat-col_pos      = '5'.
      ls_fieldcat-seltext_l    = 'Business Place'.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'HKONT'.
      ls_fieldcat-col_pos      = '6'.
      ls_fieldcat-seltext_l    = 'G/L accounts Posted'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'ACDES'.
      ls_fieldcat-col_pos      = '7'.
      ls_fieldcat-seltext_l    = 'G/L description'.
      ls_fieldcat-outputlen    = 20.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'MWSKZ'.
      ls_fieldcat-col_pos      = '8'.
      ls_fieldcat-seltext_l    = 'Tax Code'.
      ls_fieldcat-outputlen    = 8.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'PSWBT'.
      ls_fieldcat-col_pos      = '9'.
      ls_fieldcat-seltext_l    = 'G/L Amount'.
      ls_fieldcat-outputlen    = 20.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'EBELN'.
      ls_fieldcat-col_pos      = '10'.
      ls_fieldcat-seltext_l    = 'Purchase Order'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'EBELP'.
      ls_fieldcat-col_pos      = '11'.
      ls_fieldcat-seltext_l    = 'P.O.Line Item'.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR2'.
      ls_fieldcat-col_pos      = '12'.
      ls_fieldcat-seltext_l    = 'GRN Doc '.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR3'.
      ls_fieldcat-col_pos      = '13'.
      ls_fieldcat-seltext_l    = 'GRN FI Doc No.'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BUDAT1'.
      ls_fieldcat-col_pos      = '14'.
      ls_fieldcat-seltext_l    = 'GR Posting Date '.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
    ENDFORM.                    "e01_fieldcat_init
    *&      Form  EVENTTAB_BUILD
          text
         <--P_GT_EVENTS  text
    FORM eventtab_build  CHANGING lt_events TYPE slis_t_event.
      CONSTANTS:
      gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = lt_events.
      READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
      INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  E04_COMMENT_BUILD
          text
         -->P_GT_LIST_TOP_OF_PAGE[]  text
    FORM e04_comment_build  USING e04_lt_top_of_page TYPE slis_t_listheader.
      DATA : v_time(5) TYPE c.
      DATA:  ls_line TYPE slis_listheader.
      DATA:  ls_colr TYPE slis_specialcol_alv.
      DATA : v_text(90) TYPE c.
      CONCATENATE ' Report for MIRO track ':' ' INTO v_text SEPARATED BY space.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = v_text.
      APPEND ls_line TO e04_lt_top_of_page.
    ENDFORM.                    " E04_COMMENT_BUILD
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    **&      Form  DATA_RETRIVE
          text
    FORM data_retrive.
    fetching Accounting Document Number and Fiscal year from Incoming Invoice table
      SELECT  belnr gjahr ebeln ebelp bukrs
         INTO CORRESPONDING FIELDS OF TABLE it_rseg
           FROM rseg
           WHERE belnr IN s_belnr
            AND  gjahr IN s_gjahr
            AND  bukrs = '1000'.
      LOOP AT it_rseg.
        CONCATENATE it_rseg-belnr it_rseg-gjahr INTO it_rseg-awkey.
        MODIFY it_rseg.
        CLEAR it_rseg.
      ENDLOOP.
      IF it_rseg[] IS NOT INITIAL.
        SELECT belnr gjahr xblnr budat awkey
          INTO CORRESPONDING FIELDS OF TABLE it_bkpf
            FROM bkpf
            FOR ALL ENTRIES IN it_rseg
            WHERE awkey = it_rseg-awkey
              AND budat IN s_budat
              AND bukrs = '1000'
              AND blart <> 'ML'.
      ENDIF.
      IF it_bkpf[] IS NOT INITIAL.
        SELECT belnr gjahr bupla lifnr hkont koart mwskz pswbt ebeln ebelp xref3 bschl shkzg
           INTO CORRESPONDING FIELDS OF TABLE it_bseg
           FROM bseg
           FOR ALL ENTRIES IN it_bkpf
           WHERE belnr = it_bkpf-belnr
             AND gjahr = it_bkpf-gjahr.
      ENDIF.
    fetching G/L account description
      IF it_bseg[] IS NOT INITIAL.
        SELECT lifnr name1
        INTO CORRESPONDING FIELDS OF TABLE it_lfa1
        FROM lfa1
        FOR ALL ENTRIES IN it_bseg
        WHERE lifnr = it_bseg-lifnr
          AND spras = 'EN'.
        SELECT saknr txt20 txt50
        INTO CORRESPONDING FIELDS OF TABLE it_skat
        FROM skat
        FOR ALL ENTRIES IN it_bseg
        WHERE saknr = it_bseg-hkont
          AND spras = 'EN'
          AND ktopl = 'HRJL'.
        SELECT ebeln ebelp budat
        INTO CORRESPONDING FIELDS OF TABLE it_ekbe
        FROM ekbe
        FOR ALL ENTRIES IN it_bseg
        WHERE ebeln = it_bseg-ebeln
          AND ebelp = it_bseg-ebelp
          AND bewtp = 'E'.
      ENDIF.
      LOOP AT it_bseg.
        IF it_bseg-koart = 'K'.
          it_bseg-miro_accnt = it_bseg-lifnr.
        ELSE.
          it_bseg-miro_accnt = it_bseg-hkont.
        ENDIF.
        IF it_bseg-shkzg = 'H'.
          it_bseg-pswbt = it_bseg-pswbt * -1.
        ENDIF.
        it_bseg-belnr2 = it_bseg-xref3+4(10).
        MODIFY it_bseg.
        READ TABLE it_ekbe WITH KEY ebeln = it_bseg-ebeln
                                    ebelp = it_bseg-ebelp.
        IF sy-subrc = 0.
          it_bseg-budat1 = it_ekbe-budat.
        ENDIF.
        READ TABLE it_bkpf WITH KEY belnr = it_bseg-belnr
                                    gjahr = it_bseg-gjahr.
        IF sy-subrc = 0.
          it_bseg-belnr = it_bkpf-belnr.
          it_bseg-gjahr = it_bkpf-gjahr.
          it_bseg-xblnr = it_bkpf-xblnr.
          it_bseg-budat = it_bkpf-budat.
          it_bseg-belnr1 = it_bkpf-awkey+0(10).
        ENDIF.
        IF it_bseg-koart = 'K'.
          READ TABLE it_lfa1 WITH KEY lifnr = it_bseg-miro_accnt.
          IF sy-subrc = 0.
            it_bseg-acdes = it_lfa1-name1.
          ENDIF.
        ELSE.
          READ TABLE it_skat WITH KEY saknr = it_bseg-miro_accnt.
          IF sy-subrc = 0.
            IF it_skat-txt20 IS NOT INITIAL.
              it_bseg-acdes = it_skat-txt20.
            ELSE.
              it_bseg-acdes = it_skat-txt50.
            ENDIF.
          ENDIF.
        ENDIF.
        MODIFY it_bseg.
        CLEAR it_bseg.
      ENDLOOP.
      it_bseg1[] = it_bseg[].
      LOOP AT it_bseg1.
        IF it_bseg1-xref3 = ''.
          DELETE it_bseg1.
          CLEAR it_bseg1.
        ENDIF.
      ENDLOOP.
      IF it_bseg1[] IS NOT INITIAL.
        SELECT belnr gjahr bschl xref3
        FROM bsis
        INTO CORRESPONDING FIELDS OF TABLE it_bsis
        FOR ALL ENTRIES IN it_bseg1
        WHERE xref3 = it_bseg1-xref3
          AND gjahr = it_bseg1-gjahr
          AND bschl = '96'.
      ENDIF.
      LOOP AT it_bseg.
        READ TABLE it_bsis WITH KEY xref3 = it_bseg-xref3.
        IF sy-subrc = 0.
          it_bseg-belnr3 = it_bsis-belnr.
          it_bseg-gjahr1 = it_bsis-gjahr.
        ENDIF.
        MODIFY it_bseg.
        CLEAR it_bseg.
      ENDLOOP.
    ENDFORM.                    "data_retrive
    *&      Form  DISPLAY_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM display_report .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id         = ''
          i_callback_program      = g_repid
         i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_special_groups       = gt_sp_group[]
          it_sort                 = gt_sort[]
          it_filter               = gt_filter[]
          i_save                  = g_save
          is_variant              = g_variant
          it_events               = gt_events[]
          is_print                = gs_print
          it_alv_graphics         = gt_alv_graphics[]
          it_excluding            = gt_excluding
        TABLES
          t_outtab                = it_bseg.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    FORM build_layout.
      gs_layout-no_input          = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-totals_text       = 'Totals'(201).
      gs_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT
    This is for MIGO.
    REPORT  zmm_migo_track.
    TABLES : bseg, ekbe, skat, bsis.
    AlV related data declarations
    Type Pools
    TYPE-POOLS: slis.
    CONSTANTS:
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
          Data Declaration file                                         *
    DATA :  BEGIN OF it_bseg OCCURS 0,
             belnr TYPE bseg-belnr,
             gjahr TYPE bseg-gjahr,
             bukrs TYPE bseg-bukrs,
             hkont TYPE bseg-hkont,
             pswbt TYPE bseg-pswbt,
             ebeln TYPE bseg-ebeln,
             ebelp TYPE bseg-ebelp,
             xref3 TYPE bseg-xref3,
             shkzg TYPE bseg-shkzg,
             budat TYPE ekbe-budat,
             acdes(50),
             belnr1 TYPE bseg-belnr,
            END OF it_bseg.
    DATA :  it_bseg1 LIKE it_bseg OCCURS 0 WITH HEADER LINE.
    DATA :  BEGIN OF it_bsis OCCURS 0,
             belnr TYPE bsis-belnr,
             gjahr TYPE bsis-gjahr,
             bschl TYPE bsis-bschl,
             xref3 TYPE bsis-xref3,
            END OF it_bsis.
    DATA :  BEGIN OF it_skat OCCURS 0,
             saknr TYPE skat-saknr,
             txt20 TYPE skat-txt20,
             txt50 TYPE skat-txt50,
             spras TYPE skat-spras,
             ktopl TYPE skat-ktopl,
            END OF it_skat.
    DATA :  BEGIN OF it_ekbe OCCURS 0,
             ebeln TYPE ekbe-ebeln,
             ebelp TYPE ekbe-ebelp,
             budat TYPE ekbe-budat,
             bewtp TYPE ekbe-bewtp,
            END OF it_ekbe.
    DATA :  fiscal_year_low(4),
            fiscal_year_high(4).
    DATA : fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           gd_repid LIKE sy-repid.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
          gs_layout   TYPE slis_layout_alv ,
          gs_print    TYPE slis_print_alv,
          gt_sort     TYPE slis_t_sortinfo_alv ,
          gt_filter   TYPE slis_t_filter_alv,
          gt_sp_group TYPE slis_t_sp_group_alv,
          gt_alv_graphics TYPE dtc_t_tc,
          gt_excluding  TYPE slis_t_extab ,
          gt_events   TYPE slis_t_event .
    DATA: g_repid LIKE sy-repid.
    DATA: gt_list_top_of_page TYPE slis_t_listheader.
    DATA:       g_boxnam TYPE slis_fieldname VALUE  'BOX',
                p_f2code LIKE sy-ucomm       VALUE  '&ETA',
                p_lignam TYPE slis_fieldname VALUE  'LIGHTS',
                g_save(1) TYPE c,
                g_default(1) TYPE c,
                g_exit(1) TYPE c,
                gx_variant LIKE disvariant,
                g_variant LIKE disvariant.
          USER ENTRY PARAMETERS                                         *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_belnr FOR bseg-belnr OBLIGATORY,
                     s_budat FOR ekbe-budat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    AT SELECTION-SCREEN.
      IF s_budat-low IS NOT INITIAL.
        CALL FUNCTION 'GM_GET_FISCAL_YEAR'
          EXPORTING
            i_date                           = s_budat-low
            i_fyv                            = 'V3'
         IMPORTING
            e_fy                             = fiscal_year_low
    EXCEPTIONS
      FISCAL_YEAR_DOES_NOT_EXIST       = 1
      NOT_DEFINED_FOR_DATE             = 2
      OTHERS                           = 3
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF s_budat-high IS NOT INITIAL.
        CALL FUNCTION 'GM_GET_FISCAL_YEAR'
          EXPORTING
            i_date                           = s_budat-high
            i_fyv                            = 'V3'
         IMPORTING
            e_fy                             = fiscal_year_high
    EXCEPTIONS
      FISCAL_YEAR_DOES_NOT_EXIST       = 1
      NOT_DEFINED_FOR_DATE             = 2
      OTHERS                           = 3
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
          START-OF-SELECTION                                            *
    START-OF-SELECTION.
      PERFORM data_retrive.
      PERFORM data_call_alv.
      PERFORM build_layout.
    END-OF-SELECTION.
    *&      Form  DATA_CALL_ALV
          text
    -->  p1        text
    <--  p2        text
    FORM data_call_alv .
      g_repid = sy-repid.
      PERFORM e01_fieldcat_init USING gt_fieldcat[].
      PERFORM eventtab_build CHANGING gt_events.
      PERFORM e04_comment_build USING gt_list_top_of_page[].
      PERFORM display_report.
    ENDFORM.                    " DATA_CALL_ALV
    *&      Form  E01_FIELDCAT_INIT
          text
         -->P_GT_FIELDCAT[]  text
    FORM e01_fieldcat_init  USING    e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR1'.
      ls_fieldcat-col_pos      = '1'.
      ls_fieldcat-seltext_l    = 'GRN Doc '.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR'.
      ls_fieldcat-col_pos      = '2'.
      ls_fieldcat-seltext_l    = 'GRN FI Doc No.'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BUDAT'.
      ls_fieldcat-col_pos      = '3'.
      ls_fieldcat-seltext_l    = 'GR Posting Date '.
      ls_fieldcat-outputlen    = 10.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'HKONT'.
      ls_fieldcat-col_pos      = '4'.
      ls_fieldcat-seltext_l    = 'Account Assignment'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'ACDES'.
      ls_fieldcat-col_pos      = '5'.
      ls_fieldcat-seltext_l    = 'Description'.
      ls_fieldcat-outputlen    = 20.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'PSWBT'.
      ls_fieldcat-col_pos      = '6'.
      ls_fieldcat-seltext_l    = 'G/L Amount'.
      ls_fieldcat-outputlen    = 15.
      APPEND ls_fieldcat TO e01_lt_fieldcat.
    ENDFORM.                    "e01_fieldcat_init
    *&      Form  EVENTTAB_BUILD
          text
         <--P_GT_EVENTS  text
    FORM eventtab_build  CHANGING lt_events TYPE slis_t_event.
      CONSTANTS:
      gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = lt_events.
      READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
      INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  E04_COMMENT_BUILD
          text
         -->P_GT_LIST_TOP_OF_PAGE[]  text
    FORM e04_comment_build  USING e04_lt_top_of_page TYPE slis_t_listheader.
      DATA : v_time(5) TYPE c.
      DATA:  ls_line TYPE slis_listheader.
      DATA:  ls_colr TYPE slis_specialcol_alv.
      DATA : v_text(90) TYPE c.
      CONCATENATE ' Report for MIGO track ':' ' INTO v_text SEPARATED BY space.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = v_text.
      APPEND ls_line TO e04_lt_top_of_page.
    ENDFORM.                    " E04_COMMENT_BUILD
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    **&      Form  DATA_RETRIVE
          text
    FORM data_retrive.
    fetching migo G/L account
      IF fiscal_year_high IS NOT INITIAL.
        SELECT belnr gjahr hkont pswbt ebeln ebelp xref3 shkzg
           FROM bseg
           INTO CORRESPONDING FIELDS OF TABLE it_bseg
           WHERE belnr IN s_belnr
             AND gjahr BETWEEN fiscal_year_low AND fiscal_year_high
             AND bukrs = '1000'.
      ELSE.
        SELECT belnr gjahr hkont pswbt ebeln ebelp xref3 shkzg
           FROM bseg
           INTO CORRESPONDING FIELDS OF TABLE it_bseg
           WHERE belnr IN s_belnr
             AND gjahr = fiscal_year_low
             AND bukrs = '1000'.
      ENDIF.
    fetching G/L account description
      IF it_bseg[] IS NOT INITIAL.
        SELECT saknr txt20 txt50
        INTO CORRESPONDING FIELDS OF TABLE it_skat
        FROM skat
        FOR ALL ENTRIES IN it_bseg
        WHERE saknr = it_bseg-hkont
          AND spras = 'EN'
          AND ktopl = 'HRJL'.
        SELECT ebeln ebelp budat
        INTO CORRESPONDING FIELDS OF TABLE it_ekbe
        FROM ekbe
        FOR ALL ENTRIES IN it_bseg
        WHERE ebeln = it_bseg-ebeln
          AND ebelp = it_bseg-ebelp
          AND bewtp = 'E'.
      ENDIF.
      LOOP AT it_bseg.
        IF it_bseg-shkzg = 'H'.
          it_bseg-pswbt = it_bseg-pswbt * -1.
        ENDIF.
        MODIFY it_bseg.
        READ TABLE it_ekbe WITH KEY ebeln = it_bseg-ebeln
                                    ebelp = it_bseg-ebelp.
        IF sy-subrc = 0.
          it_bseg-budat = it_ekbe-budat.
        ENDIF.
        READ TABLE it_skat WITH KEY saknr = it_bseg-hkont.
        IF sy-subrc = 0.
          IF it_skat-txt20 IS NOT INITIAL.
            it_bseg-acdes = it_skat-txt20.
          ELSE.
            it_bseg-acdes = it_skat-txt50.
          ENDIF.
        ENDIF.
        MODIFY it_bseg.
        CLEAR it_bseg.
      ENDLOOP.
      it_bseg1[] = it_bseg[].
      LOOP AT it_bseg1.
        IF it_bseg1-xref3 = ''.
          DELETE it_bseg1.
          CLEAR it_bseg1.
        ENDIF.
      ENDLOOP.
      LOOP AT it_bseg.
        READ TABLE it_bseg1 WITH KEY belnr = it_bseg-belnr.
        IF sy-subrc = 0.
          it_bseg-belnr1 = it_bseg1-xref3+4(10).
          it_bseg-xref3 = it_bseg1-xref3.
        ENDIF.
        MODIFY it_bseg.
        CLEAR it_bseg.
      ENDLOOP.
    ENDFORM.                    "data_retrive
    *&      Form  DISPLAY_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM display_report .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id         = ''
          i_callback_program      = g_repid
         i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_special_groups       = gt_sp_group[]
          it_sort                 = gt_sort[]
          it_filter               = gt_filter[]
          i_save                  = g_save
          is_variant              = g_variant
          it_events               = gt_events[]
          is_print                = gs_print
          it_alv_graphics         = gt_alv_graphics[]
          it_excluding            = gt_excluding
        TABLES
          t_outtab                = it_bseg.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    FORM build_layout.
      gs_layout-no_input          = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-totals_text       = 'Totals'(201).
      gs_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT

  • No accounting document at the time of MIGO in STO

    Hi,
    I am doing the following process in STO.
    1.Create PO ME21N
    2. In VL10B  to create a delivery
    3. VL02n do the Post goods issue with movement type 641
    4. In VF01 create the billing document where you will stock transfer price and Excise duties involved and this procedure is defined by SD people.
    5. In J1iin you will create excise invoice
    6. Now we are doing goods receipt (MIGO) and capture and post the excise invoice.
    But at the time of last step no accounting document is generating,only cenvat clearing a/c is generating.
    So how can we get the a/c document at the time of MIGO.
    Regards

    Hi,
    It will not offset the cenvat a/c because the accounting entries triggerred are different
    When u post a invoice thru J1iin
    Excise expense a/c Dr
    Excise payable a/c Cr
    This a/c will get offsetted when u pay the monthly excise liabilities thru utilisation.
    When u do GR and during that time the cenvat entries get posted as follows
    RG 23 A Part II a/c Dr
    Cenvat utilisation a/c Cr
    This a/c will get offsetted when u utilise this cenvat towards payment of the above duties.
    So when u perform GR for STO the a/c entries for stock does not get updated but it gets updated when you perform PGI during delivery.
    Hope this clarifies u.

  • FI/accounting document tab not working in migo or mb03

    Dear Experts,
    In our test server the accounting entries are not showing when we are trying to check those through MIGO(display) or mb03 by clicking FI document tab.
    Although all are valuated entries, what could be the reason, message is coming "No subsequent document found in Accounting"
    Message no. RW011
    Diagnosis
    All documents generated in Financial Accounting for object type 'MKPF',
    reference document number '5000341600' and organizational unit '2010' should be displayed.
    System Response
    No accompanying documents were found in Financial Accounting
    through mb03 it is showing
    Material document 5000341600 does not include an accounting document
    Message no. M7082
    Diagnosis
    The system cannot find an accounting document for the material document 5000341600.
    Possible reasons for this are:
    The goods movement has no relevance to accounting. Therefore, the system did not generate an accounting document for the material document.
    The material document is a document that was posted before Release 2.1. Such documents must be converted so that the system can find the relevant accounting document.
    The procedure for the subsequent calculation of value is not active in your system. For further information, refer to the documentation on the program for valuating goods movements: RM07MWBU.
    Procedure
    Choose Continue and then choose another function.
    Find out when the material document was created. If the document was created prior to the Release changeover, ask your system administrator to carry out the conversion of the documents. The individual steps required for document conversion are described in the Release Notes for Release 2.1B.
    Regards,
    Alokesh

    Hello,
    Check Account assignment category  Goods recipt check box is flaged or not,
    SPRO---PurchasingAccount assignment category- check the falg mark for related account assignment.
    Check Material type of material is that material is valued or not in OMS2.
    Regards
    Mahesh Naik.

  • No accounting document generated during MIGO

    Hi,
    While making good receipt of a purchase order, no accounting document were generated because of authorization. After giving authorization, the user cancelled good receipt, in this time accounting document were generated. After that the user made another good receipt and the accounting document generated. So we have one good receipt with no accounting document, one good receipt reverse with accounting document and one good receipt with accounting document. How can we fix this problem, we need to reverse cancelled good receipt's accounting document.
    Thanks,
    Edited by: Cuneyt Acar on Aug 31, 2010 9:56 AM

    >
    Cuneyt Acar wrote:
    > Hi,
    >
    > While making good receipt of a purchase order, no accounting document were generated because of authorization. After giving authorization, the user cancelled good receipt, in this time accounting document were generated. After that the user made another good receipt and the accounting document generated. So we have one good receipt with no accounting document, one good receipt reverse with accounting document and one good receipt with accounting document. How can we fix this problem, we need to reverse cancelled good receipt's accounting document.
    >
    > Thanks,
    >
    > Edited by: Cuneyt Acar on Aug 31, 2010 9:56 AM
    There is no reversal for cancelled GR,Create a new GR document using MIGO.

  • BADI/EXIT for MIGO for accounting  document posting

    Hi
    I am using MIGO where SAP post Mat Document and Accountying document.
    This Uses FM  'MB_POST_GOODS_MOVEMENT  < Include LMIGOKG1>, once this FM executed both MKPF and BKPF data gets filled . I can see tha data for MKPF in debug but I am not able to see data for Accounting Document.Even I cant see the Acc. document no assigned by SAP
    I need to change some fieds for Acc. Document <BSEG-VBUND>
    Can any one help me to find in which structure or table I can get data for Accounting document

    am using the method POST_DOCUMENT,
    am writing the code like..
    sample code..
    DATA: wa_mseg type mseg,
    wa_mch1 type mch1,
    wa_ausp type ausp.
    loop at it_mseg into wa_mseg.
    *select single * from mch1 into wa_mch1 where matnr = wa_mseg-matnr*
                                                               and charg = wa_mseg-charg.
    if sy-subrc is initial.
    *select * from ausp into wa_ausp where objek = wa_mch1-cuonj_bm*
                                                   and klart = '023'.
    if sy-subrc is initial.
    if wa_ausp-atwrt EQ 'ACCEPTED'.
    continue.
    else.
    if wa_ausp-atwrt EQ 'REJECTED'.
    call function 'popup_to_display_text'.
    endif.
    endif.
    endif.
    endif.
    endloop.
    when i debug ,i find no data in the mch1 table ..
    any help..
    thanx

Maybe you are looking for

  • Boots to flashing question mark folder and disc utility cannot locate internal hard drive

    Bottling my MacBook Pro I end up with a flashing question mark folder. I reboot holding the option key to select discs and there were no options at all. I plug in an Ethernet cable and it shows a internet recovery option. I click and it downloaded a

  • Org Unit Field in IT 0001

    Hi Folks- The Org Unit field in IT 0001in PA is not capturing the ORG unit stored in OM.Integration is active between OM and PA currently.The Job and position fields are carrying over without any issues. Used RHINTE30- and the org unit is allready th

  • Downloading TV episodes (or not...)?

    I have downloaded some TV episodes on one of the authorised computers (an old Dell that still runs XP and is not in the UK). I cannot now download them on any other device. Any help please?

  • Attachment for Purchase Requisition

    How to retreive a attachement of a Archived Purchase Requisition. The attachement is created by using services for the object option (Not at line item level)

  • Ld.so.1 not found

    Hi guys, dont know whether this is the right place ..but heres the problem $ ps ps: Cannot find /usr/lib/sparcv9/ld.so.1 Killed $ $ find / -name ld.so.1 /usr/lib/ld.so.1 /etc/lib/ld.so.1 $ ***heres my .profile extract*** LD_LIBRARY_PATH_64=/usr/lib:$