7.10.15ALV Report

REPORT sy-repid.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

*-----------------------------------------------------------------------

*/ Description :This program creates an ALV report for Daily Cash

* Receipts for a selected date range.

*-----------------------------------------------------------------------

* Global data declaration

TYPE-POOLS: slis.

* Global structure of list

TYPES: BEGIN OF i_cust_invoices, "This is a temp-table where SELECT

"data is to be stored.

bkpf LIKE bkpf, "Acct Doc Header structure

bseg LIKE bseg, "Acct Doc Segment struc

kna1 LIKE kna1, "Customer Master struc

skat LIKE skat, "Chart of Accts struc

END OF i_cust_invoices.

TABLES: bkpf, "TABLES: def of Database tables.

bseg,

kna1,

skat.

*/ Selection and Input Parameters

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.

SELECT-OPTIONS: s_belnr FOR bseg-belnr, "Acct Doc number

s_budat FOR bkpf-budat, "Doc Posting Date

s_blart FOR bkpf-blart DEFAULT 'DZ'. "Document Type

SELECTION-SCREEN END OF BLOCK block1.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: gt_outtab TYPE i_cust_invoices OCCURS 0 WITH HEADER LINE.

DATA: g_repid LIKE sy-repid.

DATA: i_bkpf TYPE bkpf OCCURS 0 WITH HEADER LINE.

* Initialization fieldcatalog

INITIALIZATION.

g_repid = sy-repid.

PERFORM fieldcat_init USING gt_fieldcat[].

* Start of Selection

START-OF-SELECTION.

* Data selection

PERFORM select_data TABLES gt_outtab.

* Display list

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = g_repid

it_fieldcat = gt_fieldcat[]

TABLES

t_outtab = gt_outtab.

*-----------------------------------------------------------------------

* Forms

*-----------------------------------------------------------------------

* Initialization fieldcatalog DEFINITION OF HEADING.

* Fieldnames and ref_fieldnames MUST be UPPER CASE !!

FORM fieldcat_init

USING rt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: pos TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-BUDAT'. "Posting Date

ls_fieldcat-ref_fieldname = 'BUDAT'.

ls_fieldcat-ref_tabname = 'BKPF'.

ls_fieldcat-key = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-BELNR'. "Acct Doc Number

ls_fieldcat-ref_fieldname = 'BELNR'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-HKONT'. "Acct number

ls_fieldcat-ref_fieldname = 'HKONT'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-KOSTL'. "<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><place w:st="on"><placename w:st="on">Cost</placename><placetype w:st="on">Center</placetype></place>

ls_fieldcat-ref_fieldname = 'KOSTL'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'SKAT-TXT20'. "Acct Description

ls_fieldcat-ref_fieldname = 'TXT20'.

ls_fieldcat-ref_tabname = 'SKAT'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'SKAT-TXT50'. "Acct Description

ls_fieldcat-ref_fieldname = 'TXT50'.

ls_fieldcat-ref_tabname = 'SKAT'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

* ls_fieldcat-col_pos = pos.

* ls_fieldcat-fieldname = 'BSEG-AUGBL'. "Clearing Doc

* ls_fieldcat-ref_fieldname = 'AUGBL'.

* ls_fieldcat-ref_tabname = 'BSEG'.

* APPEND ls_fieldcat TO rt_fieldcat.

* CLEAR ls_fieldcat.

* pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-KUNNR'. "Cust number

ls_fieldcat-ref_fieldname = 'KUNNR'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'KNA1-NAME1'. "Customer name

ls_fieldcat-ref_fieldname = 'NAME1'.

ls_fieldcat-ref_tabname = 'KNA1'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-XBLNR'. "Ref Doc (Check) Number

ls_fieldcat-ref_fieldname = 'XBLNR'.

ls_fieldcat-ref_tabname = 'BKPF'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-SHKZG'. "DR/CR <state w:st="on"><place w:st="on">ind</place></state>.

ls_fieldcat-ref_fieldname = 'SHKZG'.

ls_fieldcat-ref_tabname = 'BSEG'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-WRBTR'. "Amt in Doc Currency

ls_fieldcat-ref_fieldname = 'WRBTR'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-WAERS'. "Currency Key

ls_fieldcat-ref_fieldname = 'WAERS'.

ls_fieldcat-ref_tabname = 'BKPF'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-KURSF'. "Exchange Rate

ls_fieldcat-ref_fieldname = 'KURSF'.

ls_fieldcat-ref_tabname = 'BKPF'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-DMBTR'. "Amt in Local Currency

ls_fieldcat-ref_fieldname = 'DMBTR'.

ls_fieldcat-ref_tabname = 'BSEG'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-GJAHR'. "Fiscal Year

ls_fieldcat-ref_fieldname = 'GJAHR'.

ls_fieldcat-ref_tabname = 'BSEG'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-BUZEI'. "Doc Line #

ls_fieldcat-ref_fieldname = 'BUZEI'.

ls_fieldcat-ref_tabname = 'BSEG'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BSEG-BSCHL'. "Posting Key

ls_fieldcat-ref_fieldname = 'BSCHL'.

ls_fieldcat-ref_tabname = 'BSEG'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

* <place w:st="on"><placename w:st="on">Cost</placename><placetype w:st="on">Center</placetype></place> is not needed for cash posting - only expenses.

*

* ls_fieldcat-col_pos = pos.

* ls_fieldcat-fieldname = 'BSEG-KOSTL'. "<place w:st="on"><placename w:st="on">Cost</placename><placetype w:st="on">Center</placetype></place>

* ls_fieldcat-ref_fieldname = 'KOSTL'.

* ls_fieldcat-ref_tabname = 'BSEG'.

* APPEND ls_fieldcat TO rt_fieldcat.

* CLEAR ls_fieldcat.

* pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-BUKRS'. "Company Code

ls_fieldcat-ref_fieldname = 'BUKRS'.

ls_fieldcat-ref_tabname = 'BKPF'.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'BKPF-BLART'. "Document Type

ls_fieldcat-ref_fieldname = 'BLART'.

ls_fieldcat-ref_tabname = 'BKPF'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

margin: 0c

你可能感兴趣的:(xml,Microsoft,Office,Exchange)