Deleting accounting document

Hi,
I am having a billing document where an accounting document was generated for that but not cleared. Now I want to cancel the billing document through VF11. Shall I cancel the accounting document also before cancelling the Billing document or it will cancel automatically when I cancel the billing document? If I have to cancel the accounting document also manually, then please tell me the procedure.
Regards
Ramesh

Hi
Invoice can be canceled using T code <b>VF11 </b>and then you can reverse the Goods Issue using <b>VL09 </b>and making the picking quantity zero in the delivery document and delete the delivery order using <b>VL02N </b>. You can then delete the sales order then.
Ask your FI guy to reverse the accounting doc. Only after the accounting doc is reversed and/or deleted, you can cancel your invoice. You also need to check if any TAX documents are generated with your Invoice. You need to reverse/delete those documents also.

Similar Messages

  • I made a new Apple ID and I want to delete my iCloud account on my iPhone, will it delete only documents or data or it will reset my whole iPhone?

    I made a new Apple ID and I want to delete my iCloud account on my iPhone, will it delete only documents or data or it will reset my whole iPhone, like deleting my apps, contacts. Please I need your help.

    All you have to do is this: Sync your 3GS to create a current backup. Then either: Settings>General>Reset>Erase All Content & Settings or restore it as a "New" device in iTunes. Both accomplish the same thing, erasing all of your data & settings from the phone. You can now give it to your sister, she can plug it into her computer, name it what she wants & sync her content to it. You then restore your 4S from the backup of the 3GS you created when you started. Follow this by syncing your content to your new phone & your 4S will look just like your 3GS.

  • Find accounting document for deleted incoming invoice document

    Hi all,
    I have few ncoming invoice documents which were deleted. those documents i can see in RBKP table.
    I want to trace the accounting documents for those deleted documents.
    Can any one help me to find the accounting documents for deleted documents.
    thanks in advance.

    Hi,
    this might give you an idea:
    data: l_belnr like bkpf-belnr, l_gjahr like bkpf-gjahr.
    clear: l_belnr, l_gjahr.
    data: l_string(20) type c.
    clear l_string.
    data: l_belnr_2 like bkpf-belnr, l_gjahr_2 like bkpf-gjahr.
    clear: l_belnr_2, l_gjahr_2.
    select belnr gjahr from rbkp into (l_belnr, l_gjahr)
    where rbstat = '2'. "Status = deleted
    concatenate l_belnr l_gjahr into l_string.
    select single belnr gjahr from bkpf into (l_belnr_2, l_gjahr_2)
    where awkey = l_string.
    write: /'FI', l_belnr_2, l_gjahr_2, 'MM', l_belnr, l_gjahr.
    endselect.
    Note that the key here is AWKEY.
    Best regards.
    Edited by: Pablo Casamayor on Apr 13, 2009 3:03 PM

  • FM for linking deleted sales order and accounting document

    Hi there,
    I have this scenario:
    -I create a sales order and make a certain amount of downpayment.
    -At the save of the order, an accounting document is created in BSEG table with reference to this order (BSEG-VBEL2).
    -I delete the order that I created in step 1.
    -The accounting document still exists in BSEG.
    Question:
    A direct select on BSEG with vbel2, takes a very long time.
    Can anyone suggest a way to improve the performance, or does anyone know of a Fuction Module that I can use?
    Thanks,
    Deepti

    Hi,
    Con't you use alternative table, Example insted BSEG use BSID and create a index on VBEL2 to improve the performance..
    Regards,
    Srinivasa M

  • HT4436 can i delete photos documents etc on my icloud account?

    can i delete photos documents etc on my icloud account?

    Yes, delete them from the appropriate application/app on your device.

  • Invoice posted in 2006 by mistake, no accounting document generated

    Dear Expert
    The user created an invoice by mistake on today's date , but billing date was 2006. as the periods are closed , it did not create any accounting document. now when the user realized his mistake he made cancellation of the invoice in the same posting date as of 2006. and even for this the accounting document was not created.
    Now both these  invoice and its cancellations are appearing in the VF04, billing due list.
    is there a way to remove both these invoices from billing due list....or a way to delete them.  We discussed the matter with accounts team and they disagreed to open the closed periods of 2006 as it may cause many discrepancies .
    so some how we need to get rid of them and make new invoice in 2012.  Although we can post the cancellation in 2012 by changing the billing date which is open for changes. but what about the invoice , we are not able to change the billing date as it is disable due to proceeding cancellation document.
    We need you urgent advise...
    Best regards,

    Hi
    If the user executes by keeping the billing date from feild as blank then you have to take the help of ABAP team and make sure that  the billing document number which  has been generated is not there in the database,it has to be deleted from all tables.Also check wheather it is possible to do any changes in SDBILLDL program
    Regards
    Srinath

  • Invoice & Accounting Document Number

    Dear Experts,
    We are facing number range problem. When we are saveing an invoice then Invoice number and accounting document number showing different. It should come same number. Can you pls advice why this is happening and how I can resolve this issue.
    Thanks in advance for your kind support.
    Best Regards.
    Ripon Kumar Paul

    Dear Ripon,
    Please check the below which will help you achieve same document number:
    SAP gives you customizing options to make both document numbers the same. The solution lies in the number range assignment of the MM and FI document. You need to configure the MM document number assignment as internal and external for the FI documents. (FI documents are set up with external-assigned numbering, while the MM document has internal, or system-generated, numbering.) In this case, the MM document number is passed on to the FI document, which means that the number of the FI document is identical to the MM document.
    Because the document number assignment in MM is not company code-specific, in contrast to the FI document, you need to take the following points into consideration before using external document number assignments for FI documents. They have the following effects on your system:
    Continuous number assignments for FI documents are not guaranteed, especially if you have more than one company code.
    The document number ranges in MM and FI have to be the same for all company codes.
    In Release 4.6C, you need to use internal number assignments for revaluation documents, invoice reduction documents, Evaluated Receipt Settlement (ERS) postings, or reversal documents. There are no restrictions as of SAP Enterprise 4.70.
    Use a different number range assignment for FI invoice posting (FB60), because FI invoice postings usually use internal number range assignments and the postings originate in FI, not MM.
    If you use document parking and the number range intervals are fiscal year-dependent, you cannot change the posting date of the document if the fiscal year is different to that determined for the previous posting date. In this case you have to delete the document and re-enter it. There are no restrictions for fiscal year-independent number ranges.
    What do you do if you have already posted thousands of invoices in your system and the numbers are already different? In this case, you need to find unused number range intervals in MM and FI. Since most companies do not change the SAP standard delivered number ranges during the original implementation, number range interval 52 is usually available in MM and FI.
    Now let's look at the detailed customizing steps. With the following customizing steps, you can align the MM and FI document numbers going forward only. No fix is available for invoices already posted in your system, since SAP does not allow the change of document numbers.
    Step 1. Maintain FI document number range. Use transaction OMR4 and go to Number range for document types in FI. Select the company code for which you want to create the new number range interval and click on the change interval button. Insert a new document number range by clicking on the insert interval button on top of the screen. In this example, I created number range interval 52 with the document numbers 5200000000 u2013 5299999999. Don't forget to set the external number range check box (Ext).
    Step 2. Assign FI number range to FI document types. The second step is to assign the number range created in step 1 to the FI document type for invoices. Again use transaction OMR4 and go to Document type. Double-click on the document type, which you are using for LIV invoices. In my example, I used the SAP standard document type RE. In the number range field, assign the new number range interval 52.
    Thanks!!!
    Murlidhar Khatri

  • How to delete the home folder of a deleted account?

    After I set up a new account, I transferred everything from my old macbook pro to my new iMac (so it has a moutain lion system. I'm sure you know it. Just want to make it clear ) through migration assistance from time machine. Then I realized that an extra account (my old one) plus many unnecessary data had been transferred to my new iMac. Therefore, I decided to delete this old account.
    HOWEVER, when I deleted the account, I failed to delete the home folder--I chose to delete it securely; but after it started backing up, I simply cancel the backup (which is a HUGE mistake) Then I found the account was deleted but its home folder stayed-- it occupied over 150GB of my new iMac.
    Could anyone tell me how I can delete the home folder securely?
    in addition, since I only want to transfer iphoto pictures, iTune music and some important documents to my new account, should I simply copy thme to an external drive and transfer them to my new account?
    Thanks a lot for your help!

    In system preferences, create a new account again, using the short name of the "deleted" account. You may be prompted to re-use the old home folder. Log out and log in to test it worked. Then log in as your new admin, and do the delete process again. Don't choose to securely delete this time - just a regular delete.
    When you have time to spare, go to Disk Utility, and use the Erase tab to securely erase free space on the drive. This will accomplish the same thing that your originally tried to do. Use the fastest method - anything more secure is a waste of time. You may need to run it overnight - it can take several hours.
    Matt

  • ICloud Deleted a document from all my devices and I didn't want it to. Help!?

    I just upgraded my ipad and my mom's ipad to IOS5 a few days ago and I linked them both the the iCloud. What I didn't anticipate is that when I chose to allow the iCloud to work for my documents in pages, it suddenly transfered the files from my mom's ipad to mine and vise versa. Seeing these unwanted documents and not knowing what she was doing, my mom promptly deleted the documents that had been mine from her ipad and suddenly they all disappeared from mine too! I cannot find them anywhere! Can anyone help me??? I had three very important documents in there! I only have hope because my ipad says that it last backed up to the icloud yesterday at 10 PM so shouldn't that mean that my documents are floating around somewhere? I tried going into the settings for the icloud and into the files it has saved for pages but all that I found was a list of all the documents that were my moms which did not get deleted. Is there any way for me to restore my ipad to the last backup from the icloud? I assume that that should restore the documents somehow since they were there at the last restore but I could be wrong. The reason they suddenly synced together was because my mom and I just now opened our newly updated versions of pages for the first time and they asked us if we wanted to use icloud and when we chose yes they synced everything because I have my moms ipad set up with the same apple ID as mine. Any help?? If it is not possible to restore my documents can anyone at least give me some advice on how to stop this from happening again in the future? Thanks for any help!

    Sounds like you're both sharing the same iCloud account.  Don't.

  • Error in Posting Accounting Document from invoice

    Hi,
    When i create invoice, the system gives error while creating accounting document as,
    "Tax code Y1 does not appear in any G/L account item".
    In my pricing procedure. i have two tax condition types. MWST and ZSED (copy of mwst). when i delete ZSED from my pricing procedure and then i create a sales order/delivery & finally invoice...then it works fine (Accuonting document is created successfully).
    i have assigned the gl accounts in vkoa. and MWST & ZSED goes to same gl account via MWS accounting key.
    although i have searched the forum for this issue, but that didnt resolved my issue.
    seeking your guidance.

    Dear Robert,
    I'm having same issue as yours.
    The requirement for us is if return sales in some order reason codes, then tax should be posted to different G/L other than the G/L defined in OB40(transaction MWS).
    After several test, found the system only recognize the G/L in OB40, won't touch setting in VKOA. As if I delete the GL in table T030R, SAP will issue an error requesting GL assignment.
    Please let me know if you have solved your issue! If yes, please share your solution! 
    Thanks in advance!

  • Accounting document not generated for cancled credit memo

    Hi,
    its related to rebet
    den cancled credit memo.but accounting document not generated.
    after that created new rebet and accounting document generated..so in document flow status showing open for cancled credti memo. how to delete or clear this? or how to cancle this?
    kindly help me on this,
    Thanks,
    Regards,
    Minesh Soneji

    Error message:
    validation user has got error " Doc.Date<=Post.Date and  Postind Date <= Current date"
    kindly help me on this..
    global docs creaetd.........................................completed
        global invoice created... ...............................completed
             accounting document created.............not cleared
                 cancle of credit memo ......................open
                     global docs created........................cleared
                          accounting docs created ........cleared.
    i need to remove this status cancle of credit memo , status is open, there should be accounting docs...
    kindly help me on this..
    this is related to rebet.
    thanks,
    minesh soneji

  • 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

  • Purchase order haven't generate accounting document

    Dear Experts,
    I was created subcontracting PO and I forget to make check on invoice receipt,  gr base IV or Final invoice in INVOICE TAB.
    When I going to create invoice with reference of PO its shows no suitable item was found.
    Please provide the solution.
    Thanks,
    Farrukh khan

    Hello,
    How  system will alllow you to create the PO without GR based Invoice, if yes. then check is their material used in Subcontracting PO is Non valued  (check in OMS2). if material is non valued then system will not generate anu A/C document
    --Check GR. is their any accounting documents genearted or not?
    -If then delete the PO and create one more PO with same combination and confirm the entries.
    Regards
    Mahesh Naik.

  • How to "hold" G/L Account Document?

    I use T-CODE F-02 to Enter G/L Account Document.I want to hold current document and input tomorrow again.So I select the menu Document->Hold.But the sap show the error message like below.
    Is there any one could tell me how to resolve the problem or give me some advice?I will appreciate him/her very much.Thank you.
    error message:
    Held documents must be converted; read long text
    Message no. F5410
    Diagnosis
    The structure of the document data has changed in the meantime. Before new documents can be held or held documents can be processed, the documents held up to now must be converted.
    Procedure
    The conversion of the held documents is carried out by report RFTMPBLU . For larger data volumes (more than a couple of hundred held documents), the report should be planned as a batch job.
    The conversion of held documents is generally supported for documents which were entered in release 1.3A or later.
    A conversion of older held documents is not possible. You must delete these documents with the report RFTMPBLD . Afterwards, you must start the report RFTMPBLU to activate the version management for held documents.
    If only small datasets are to be converted or deleted, you can carry out the action in another window and after completing the action, continue the current processing.

    Hi,
    In the new versions from SAP (ERP 2004 and ERP 2005) There are 2 versions to keep documents:
    Parked documents.
    Hold documents. (this is not the option Hold data, from system / user profile / hold data)
    For completing them there are special transactions. The best is to use one of these options (I use parked documents) otherwise it is difficult to found documents back. This is the reason to for the coversion question
    Paul

  • No accounting document generated (foreign trade data incomplete)

    hello all,
    I meet a problem like this:
    Sales order: 1001
    delivery: 2001
    Invoice: 3001
    another invoice 9001 has created for cancel 3001.
    when we saveed 9001, no accounting document generated, but we were not cognizant of it. and we did VF09 reverse PGI, VL02 delete delivery 2001.
    now the problem is: when we try to release invoice 9001 to accounting, a message occurs "Document 9001 has been saved (foreign trade data incomplete)"
    it seems need data of delivery 2001, but it has been deleted.
    can anyone please give me suggestions? thanks!
    Document 9001 has been saved (foreign trade data incomplete)
        Message no. VF 072
    Diagnosis
        The billing document you have edited contains foreign trade data. These
        are however not complete.
        This means that the document cannot be transferred to accounting (FI).
    System Response
        The system issues a message.
    Procedure
        Maintain the incomplete foreign trade data. Then you can transfer the
        billing document to accounting (FI).

    Hai Laxmipathi,
    As the issue addressed by Mu_ying, exactly even I have encountered the same error. I am working on Export Scenario where in created a billing doc and saved (without foreign trade data) but later its cancelled and subsequent delivery doc is also cancelled but when i release the cancelled billing doc error pops up as "foreign data incomplete" but doc no. is saved, as mentioned by Mr. Mu_ying mail.
    However, in my case when i try change in VF02 item level for foreign trade/customs tab (change for the cancelled doc) the radio buttons for System is RED, and I am unable to enter the data as all the fields are greyed out, due to this reports figures are incorrect.  Hope u r able to get what i have mentioned.
    i/p's will be of great help.

Maybe you are looking for

  • IF and SUBSTR in XML Publisher

    Hi I am developing a XML RTF template for a report. All I am trying to do is, if first 4 letters of the data of xml tag ITEM = 'Summ' then print a constant word 'Notes' <?if: xdofx:substr(ITEM,1,4)='Summ'?> Notes<?end if?> I have been trying hard. IF

  • DVD menu title selection on DVD player with DVD's burn from iDVD

    Regarding DVDs burned with iDVD 6.0.3, I have burned multiple DVDs with 6 buttons on the main menu page each of which links to a short film. On the menu screen when I push the right arrow button on the DVD remote not all the menu buttons light up. In

  • Motif look and feel

    if i run the following code,it displayes a dialog with missing title text import javax.swing.JOptionPane; import javax.swing.UIManager; public class TestMotif {      * @param args      public static void main(String[] args) {           try           

  • Macbook pro fan always running - cpus are pegged by kernel

    I reloaded the os with no change.  When restarted the fans start and the cpus are pegged within 1 minute.

  • Signal Booster in Home

    We live in a hilly area near Eau Claire, WI and as a result our signal is almost non-existent within our home. Going outside does giver us a signal but a very weak one and find ourselves not using the phone very much in the home. Have had to get a la