Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

*&---------------------------------------------------------------------* *& Report ZMRB_INVOICE_LIST_DISPLAY *Module : MM. *Technical Contact : Ronak Jhuthawat and Tenia Fernandes.

*Functional Contact : Ms. Jhansi *Technical Spec. Number : Technical Document number *& Created on : 9 Jun 2011. *Transport Req. :<Transport Request number> *& Description: Include program for Invoice List Display. *& Created by: Ronak Jhuthawat and Tenia Fernandes. *& Created on: 9 Jun 2011. *&---------------------------------------------------------------------* *& Description: ALV report for Invoice List Display. *& *&---------------------------------------------------------------------* REPORT zmrb_invoice_list_display.

*&---------------------------------------------------------------------* *.......... Table Declaration................ *&---------------------------------------------------------------------* TABLES : bkpf, bseg. "To declare the standard tables" TYPE-POOLS slis. "declares the data types and constants of type group tpool ie slis" TYPES : BEGIN OF struct_bkpf, Document Header" bukrs TYPE bukrs, belnr TYPE belnr_d, budat TYPE budat, xblnr TYPE xblnr1, waers TYPE waers, END OF struct_bkpf. TYPES : BEGIN OF struct_bseg, ocument Segment" bukrs TYPE bukrs, shkzg TYPE shkzg, dmbtr TYPE dmbtr, lifnr TYPE lifnr, matnr TYPE matnr, menge TYPE menge_d, meins TYPE meins, ebeln TYPE ebeln, END OF struct_bseg. TYPES : BEGIN OF struct_inv, bukrs TYPE bukrs, belnr TYPE belnr_d, budat TYPE budat, "Define the structure for table Accounting "Company Code" "Accounting Document Number" "Posting Date in the Document" "Reference Document Number" "Currency Key" "End of structure" "Define the structure for table Accounting D "Company Code" "Debit/Credit Indicator" "Amount in Local Currency" "Account Number of Vendor or Creditor" "Material" "Quantity" "Base Unit of Measure" "Purchasing Document Number" "End of structure" "Combine structure of two tables"

xblnr TYPE xblnr1, waers TYPE waers, shkzg TYPE shkzg, dmbtr TYPE dmbtr, lifnr TYPE lifnr, matnr TYPE matnr, menge TYPE menge_d, meins TYPE meins, ebeln TYPE ebeln, END OF struct_inv. DATA able"

"End of combine structure" "Declaring Internal T "Declare Work Area"

: i_bkpf TYPE TABLE OF struct_bkpf, wa_bkpf TYPE struct_bkpf, i_bseg TYPE TABLE OF struct_bseg, wa_bseg TYPE struct_bseg, i_inv TYPE TABLE OF struct_inv, wa_inv TYPE struct_inv, i_fcat TYPE slis_t_fieldcat_alv, wa_fcat TYPE slis_fieldcat_alv.

DATA : ws_d_hdt TYPE d, ws_d_ldt TYPE d.

"higher date variable" "Lower date variable"

SELECTION-SCREEN : BEGIN OF BLOCK inv WITH FRAME TITLE t1. "To create the user interaction screen with title" SELECT-OPTIONS : s_cmpcod FOR bkpfbukrs OBLIGATORY, "Company code Mandatory" s_vend FOR bseglifnr, "Account Number of vendor" s_cidi FOR bsegshkzg, "Credit or Debit Indicator" s_pstdat FOR bkpf-budat. SELECTION-SCREEN END OF BLOCK inv. INITIALIZATION. t1 = 'Program Selection'. INITIALIZATION.

"Posting Date"

"To display the heading"

"to fill the date in posting date field before one from the current month."" ws_d_hdt = sy-datum. "higher date variable store the current date" ws_d_hdt+6(2) = 01. ws_d_hdt = ws_d_hdt - 1. ws_d_ldt = ws_d_hdt. ws_d_ldt+6(2) = 01 . s_pstdat-low = ws_d_ldt.

s_pstdat-high = ws_d_hdt. APPEND s_pstdat.

START-OF-SELECTION. SELECT bukrs belnr budat xblnr waers

"Select Query for bkpf table fields"

FROM bkpf INTO TABLE i_bkpf WHERE bukrs IN s_cmpcod "-low"AND s_cmpcod-high AND budat IN s_pstdat.

IF i_bkpf IS INITIAL. MESSAGE 'NO RECORDS FOUND' TYPE 'S'. ELSE. SELECT bukrs shkzg dmbtr lifnr matnr menge meins ebeln

"Select Query for bseg table fields"

FROM bseg INTO TABLE i_bseg FOR ALL ENTRIES IN i_bkpf WHERE bukrs = i_bkpf-bukrs AND lifnr IN s_vend AND shkzg IN s_cidi. ENDIF. LOOP AT i_bseg INTO wa_bseg . "Loop to fetch values from two tables"

READ TABLE i_bkpf INTO wa_bkpf IF sy-subrc EQ 0. wa_inv-bukrs = wa_bkpf-bukrs wa_inv-belnr = wa_bkpf-belnr wa_inv-budat = wa_bkpf-budat wa_inv-waers = wa_bkpf-waers wa_inv-xblnr = wa_bkpf-xblnr wa_inv-lifnr = wa_bseg-lifnr wa_inv-menge = wa_bseg-menge wa_inv-meins = wa_bseg-meins wa_inv-dmbtr = wa_bseg-dmbtr wa_inv-matnr = wa_bseg-matnr wa_inv-ebeln = wa_bseg-ebeln

WITH KEY bukrs = wa_bseg-bukrs. . . . . . . . . . . .

APPEND wa_inv TO i_inv."appending the values from work area to internal table"" CLEAR wa_inv. "Initialization of work area" ENDIF. ENDLOOP. END-OF-SELECTION. PERFORM populate_fieldcat. "statement calls the subroutine specified " PERFORM display_record. *&---------------------------------------------------------------------* *& Form populate_fieldcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM populate_fieldcat . "Definition Of subroutine" wa_fcat-tabname = 'I_INV'. wa_fcat-fieldname = 'BUKRS'. wa_fcat-seltext_m = 'CO CD '. APPEND wa_fcat TO i_fcat. CLEAR wa_fcat. wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO CLEAR wa_fcat. wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO CLEAR wa_fcat. wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO 'I_INV'. = 'LIFNR'. = 'INV PTY '. i_fcat.

'I_INV'. = 'BELNR'. = 'DOC NO '. i_fcat.

'I_INV'. = 'BUDAT'. = 'PSTG DAT '. i_fcat. 'I_INV'. = 'XBLNR'. = 'REFERENCE'. i_fcat.

wa_fcat-tabname = 'I_INV'. wa_fcat-fieldname = 'MENGE'. wa_fcat-seltext_m = 'QUANTITY '.

APPEND wa_fcat TO i_fcat. wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO wa_fcat-tabname = wa_fcat-fieldname wa_fcat-seltext_m APPEND wa_fcat TO CLEAR wa_fcat. ENDFORM. 'I_INV'. = 'MEINS'. = 'UOM '. i_fcat. 'I_INV'. = 'DMBTR'. = 'AMOUNT '. i_fcat. 'I_INV'. = 'WAERS'. = 'CURRENCY '. i_fcat. 'I_INV'. = 'MATNR'. = 'MATERIAL '. i_fcat. 'I_INV'. = 'EBELN'. = 'PURCH DOC '. i_fcat.

"POPULATE_FIELDCAT

*&---------------------------------------------------------------------* *& Form DISPLAY_RECORD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM display_record . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = sy-repid i_structure_name = 'STRUCT_INV' it_fieldcat = i_fcat[] i_save = 'A' TABLES t_outtab = i_inv. ENDFORM. "DISPLAY_RECORD

You might also like