Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Former Member
Not what you were looking for? View more on this topic or Ask a question