|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
FBL3n可以查出的,选中Parked items
FBL3n可以查出所有parked document的,选中Parked items,但是没有tax 为17%的,
看看下面表结构,再请你的ABAper 将下面的程序加一条件就可以完全满足你的要求
VBKPFDocument Header for Document Parking
VBSEGDocument Parking Document Segment
VBSEGADocument Segment for Assets Document Parking
VBSEGSDocument Segment for G/L Accounts Document Parking
VBSEGKDocument Segment for Vendor Document Parking
VBSEGDDocument Segment for Customer Document Parking
附程序
*&-------------------------------------------------------------------
*
*& Report : ZSCFIGLR017
*
*& Creation Date : 2002.12.13*
*
*& Description : Print out parked docs
*
*&-------------------------------------------------------------------
*
REPORT zscfiglr017 LINE-SIZE 80 LINE-COUNT 60
NO STANDARD PAGE HEADING MESSAGE-ID ZSFI.
TABLES : vbkpf, "Document header for preliminary posting
vbsegk, "Preliminary posting doc.segment for vendors
vbsegd, "Preliminary posting doc.segment for customer
vbsegs, "Preliminary posting doc.segment for G/L accts
vbsega,
t003t, "Document type texts
skat, "G/L account master record
lfa1, "Vendor master (general section
kna1, "Customer master (general section
cskt, "Cost center texts
bseg,
anla,
anlz,
t001,
tka02.
* Internal table for storing document number header data
DATA : BEGIN OF ht OCCURS 0,
belnr LIKE vbkpf-belnr, "Document No.
budat LIKE vbkpf-budat, "Posting Date
gjahr LIKE vbkpf-gjahr, "Fiscal Year
bukrs LIKE vbkpf-bukrs, "Company Code
xblnr LIKE vbkpf-xblnr, "Reference No.
bldat LIKE vbkpf-bldat, "Document Date
blart LIKE vbkpf-blart, "Document Type
waers LIKE vbkpf-waers, "Currency Code
kursf(10) TYPE p DECIMALS 4, "Exchange Rate
ltext LIKE t003t-ltext, "Document Type Description
usnam LIKE vbkpf-usnam, "Entered by
END OF ht.
* Internal table for storing line item data per document number
DATA : BEGIN OF it OCCURS 0,
belnr LIKE vbkpf-belnr, "Document No.
gjahr LIKE vbkpf-gjahr, "Fiscal Year
bukrs LIKE vbkpf-bukrs, "Company Code
buzei LIKE vbsegs-buzei, "Document Item line No.
bschl LIKE vbsegs-bschl, "Posting Key
saknr LIKE vbsegs-saknr, "Acct No. of Line item
hkont like vbsega-hkont,
zuonr LIKE vbsegs-zuonr, "allocation
txt20 LIKE skat-txt20, "Account Code short text
txt50 LIKE skat-txt50, "Account Code long text
dmbtr LIKE vbsegs-dmbtr, "Amount for line item
lifnr LIKE vbsegk-lifnr, "Vendor
name1 LIKE lfa1-name1, "Vendor code name
kunnr LIKE vbsegd-kunnr, "customer
* add by shujw
name3 LIKE kna1-name3, "Customer code name3
* over by shujw
anln1 like vbsega-anln1,
anln2 like vbsega-anln2,
name2 LIKE anla-txt50, "Asset description
bzdat LIKE bseg-bzdat, "Asset value date
gsber LIKE vbsegs-gsber, "Business area
kostl LIKE vbsegs-kostl, "Cost center code
ktext LIKE cskt-ktext, "Cost center name
sgtxt LIKE vbsegs-sgtxt, "Line item description
wrbtr(10) TYPE p DECIMALS 2, "Amount in foreign currency
waers LIKE vbkpf-waers, "Currency code
kursf(10) TYPE p DECIMALS 4, "Exchange Rate
END OF it.
DATA : tot_page TYPE i. "Total number of pages
data : butxt(30).
*&-------------------------------------------------------------------
*
* SELECTION-SCREEN.
*&-------------------------------------------------------------------
*
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK bk WITH FRAME TITLE ttl1.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS bukrs FOR vbkpf-bukrs MEMORY ID BUK.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS belnr FOR vbkpf-belnr MEMORY ID BLN. "Document number
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS budat FOR vbkpf-budat .
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS bldat FOR vbkpf-bldat. "Document date
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS gjahr FOR vbkpf-gjahr ."Fiscal year
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS usnam FOR vbkpf-usnam ."Entered by
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK bk.
*&-------------------------------------------------------------------
*
* INITIALIZATION.
*&-------------------------------------------------------------------
*
INITIALIZATION.
ttl1 = '【 Condition 】'.
*&-------------------------------------------------------------------
*
* AT SELECTION-SCREEN.
*&-------------------------------------------------------------------
*
AT SELECTION-SCREEN.
SELECT single *
* BUKRS INTO T001-BUKRS
FROM T001
WHERE BUKRS IN BUKRS.
butxt = t001-butxt.
* ENDSELECT.
*&-------------------------------------------------------------------
*
* START-OF-SELECTION.
*&-------------------------------------------------------------------
*
START-OF-SELECTION.
SET MARGIN 7 5.
* Find document header data and line item data from given parameters.
PERform find_document USING tot_page.
* Print data in internal table
PERform print_slip.
*&-------------------------------------------------------------------
*
* TOP-OF-PAGE.
*&-------------------------------------------------------------------
*
* Print header on top of each page.
TOP-OF-PAGE.
PERform write_header.
*--------------------------------------------------------------------
*
* form FIND_DOCUMENT
*
*--------------------------------------------------------------------
*
* Find document header data and line item data from given parameters.
* VBKPF -> Doc. No Header data
*
* VBSEGS, VBSEGK -> Line item data
*
*--------------------------------------------------------------------
*
* --> TOT_PAGE *
*--------------------------------------------------------------------
*
form find_document USING tot_page.
DATA : line TYPE i, "number of records in internal
modular TYPE i, "Quotion
residue TYPE i. "Remainder
* Find header data
SELECT * FROM vbkpf WHERE bukrs IN bukrs
AND belnr IN belnr
AND gjahr IN gjahr
AND usnam IN usnam
AND budat IN budat
AND bldat IN bldat.
MOVE : vbkpf-belnr TO ht-belnr, "Document Number
vbkpf-budat TO ht-budat, "Posting date
vbkpf-bldat TO ht-bldat, "Doc. date
vbkpf-xblnr TO ht-xblnr, "Reference No.
vbkpf-bukrs TO ht-bukrs, "Company code
vbkpf-blart TO ht-blart, "Doc. type
vbkpf-gjahr TO ht-gjahr, "Fiscal year
vbkpf-waers TO ht-waers, "Currency code
vbkpf-usnam TO ht-usnam. "Entered by
ht-kursf = vbkpf-kursf.
APPEND ht.
ENDSELECT.
DESCRIBE TABLE ht LINES line.
* no document found
IF line EQ 0.
* MESSAGE i006 WITH 'document number'.
MESSAGE S006 WITH 'document number'. "update by lzc
ENDIF.
* Find line item data for each document and store it in
* internal table IT.
LOOP AT ht.
SELECT SINGLE ltext INTO ht-ltext
FROM t003t
WHERE spras EQ sy-langu
AND blart EQ ht-blart.
MODIFY ht INDEX sy-tabix transporting ltext.
* Search G/L Account Line Item
SELECT * FROM vbsegs WHERE ausbk EQ ht-bukrs
AND belnr EQ ht-belnr
AND gjahr EQ ht-gjahr
AND bukrs EQ ht-bukrs.
CLEAR it.
MOVE : ht-waers TO it-waers, "Currency code
ht-kursf TO it-kursf, "Exchange rate
ht-bukrs TO it-bukrs, "Company code
ht-gjahr TO it-gjahr. "Fiscal year
MOVE : vbsegs-belnr TO it-belnr, "Document No
vbsegs-buzei TO it-buzei, "Line Item number
vbsegs-saknr TO it-saknr, "Account No.
vbsegs-gsber TO it-gsber, "Business area
vbsegs-kostl TO it-kostl, "Cost center
vbsegs-zuonr TO it-zuonr, "allocation
vbsegs-sgtxt TO it-sgtxt, "Line item description
vbsegs-wrbtr TO it-wrbtr, "Document curr. line item amt.
vbsegs-bschl TO it-bschl. "Posting Key
if ht-waers eq 'CNY'.
it-dmbtr = vbsegs-wrbtr.
else.
it-dmbtr = vbsegs-dmbtr. "wrbtr.
endif.
APPEND it.
ENDSELECT.
* Search Vendor line item
SELECT * FROM vbsegk WHERE ausbk EQ ht-bukrs
AND belnr EQ ht-belnr
AND gjahr EQ ht-gjahr
AND bukrs EQ ht-bukrs.
CLEAR it.
** add by shujw 20030306
* SELECT SINGLE name1 INTO it-name1
* FROM lfa1
* WHERE lifnr EQ vbsegk-lifnr.
** add over
MOVE : ht-waers TO it-waers, "Currency code
ht-kursf TO it-kursf, "Exchange rate
ht-bukrs TO it-bukrs, "Company code
ht-gjahr TO it-gjahr. "Fiscal year
MOVE : vbsegk-belnr TO it-belnr, "Document No.
vbsegk-buzei TO it-buzei, "Line item number
vbsegk-hkont TO it-saknr, "Account No.
vbsegk-lifnr TO it-lifnr, "Vendor
vbsegk-zuonr to it-zuonr, "Assignment
vbsegk-sgtxt TO it-sgtxt, "Description of Line item
vbsegk-gsber TO it-gsber, "Business area
vbsegk-wrbtr TO it-wrbtr, "Document curr. line item amt
vbsegk-bschl TO it-bschl. "Posting key
if ht-waers eq 'CNY'.
it-dmbtr = vbsegk-wrbtr.
else.
it-dmbtr = vbsegk-dmbtr. "Line item amount
endif.
APPEND it.
ENDSELECT.
* Search customer line item
SELECT * FROM vbsegd WHERE ausbk EQ ht-bukrs
AND belnr EQ ht-belnr
AND gjahr EQ ht-gjahr
AND bukrs EQ ht-bukrs.
CLEAR it.
** add by shujw 20030306
* SELECT SINGLE name1 INTO it-name3
* FROM kna1
* WHERE kunnr EQ vbsegd-kunnr.
** add over
MOVE : ht-waers TO it-waers, "Currency code
ht-kursf TO it-kursf, "Exchange rate
ht-bukrs TO it-bukrs, "Company code
ht-gjahr TO it-gjahr. "Fiscal year
MOVE : vbsegd-belnr TO it-belnr, "Document No.
vbsegd-buzei TO it-buzei, "Line item number
vbsegd-hkont TO it-saknr, "Account No.
vbsegd-kunnr TO it-kunnr, "customer
vbsegd-zuonr to it-zuonr, "Assignment
vbsegd-sgtxt TO it-sgtxt, "Description of Line item
vbsegd-gsber TO it-gsber, "Business area
vbsegd-wrbtr TO it-wrbtr, "Document curr. line item amt
vbsegd-bschl TO it-bschl. "Posting key
if ht-waers eq 'CNY'.
it-dmbtr = vbsegd-wrbtr.
else.
it-dmbtr = vbsegd-dmbtr. "wrbtr. "Line item amount
endif.
APPEND it.
ENDSELECT.
SELECT * FROM vbsega WHERE ausbk EQ ht-bukrs
AND belnr EQ ht-belnr
AND gjahr EQ ht-gjahr
AND bukrs EQ ht-bukrs.
CLEAR it.
** add by shujw 20030306
* SELECT SINGLE name1 INTO it-name3
* FROM kna1
* WHERE kunnr EQ vbsegd-kunnr.
** add over
MOVE : ht-waers TO it-waers, "Currency code
ht-kursf TO it-kursf, "Exchange rate
ht-bukrs TO it-bukrs, "Company code
ht-gjahr TO it-gjahr. "Fiscal year
MOVE : vbsega-belnr TO it-belnr, "Document No.
vbsega-buzei TO it-buzei, "Line item number
vbsega-hkont TO it-saknr, "Account No.
vbsega-anln1 TO it-anln1, "customer
vbsega-anln2 to it-anln2,
vbsega-zuonr to it-zuonr, "Assignment
vbsega-sgtxt TO it-sgtxt, "Description of Line item
vbsega-wrbtr TO it-wrbtr, "Document curr. line item amt
vbsega-bschl TO it-bschl. "Posting key
if ht-waers eq 'CNY'.
it-dmbtr = vbsega-wrbtr.
else.
it-dmbtr = vbsega-dmbtr. "wrbtr. "Line item amount
endif.
APPEND it.
ENDSELECT.
ENDLOOP.
MOVE line TO modular.
DESCRIBE TABLE it LINES line.
* no line item found
IF line EQ 0.
* MESSAGE i006 WITH 'LINE ITEM'.
MESSAGE S006 WITH 'document number'. "update by lzc
ENDIF.
SORT it BY belnr gjahr bukrs buzei.
* Find data for each line item
LOOP AT it.
CLEAR: t001,tka02.
SELECT SINGLE ktopl INTO (t001-ktopl) "Chart of accounts
FROM t001
WHERE bukrs = ht-bukrs.
SELECT SINGLE kokrs INTO (tka02-kokrs) "Control Area
FROM tka02
WHERE bukrs = ht-bukrs.
CLEAR : it-ktext, it-name1.
* Posting key : 01 ~ 39
IF it-bschl GE '01' AND it-bschl LE '39'
or it-bschl eq '70' or it-bschl eq '75'.
SELECT SINGLE txt20 INTO it-txt50
FROM skat
WHERE spras EQ sy-langu
AND ktopl EQ t001-ktopl
AND saknr EQ it-saknr.
ELSE.
SELECT SINGLE ktext INTO it-ktext "Get cost center
FROM cskt
WHERE kostl EQ it-kostl
AND spras EQ sy-langu
AND kokrs EQ tka02-kokrs
AND datbi EQ '99991231'.
ENDIF.
IF it-bschl EQ '40' OR it-bschl EQ '50'.
SELECT SINGLE txt20 INTO it-txt50
FROM skat
WHERE spras EQ sy-langu
AND ktopl EQ t001-ktopl
AND saknr EQ it-saknr.
ELSEIF it-bschl EQ '70' OR it-bschl EQ '75'.
SELECT SINGLE txt50 INTO it-name2
FROM anla
WHERE bukrs EQ it-bukrs
AND anln1 EQ it-anln1
AND anln2 EQ it-anln2.
SELECT SINGLE txt20 INTO it-txt50
FROM skat
WHERE spras EQ sy-langu
AND ktopl EQ t001-ktopl
AND saknr EQ it-hkont.
ELSEIF it-bschl GE '01' AND it-bschl LE '19'.
SELECT SINGLE name1 INTO it-name1
FROM kna1
WHERE kunnr EQ it-kunnr.
ELSEIF it-bschl GE '21' AND it-bschl LE '39'.
SELECT SINGLE name1 INTO it-name1
FROM lfa1
WHERE lifnr EQ it-lifnr.
ENDIF.
MODIFY it INDEX sy-tabix TRANSPORTING txt50 ktext name1.
ENDLOOP.
* Total number of lines to print except headers
* # of line items * 5 + # of doc. * 5 <- for total & comment
modular = ( line * 5 ) + ( modular * 5 ).
tot_page = modular DIV 30.
residue = modular MOD 30.
IF residue NE 0.
tot_page = tot_page + 1.
ENDIF.
ENDform.
*--------------------------------------------------------------------
*
* form WRITE_HEADER
*
*--------------------------------------------------------------------
*
* Print out document title and approval box
*
*--------------------------------------------------------------------
*
form write_header.
formAT INTENSIFIED ON.
PRINT-CONTROL SIZE 16.
IF BUKRS-LOW = 'C6M0'.
WRITE : /32 ' 记 帐 凭 证 ',
/32 '============='.
ELSE.
WRITE : /32 ' 预 制 凭 证 ',
/32 '============='.
ENDIF.
formAT INTENSIFIED OFF.
SKIP.
PRINT-CONTROL SIZE 12.
WRITE : /30(46) sy-uline.
WRITE : /3 ht-bukrs, butxt,
30 '|', 39 '|', 48 '|', 57 '|', 66 '|', 75 '|'.
ULINE (75).
ENDform.
form print_slip.
DATA : date(10),
curr_line TYPE i value 10,
last_line TYPE i,
tot_dr(10) TYPE p DECIMALS 2,
tot_cr(10) TYPE p DECIMALS 2.
DESCRIBE TABLE it LINES last_line.
LOOP AT ht.
PERform write_item_header.
curr_line = 20.
* IF CURR_LINE GT 45 AND SY-PAGNO LT TOT_PAGE.
* NEW-PAGE.
* PERform WRITE_ITEM_HEADER.
* CURR_LINE = 20.
*
* ENDIF.
LOOP AT it WHERE belnr EQ ht-belnr AND gjahr EQ ht-gjahr.
* formAT COLOR COL_NORMAL.
WRITE : / it-buzei, "Document line item no.
7 it-bschl, "Posting key
13 it-saknr. "Account No. of line item
* IF IT-TXT20 = SPACE.
WRITE : 26(30) it-txt50.
* ELSE.
* WRITE : 26(23) IT-TXT20. "Account code description
* ENDIF.
IF it-bschl EQ '40'
OR ( it-bschl GE '01' AND it-bschl LE '09' )
OR ( it-bschl GE '21' AND it-bschl LE '29' )
or ( it-bschl ge '80' and it-bschl le '89' )
OR ( it-bschl EQ '70' ).
WRITE : 46(14) it-dmbtr DECIMALS 2. "Line item amount
tot_dr = tot_dr + it-dmbtr. "Total debit amount
ELSEIF it-bschl EQ '50'
OR ( it-bschl GE '11' AND it-bschl LE '19' )
OR ( it-bschl GE '31' AND it-bschl LE '39' )
or ( it-bschl ge '90' and it-bschl le '99' )
or ( it-bschl eq '75' ).
WRITE : 60(14) it-dmbtr DECIMALS 2. "Line item amount
tot_cr = tot_cr + it-dmbtr. "Total credit amount
ENDIF.
* IF IT-LIFNR IS INITIAL AND IT-KOSTL IS INITIAL. "wml
* SKIP. "wml
* ENDIF. "wml
* WRITE : / IT-LIFNR, "Vendor code
* 12(30) IT-NAME1, "Vendor name
WRITE : / it-zuonr, "allocation
26 it-gsber, "Business area
33 it-kostl, "Cost center
40 it-ktext, "Cost center name
/ it-sgtxt. "Line item description
IF it-sgtxt IS INITIAL.
SKIP.
ENDIF.
* For line item with foreign currency, print exchange rate
IF it-waers NE 'CNY'.
WRITE : /(15) it-wrbtr, "10 -> 15
16 it-waers,
22 'Exch Rate',
29(10) it-kursf DECIMALS 4.
* add by shujw 20030306
iF it-bschl ge '21' and it-bschl le '39' . "vendor
write :39 it-lifnr,49(24) it-name1.
endif.
IF it-bschl ge '01' and it-bschl le '19' . "customer
write :39 it-kunnr,49(24) it-name1.
endif.
IF it-bschl eq '70' or it-bschl eq '75' .
WRITE : 39 it-anln1,49(24) it-name2. "Asset code
ENDIF.
ELSE.
IF it-bschl ge '21' and it-bschl le '39' . "vendor
write :/39 it-lifnr,49(24) it-name1.
elseif it-bschl ge '01' and it-bschl le '19' . "customer
write :/39 it-kunnr,49(24) it-name3.
elseif it-bschl eq '70' or it-bschl eq '75' .
WRITE :/39 it-anln1,49(24) it-name2. "Asset code
else.
skip.
ENDIF.
* add over
ENDIF.
ULINE (75).
curr_line = curr_line + 5.
* WRITE : / 'CURR_LINE', CURR_LINE COLOR 3.
IF curr_line GT 50. "go to next page
* AND SY-PAGNO LT TOT_PAGE.
* IF SY-TABIX NE LAST_LINE.
NEW-PAGE.
PERform write_item_header.
curr_line = 20.
ENDIF.
* ENDIF.
* formAT COLOR OFF.
ENDLOOP.
* Write total debit amount and total credit amount
* formAT COLOR COL_TOTAL.
formAT INTENSIFIED OFF.
WRITE : / '合计 : ',
46(14) tot_dr DECIMALS 2,
60(14) tot_cr DECIMALS 2.
* formAT COLOR OFF.
ULINE (75).
tot_dr = 0.
tot_cr = 0.
SKIP.
* Put comment at the end of a document
NEW-PAGE.
curr_line = 10.
ENDLOOP.
ENDform.
*&-------------------------------------------------------------------
*
*& form WRITE_ITEM_HEADER
*&-------------------------------------------------------------------
*
form write_item_header.
* formAT COLOR COL_HEADING.
WRITE : / '凭证号码 : ',
12 ht-belnr. "Document no.
WRITE : 50 '记帐日期 : ',
62 ht-budat, "Posting date
/ '备注号码 : ',
12 ht-xblnr. "Reference no.
WRITE : 50 '发票日期 : ',
62 ht-bldat, "Document date
/ '凭证类型 : ',
12 ht-blart, "Document type
20 ht-ltext, "Description
50 '制 单 : ',
62 ht-usnam. "Operator
* / ''.
ULINE (75).
WRITE : / '项目',
7 '借/贷',
13 '会计科目代码',
26 '会计科目',
55 '借方',
69 '贷方',
/ '关键字段',
26 '分公司',
37 '部门',
/ '摘要',
/6 '外币金额',
39 '代码及名称',
65 '页数 ',
70(3) sy-pagno.
* formAT COLOR OFF.
* WRITE : / ''.
ULINE (75).
ENDform. " WRITE_ITEM_HEADER
|
|