中方会计凭证由于 编码格式 以及 科目对照关系 是无法直接使用SAP自带的凭证打印功能的,如下为客户开发的一个解决方案,供各位参考

1).需要定制几个Table的结构

zc0000fit0009【科目对照表】

SAP中方会计凭证打印解决方案-LMLPHP

2).

 REPORT  zc0000fir0013 NO STANDARD PAGE HEADING
LINE-COUNT
LINE-SIZE .
*---------------------------------------------------------------------*
* TABLES
*---------------------------------------------------------------------*
TABLES: bkpf,zc0000fit0009. TYPE-POOLS: slis. *---------------------------------------------------------------------*
* Types (ty_)
*---------------------------------------------------------------------*
TYPES:
BEGIN OF gty_bkpf,
bukrs TYPE bkpf-bukrs, "Company Code
belnr TYPE bkpf-belnr, "Accounting Document Number
gjahr TYPE bkpf-gjahr, "Fiscal Year
blart TYPE bkpf-blart, "document type
budat TYPE bkpf-budat, "Payment time
monat TYPE bkpf-monat, "Fiscal Period
cpudt TYPE bkpf-cpudt, "Day Was Entered
usnam TYPE bkpf-usnam, "User Name
*start add alex han 20130604
ppnam TYPE bkpf-ppnam,
*end add alex han 20130604
xblnr TYPE bkpf-xblnr, "Reference Document Number
bktxt TYPE bkpf-bktxt, "Document Header Text
waers TYPE bkpf-waers, "Currency Key
kursf TYPE bkpf-kursf, "Exchange rate
END OF gty_bkpf, BEGIN OF gty_bseg,
bukrs TYPE bkpf-bukrs, "Company Code
belnr TYPE bkpf-belnr, "Accounting Document Number
gjahr TYPE bkpf-gjahr, "Fiscal Year
buzei TYPE bseg-buzei, "Number of Line
hkont TYPE bseg-hkont, "General Ledger Account
kostl TYPE bseg-kostl, "Cost Center
prctr TYPE bseg-prctr, "Profit Center
wrbtr TYPE bseg-wrbtr, "Amount in Document Currency
dmbtr TYPE bseg-dmbtr, "amount in local currency
shkzg TYPE bseg-shkzg, "Debit/Credit Indicator
zuonr TYPE bseg-zuonr, "Assignment Number
sgtxt TYPE bseg-sgtxt, "Item Text
lifnr TYPE bseg-lifnr, "vendor
kunnr TYPE bseg-kunnr, "customer
koart TYPE bseg-koart, "Account Type
aufnr TYPE bseg-aufnr, "ORER
*& Start of Insertion CR0158 by Davy on 2013/08/14
fkber TYPE bseg-fkber, "function area
*& End of Insertion CR0158 by Davy on 2013/08/14
END OF gty_bseg, BEGIN OF gty_head,
bukrs TYPE bkpf-bukrs, "Company Code
belnr TYPE bkpf-belnr, "SAP Document Number
gjahr TYPE bkpf-gjahr, "Fiscal Year
budat TYPE char30, "posting date
name1 TYPE comp_txt, "company name
prcnr TYPE zc0000fit0009-prcnr,"PRC number
prctp TYPE zc0000fit0008-prctp,"PRC Doc.Type Name
prctt TYPE zc0000fit0008-prctt,"PRC Doc.Type Title
acmgr TYPE text10, "Acc mgr
dbchk TYPE text10, "double check
usnam TYPE bkpf-usnam, "user name
ppnam TYPE bkpf-ppnam,
*& Begin of Modification CR00222 BY YE_S on 2013/12/02
persnumber TYPE adrp-persnumber, "人员编号
name_first TYPE adrp-name_first, "名
name_last TYPE adrp-name_last, "姓
*& End of Modification CR00222 BY YE_S on 2013/12/02
END OF gty_head, BEGIN OF gty_item,
bukrs TYPE bkpf-bukrs, "Company Code
belnr TYPE bkpf-belnr, "Accounting Document Number
gjahr TYPE bkpf-gjahr, "Fiscal Year
hkont TYPE bseg-hkont, "General Ledger Account
kostl TYPE bseg-kostl, "Cost Center
lifnr TYPE bseg-lifnr, "vendor
kunnr TYPE bseg-kunnr, "customer
shkzg TYPE bseg-shkzg, "Debit/Credit Indicator
xblnr TYPE bkpf-xblnr, "Reference Document Number #01
bktxt TYPE bkpf-bktxt, "Document Header Text
sgtxt TYPE bseg-sgtxt, "Item Text
zuonr TYPE bseg-zuonr, "Assignment Number
prctr TYPE bseg-prctr, "Profit Center #01
name1 TYPE zc0000fit0007-prcnm1,"PRC Name1 #02
name2 TYPE ad_name2, "PRC_Name2” + “CostCenter #03
waers TYPE bkpf-waers, "Currency Key #04
wrbtr TYPE bseg-wrbtr, "Amount in Document Currency #05
dmbtr TYPE bseg-dmbtr, "amount in local currency #07/8
kursf TYPE bkpf-kursf, "Exchange rate #06
END OF gty_item, BEGIN OF gty_list,
sel() TYPE c, "selection flag
bukrs TYPE bkpf-bukrs, "Company Code
belnr TYPE bkpf-belnr, "Accounting Document Number
gjahr TYPE bkpf-gjahr, "Fiscal Year
blart TYPE bkpf-blart, "document type
budat TYPE bkpf-budat, "Payment time
monat TYPE bkpf-monat, "Fiscal Period
cpudt TYPE bkpf-cpudt, "Day Was Entered
usnam TYPE bkpf-usnam, "User Name
*start add by alex han 20130604
ppnam TYPE bkpf-ppnam,
*end add by alex han 20130604
xblnr TYPE bkpf-xblnr, "Reference Document Number
bktxt TYPE bkpf-bktxt, "Document Header Text
waers TYPE bkpf-waers, "Currency Key
kursf TYPE bkpf-kursf, "Exchange rate
prcnr TYPE zc0000fit0009-prcnr,"PRC number
prctp TYPE zc0000fit0008-prctp,"PRC Doc.Type Name
name1 TYPE comp_txt, "company name
pflag TYPE char10, "print flag
END OF gty_list,
*& Start of Insertion CR0000 by Zoey on 2014/08/25
BEGIN OF gty_ska,
saknr TYPE ska1-saknr,
xbilk TYPE ska1-xbilk,
txt50 TYPE skat-txt50,
END OF gty_ska.
*& End of Insertion CR0000 by Zoey on 2014/08/25 *---------------------------------------------------------------------*
* Internal Tables (git_)
*---------------------------------------------------------------------*
DATA:
git_t001 TYPE STANDARD TABLE OF t001 WITH HEADER LINE, "#EC *
git_bkpf TYPE STANDARD TABLE OF gty_bkpf WITH HEADER LINE, "#EC *
git_bseg TYPE STANDARD TABLE OF gty_bseg WITH HEADER LINE, "#EC *
git_list TYPE STANDARD TABLE OF gty_list WITH HEADER LINE, "#EC *
git_head TYPE STANDARD TABLE OF gty_head WITH HEADER LINE, "#EC *
git_item TYPE STANDARD TABLE OF gty_item WITH HEADER LINE, "#EC *
git_prcnm TYPE STANDARD TABLE OF zc0000fit0007 WITH HEADER LINE,"#EC*
git_prctp TYPE STANDARD TABLE OF zc0000fit0008 WITH HEADER LINE,"#EC*
git_prclg TYPE STANDARD TABLE OF zc0000fit0009 WITH HEADER LINE,"#EC*
git_upd09 TYPE STANDARD TABLE OF zc0000fit0009 WITH HEADER LINE,"#EC*
git_header TYPE STANDARD TABLE OF gty_head WITH HEADER LINE, "#EC *
git_detail TYPE STANDARD TABLE OF gty_item WITH HEADER LINE, "#EC *
*& Start of Insertion CR0000 by Zoey on 2014/08/25
git_ska TYPE STANDARD TABLE OF gty_ska WITH HEADER LINE. "#EC *
*& End of Insertion CR0000 by Zoey on 2014/08/25 * ALV Related
DATA: git_fieldcat TYPE slis_t_fieldcat_alv,
git_comments TYPE slis_t_listheader,
git_events TYPE slis_t_event. * Work Area
DATA: gwa_fieldcat TYPE slis_fieldcat_alv.
DATA: gwa_output TYPE gty_list.
*---------------------------------------------------------------------*
* Global Variables (gv_)
*---------------------------------------------------------------------*
DATA: g_repid TYPE sy-repid, "PROGRAM
g_amtup TYPE char100. *----------------------------------------------------------------------*
** Range Declaration
*----------------------------------------------------------------------*
RANGES: r_lifnr FOR ekko-lifnr,
r_ebeln FOR ekko-ebeln. *---------------------------------------------------------------------*
* Constants (c_)
*---------------------------------------------------------------------*
CONSTANTS:
c_e TYPE char1 VALUE 'E',
c_x TYPE char1 VALUE 'X',
c_perct TYPE char1 VALUE '%',
c_sign_i TYPE char1 VALUE 'I',
c_option_eq TYPE char2 VALUE 'EQ',
c_03 TYPE char2 VALUE '',
c_sel TYPE field_name VALUE 'SEL',
c_bukrs TYPE field_name VALUE 'BUKRS',
c_belnr TYPE field_name VALUE 'BELNR',
c_gjahr TYPE field_name VALUE 'GJAHR',
c_blart TYPE field_name VALUE 'BLART',
c_budat TYPE field_name VALUE 'BUDAT',
c_monat TYPE field_name VALUE 'MONAT',
c_cpudt TYPE field_name VALUE 'CPUDT',
c_usnam TYPE field_name VALUE 'USNAM',
*START-ADD BY ALEX HAN20130604
c_ppnam TYPE field_name VALUE 'PPNAM',
*END-ADD BY ALEX HAN 20130604
c_xblnr TYPE field_name VALUE 'XBLNR',
c_bktxt TYPE field_name VALUE 'BKTXT',
c_waers TYPE field_name VALUE 'WAERS',
c_kursf TYPE field_name VALUE 'KURSF',
c_prctp TYPE field_name VALUE 'PRCTP',
c_prcnr TYPE field_name VALUE 'PRCNR',
c_name1 TYPE field_name VALUE 'NAME1',
c_hkont TYPE field_name VALUE 'HKONT',
c_kostl TYPE field_name VALUE 'KOSTL',
c_prctr TYPE field_name VALUE 'PRCTR',
c_wrbtr TYPE field_name VALUE 'WRBTR',
c_dmbtr TYPE field_name VALUE 'DMBTR',
c_zuonr TYPE field_name VALUE 'ZUONR',
c_shkzg TYPE field_name VALUE 'SHKZG',
c_sgtxt TYPE field_name VALUE 'SGTXT',
c_pflag TYPE field_name VALUE 'PFLAG',
c_save_all TYPE c LENGTH VALUE 'A',
c_ddictxt_l TYPE c LENGTH VALUE 'L',
c_ddictxt_m TYPE c LENGTH VALUE 'M',
c_ddictxt_s TYPE c LENGTH VALUE 'S',
c_formname TYPE tdsfname VALUE 'ZC0000FIS0001',
c_pf_set TYPE slis_formname VALUE 'PF_STATUS_SET',
c_user_command TYPE slis_formname VALUE 'USER_COMMAND_ALV',
*& Start of Insertion CR0000 by Zoey on 2014/08/25
c_a001 TYPE ktopl VALUE 'A001',
c_zh TYPE spras VALUE ''.
*& End of Insertion CR0000 by Zoey on 2014/08/25
*---------------------------------------------------------------------*
* Macro
*---------------------------------------------------------------------*
DEFINE set_fc.
clear gwa_fieldcat.
gwa_fieldcat-tabname = 'GIT_REP'.
gwa_fieldcat-fieldname = &.
gwa_fieldcat-cfieldname = &.
gwa_fieldcat-seltext_l = &.
gwa_fieldcat-do_sum = &.
gwa_fieldcat-ddictxt = c_ddictxt_l.
if gwa_fieldcat-fieldname() = 'PERCT'.
gwa_fieldcat-just = 'R'.
endif.
if gwa_fieldcat-fieldname = 'BUKRS' or
gwa_fieldcat-fieldname = 'BELNR' or
gwa_fieldcat-fieldname = 'GJAHR'.
gwa_fieldcat-key = c_x.
endif.
append gwa_fieldcat to git_fieldcat.
END-OF-DEFINITION. *---------------------------------------------------------------------*
* Selection screen data
* select-options (s_)
* parameters (p_)
* radio buttons (rb_)
* checkboxes (cb_)
* pushbuttons (pb_)
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS:
s_bukrs FOR bkpf-bukrs OBLIGATORY,
s_belnr FOR bkpf-belnr OBLIGATORY,
s_prcnr FOR zc0000fit0009-prcnr,
s_gjahr FOR bkpf-gjahr OBLIGATORY,
s_blart FOR bkpf-blart OBLIGATORY,
s_budat FOR bkpf-budat NO-EXTENSION OBLIGATORY,
s_cpudt FOR bkpf-cpudt NO-EXTENSION ."NO INTERVALS
*START-Modify by davy 2013/06/14
SELECT-OPTIONS:
s_usnam FOR bkpf-usnam NO-EXTENSION NO INTERVALS,
s_ppnam FOR bkpf-ppnam NO-EXTENSION NO INTERVALS.
*PARAMETERS:
* p_usnam TYPE bkpf-usnam,
*START-ADD BY ALEX 20130604
* p_ppnam TYPE bkpf-ppnam .
*END-ADD BY ALEX 20130604
*START-Modify by davy 2013/06/14
SELECTION-SCREEN END OF BLOCK blk1. SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-t02. "#EC *
PARAMETERS:
p_cmpnm TYPE comp_txt OBLIGATORY,
p_acmgr TYPE text10,
p_dbchk TYPE text10.
SELECTION-SCREEN END OF BLOCK blk2. *---------------------------------------------------------------------*
* Initialization
*---------------------------------------------------------------------*
INITIALIZATION.
PERFORM init_data. *---------------------------------------------------------------------*
* AT SELECTION-SCREEN
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM check_data. *---------------------------------------------------------------------*
* TOP-OF-PAGE
*---------------------------------------------------------------------*
*TOP-OF-PAGE. ***********************************************************************
* START-OF-SELECTION PROCESSING *
***********************************************************************
START-OF-SELECTION.
* get data from database tabl
PERFORM get_data.
* process data in internal table
PERFORM process_data. ***********************************************************************
* END-OF-SELECTION PROCESSING *
***********************************************************************
END-OF-SELECTION.
IF NOT git_list[] IS INITIAL.
IF sy-batch = c_x.
PERFORM print_data_background.
ELSE.
* output the final data
PERFORM display_data.
ENDIF.
ELSE.
MESSAGE s099(ba) DISPLAY LIKE c_e WITH text-m01..
ENDIF. *&---------------------------------------------------------------------*
*& Form INIT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_data . g_repid = sy-repid. CLEAR: git_bkpf,git_bseg,git_list,git_head,git_item,
git_prctp,git_prcnm,git_prclg. REFRESH: git_bkpf,git_bseg,git_list,git_head,git_item,
git_prctp,git_prcnm,git_prclg. ENDFORM. " INIT_DATA *&---------------------------------------------------------------------*
*& Form CHECK_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_data .
* check the company code valid
REFRESH git_t001.
SELECT * FROM t001 INTO TABLE git_t001
WHERE bukrs IN s_bukrs.
IF sy-subrc <> .
MESSAGE e006(zc001) WITH s_bukrs-low s_bukrs-high.
ENDIF. LOOP AT git_t001.
AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
ID 'BUKRS' FIELD git_t001-bukrs
ID 'ACTVT' FIELD ''.
IF sy-subrc <> .
MESSAGE e099(ba) WITH text-m02.
ENDIF.
ENDLOOP. ENDFORM. " CHECK_DATA *&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
* Get voucher doucment header data
SELECT
bukrs "Company Code
belnr "Accounting Document Number
gjahr "Fiscal Year
blart "document type
budat "posting date
monat "Fiscal Period
cpudt "Day Was Entered
usnam "User Name
*START ADD ALEX HAN 20130604
ppnam
*END ADD ALEX HAN 20130604
xblnr "Reference Document Number
bktxt "Document Header Text
waers "Currency Key
kursf "Exchange rate
FROM bkpf
INTO TABLE git_bkpf
WHERE bukrs IN s_bukrs
AND belnr IN s_belnr
AND gjahr IN s_gjahr
AND blart IN s_blart
AND budat IN s_budat
AND cpudt IN s_cpudt
AND usnam IN s_usnam
*START-ADD BY ALEXHAN 20130604
AND ppnam IN s_ppnam.
*END-ADD BY ALEX HAN 20130604 IF git_bkpf[] IS INITIAL.
MESSAGE s099(ba) DISPLAY LIKE c_e WITH text-m01.
STOP.
ELSE. SELECT
bukrs "Company Code
belnr "Accounting Document Number
gjahr "Fiscal Year
buzei "Number of Line
hkont "General Ledger Account
kostl "Cost Center
prctr "Profit Center
wrbtr "Amount in Document Currency
dmbtr "amount in local currency
shkzg "Debit/Credit Indicator
zuonr "Assignment Number
sgtxt "Item Text
lifnr "vendor
kunnr "customer
koart "acct type
aufnr "ORDER
*& Start of Insertion CR0158 by Davy on 2013/08/14
fkber "function area
*& End of Insertion CR0158 by Davy on 2013/08/14
FROM bseg INTO TABLE git_bseg
FOR ALL ENTRIES IN git_bkpf
WHERE bukrs = git_bkpf-bukrs
AND belnr = git_bkpf-belnr
AND gjahr = git_bkpf-gjahr. ENDIF. * get SAP account number and PRC number
SELECT * INTO TABLE git_prcnm FROM zc0000fit0007
WHERE hkont <> ''. * get Document type and PRC document type mapping table
SELECT * INTO TABLE git_prctp FROM zc0000fit0008
WHERE blart <> ''. * get PRC number
SELECT * INTO TABLE git_prclg FROM zc0000fit0009
WHERE bukrs IN s_bukrs
AND belnr IN s_belnr
AND gjahr IN s_gjahr.
* AND prcnr IN s_prcnr.
*& Start of Insertion CR0000 by Zoey on 2014/08/25
SELECT a~saknr a~xbilk b~txt50 INTO TABLE git_ska FROM ska1 AS a
JOIN skat AS b ON a~saknr = b~saknr
FOR ALL ENTRIES IN git_bseg
WHERE a~ktopl = c_a001
AND a~saknr = git_bseg-hkont
AND b~spras = c_zh.
*& End of Insertion CR0000 by Zoey on 2014/08/25
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form PROCESS_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM process_data.
DATA: l_amt TYPE wertv8.
DATA: l_func TYPE csks-func_area.
DATA: l_name1 TYPE kna1-name1.
DATA: l_xbilk TYPE ska1-xbilk.
DATA: lit_item TYPE STANDARD TABLE OF gty_item WITH HEADER LINE.
DATA: lit_bseg TYPE STANDARD TABLE OF gty_bseg WITH HEADER LINE.
DATA: l_kostl TYPE bseg-kostl,
l_aufnr TYPE bseg-aufnr. * collect the PRC Doc.Type Name and title
SORT git_prctp BY blart.
SORT git_prclg BY bukrs belnr gjahr.
SORT git_t001 BY bukrs. LOOP AT git_bkpf.
MOVE-CORRESPONDING git_bkpf TO git_list.
READ TABLE git_prctp WITH KEY blart = git_bkpf-blart.
IF sy-subrc = .
git_list-prctp = git_prctp-prctp.
ENDIF. git_list-name1 = p_cmpnm. IF git_list-name1 IS INITIAL.
READ TABLE git_t001 WITH KEY bukrs = git_bkpf-bukrs
BINARY SEARCH.
IF sy-subrc = .
git_list-name1 = git_t001-butxt.
ENDIF.
ENDIF. READ TABLE git_prclg WITH KEY bukrs = git_bkpf-bukrs
belnr = git_bkpf-belnr
gjahr = git_bkpf-gjahr.
IF sy-subrc = .
git_list-prcnr = git_prclg-prcnr.
git_list-pflag = text-h17.
ELSE. PERFORM set_next_prcno USING git_bkpf-bukrs
git_bkpf-gjahr
git_bkpf-monat
CHANGING git_list-prcnr.
git_list-pflag = text-h18.
ENDIF. READ TABLE git_t001 WITH KEY bukrs = git_bkpf-bukrs.
IF git_bkpf-waers <> git_t001-waers. " AND
PERFORM convert_rate USING git_bkpf-waers git_bkpf-kursf
CHANGING git_list-kursf.
ELSE.
MOVE git_list-kursf TO git_list-kursf.
ENDIF. APPEND git_list.
CLEAR git_list.
ENDLOOP. * for print header data
LOOP AT git_list. MOVE-CORRESPONDING git_list TO git_head. CONCATENATE git_list-budat() text-t03 git_list-budat+() text-t04
git_list-budat+() text-t05 INTO git_head-budat. READ TABLE git_prctp WITH KEY blart = git_list-blart.
IF sy-subrc = .
git_head-prctt = git_prctp-prctt.
ENDIF. git_head-acmgr = p_acmgr.
git_head-dbchk = p_dbchk. APPEND git_head.
CLEAR git_head.
ENDLOOP. SORT git_bkpf BY bukrs belnr gjahr.
SORT git_prcnm BY hkont kostl.
*& Start of Insertion CR0000 by Zoey on 2014/08/25
SORT git_ska BY saknr.
*& End of Insertion CR0000 by Zoey on 2014/08/25
REFRESH lit_bseg.
lit_bseg[] = git_bseg[]. SORT lit_bseg BY bukrs belnr gjahr lifnr kunnr. * collect voucher data for list
LOOP AT git_bseg.
MOVE-CORRESPONDING git_bseg TO git_item.
READ TABLE git_bkpf WITH KEY bukrs = git_bseg-bukrs
belnr = git_bseg-belnr
gjahr = git_bseg-gjahr.
IF sy-subrc = .
MOVE:
git_bkpf-xblnr TO git_item-xblnr,
git_bkpf-bktxt TO git_item-bktxt,
git_bkpf-waers TO git_item-waers.
READ TABLE git_t001 WITH KEY bukrs = git_bseg-bukrs.
IF git_bkpf-waers <> git_t001-waers. " AND
PERFORM convert_rate USING git_bkpf-waers git_bkpf-kursf
CHANGING git_item-kursf.
ELSE.
MOVE git_bkpf-kursf TO git_item-kursf.
ENDIF. IF git_bkpf-waers = git_t001-waers.
CLEAR git_item-wrbtr.
ENDIF.
ENDIF. READ TABLE git_prcnm WITH KEY hkont = git_bseg-hkont.
IF sy-subrc = .
IF git_prcnm-prccd1 = 'COSTCENTER'.
* first class account
SELECT SINGLE func_area INTO l_func FROM csks
WHERE kostl = git_bseg-kostl
AND bukrs = git_bseg-bukrs. "#EC *
IF sy-subrc = .
SELECT SINGLE prcnm1 INTO git_item-name1
FROM zc0000fit0010
WHERE func_area = l_func.
ENDIF. git_item-name2 = git_prcnm-prcnm2.
IF NOT git_bseg-kostl IS INITIAL.
* CONCATENATE git_item-name2 git_bseg-kostl
* INTO git_item-name2 SEPARATED BY space.
*& Start of Insertion CR0158 by Davy on 2013/08/14
ELSE.
IF git_item-name1 IS INITIAL.
SELECT SINGLE prcnm1 INTO git_item-name1
FROM zc0000fit0010
WHERE func_area = git_bseg-fkber.
ENDIF.
*& End of Insertion CR0158 by Davy on 2013/08/14
ENDIF.
* interanl order
IF NOT git_bseg-aufnr IS INITIAL.
CLEAR l_aufnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = git_bseg-aufnr
IMPORTING
output = l_aufnr.
CONCATENATE git_item-name2 l_aufnr
INTO git_item-name2 SEPARATED BY space.
ENDIF. ELSE.
git_item-name1 = git_prcnm-prcnm1.
git_item-name2 = git_prcnm-prcnm2. CLEAR l_name1. IF git_bseg-lifnr <> '' AND git_bseg-koart = 'K'.
SELECT SINGLE name1 INTO l_name1 FROM lfa1
WHERE lifnr = git_bseg-lifnr.
ENDIF.
IF git_bseg-kunnr <> '' AND git_bseg-koart = 'D'.
SELECT SINGLE name1 INTO l_name1 FROM kna1
WHERE kunnr = git_bseg-kunnr.
ENDIF. IF NOT l_name1 IS INITIAL.
CONCATENATE git_item-name2 '-' l_name1 INTO git_item-name2.
ENDIF. ENDIF.
*& Start of Insertion CR0000 by Zoey on 2014/08/25 ELSE. * If GL account XXXXXX is not maintained in mapping table
* ZC0000FIT0007
READ TABLE git_ska WITH KEY saknr = git_bseg-hkont.
* Balance sheet account
IF git_ska-xbilk IS NOT INITIAL.
PERFORM frm_Balance. ELSE.
* Profit & Loss account
PERFORM frm_Profit. ENDIF.
*& End of Insertion CR0000 by Zoey on 2014/08/25
ENDIF. APPEND git_item.
CLEAR git_item.
ENDLOOP. CLEAR l_amt.
REFRESH lit_item.
SORT git_item BY bukrs belnr gjahr hkont kostl.
DATA: l_flag TYPE c.
CLEAR l_flag. LOOP AT git_item. AT NEW shkzg.
CLEAR l_flag.
ENDAT. MOVE git_item-bukrs TO lit_item-bukrs .
MOVE git_item-belnr TO lit_item-belnr .
MOVE git_item-gjahr TO lit_item-gjahr .
MOVE git_item-hkont TO lit_item-hkont .
MOVE git_item-kostl TO lit_item-kostl .
MOVE git_item-xblnr TO lit_item-xblnr . IF l_flag IS INITIAL.
MOVE git_item-bktxt TO lit_item-bktxt .
MOVE git_item-sgtxt TO lit_item-sgtxt .
MOVE git_item-zuonr TO lit_item-zuonr .
ENDIF. MOVE git_item-prctr TO lit_item-prctr .
MOVE git_item-name1 TO lit_item-name1 .
MOVE git_item-name2 TO lit_item-name2 .
MOVE git_item-waers TO lit_item-waers .
MOVE git_item-kursf TO lit_item-kursf .
MOVE git_item-shkzg TO lit_item-shkzg .
lit_item-dmbtr = lit_item-dmbtr + git_item-dmbtr.
lit_item-wrbtr = lit_item-wrbtr + git_item-wrbtr. l_flag = c_x.
AT END OF shkzg.
APPEND lit_item.
CLEAR lit_item.
ENDAT. ENDLOOP. REFRESH git_item.
git_item[] = lit_item[]. ENDFORM. " PROCESS_DATA *&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_data . * Local Variable
DATA: l_repid TYPE sy-repid,
l_prntparams TYPE slis_print_alv.
* Local Work Area
DATA: lwa_layout TYPE slis_layout_alv,
lwa_variant TYPE disvariant. * Create ALV Field Catalog/Comment/Event
PERFORM create_fieldcatalog.
PERFORM alv_set_variant CHANGING lwa_variant. * Assign Program ID
l_repid = sy-repid.
* Layout
lwa_layout-box_fieldname = 'SEL'.
lwa_layout-zebra = c_x.
lwa_layout-colwidth_optimize = c_x. * Call ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = c_pf_set
i_callback_user_command = c_user_command
it_events = git_events
is_layout = lwa_layout
it_fieldcat = git_fieldcat
i_save = c_save_all
is_print = l_prntparams
is_variant = lwa_variant
TABLES
t_outtab = git_list
EXCEPTIONS
program_error =
OTHERS = . "#EC * ENDFORM. " DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form CREATE_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM create_fieldcatalog .
* Create Field Catalog
DATA: lit_fieldcat TYPE slis_t_fieldcat_alv. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = g_repid
i_internal_tabname = 'GTY_LIST'
* i_client_never_display = c_x
i_inclname = g_repid
CHANGING
ct_fieldcat = lit_fieldcat
EXCEPTIONS
inconsistent_interface =
program_error =
OTHERS =
.
IF sy-subrc <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. set_fc: c_bukrs c_bukrs text-h01 ''."Company Code
set_fc: c_belnr c_belnr text-h02 ''."Accounting Document Number
set_fc: c_gjahr c_gjahr text-h03 ''."Fiscal Year
set_fc: c_blart c_blart text-h04 ''."document type
set_fc: c_budat '' text-h05 ''."Payment time
set_fc: c_monat '' text-h06 ''."Fiscal Period
set_fc: c_cpudt '' text-h07 ''."Day Was Entered
set_fc: c_usnam '' text-h08 ''."User Name
*start-add by alex han 20130604
set_fc: c_ppnam '' text-h19 ''."Parked BY
*end-add by alex han 20130604
set_fc: c_xblnr '' text-h09 ''."Reference Document Number
set_fc: c_bktxt '' text-h10 ''."Document Header Text
set_fc: c_waers '' text-h11 ''."Currency Key
set_fc: c_kursf '' text-h12 ''."Exchange rate
set_fc: c_prcnr '' text-h14 ''."PRC number
set_fc: c_prctp '' text-h13 ''."PRC Doc.Type Name
set_fc: c_name1 '' text-h15 ''. "company name
set_fc: c_pflag '' text-h16 ''. "company name ENDFORM. " CREATE_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form f_alv_set_variant
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LWA_VAR text
*----------------------------------------------------------------------*
FORM alv_set_variant CHANGING p_lwa_var TYPE disvariant. * Assign Variant
p_lwa_var-report = sy-repid.
p_lwa_var-handle = space.
p_lwa_var-log_group = space.
p_lwa_var-username = sy-uname.
p_lwa_var-variant = space.
p_lwa_var-text = space.
p_lwa_var-dependvars = space. ENDFORM. " f_alv_set_variant *&---------------------------------------------------------------------*
*& Form PF_STATUS_SET
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM pf_status_set USING pt_extab TYPE slis_t_extab.
SET PF-STATUS 'PF_STATUS' EXCLUDING pt_extab. ENDFORM. " PF_STATUS_SET *&---------------------------------------------------------------------*
*& Form f_user_command_alv
*&---------------------------------------------------------------------*
* User Commnad From ALV Screen
*----------------------------------------------------------------------*
FORM user_command_alv USING r_ucomm LIKE sy-ucomm
ps_selfield TYPE slis_selfield.
** Local Variable
DATA: l_belnr TYPE bkpf-belnr,
l_bukrs TYPE bkpf-bukrs,
l_gjahr TYPE bkpf-gjahr.
DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
CALL METHOD lo_grid->check_changed_data. * Check User Command
CASE r_ucomm.
WHEN '&IC1'. " Double Click
** Set Parameters
CHECK ps_selfield-fieldname = c_belnr.
l_belnr = ps_selfield-value.
READ TABLE git_list INDEX ps_selfield-tabindex.
IF sy-subrc = .
l_bukrs = git_list-bukrs.
l_gjahr = git_list-gjahr.
ENDIF. SET PARAMETER ID: 'BLN' FIELD l_belnr .
SET PARAMETER ID: 'BUK' FIELD l_bukrs .
SET PARAMETER ID: 'GJR' FIELD l_gjahr .
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
CLEAR r_ucomm. WHEN 'PRNT' OR '&PRT'.
READ TABLE git_list WITH KEY sel = c_x.
IF sy-subrc = .
PERFORM print_voucher USING c_x ''..
ps_selfield-refresh = c_x.
ELSE.
MESSAGE s099(ba) DISPLAY LIKE 'E' WITH text-m04.
ENDIF. WHEN OTHERS.
ENDCASE.
ENDFORM. " f_user_command_alv
*&---------------------------------------------------------------------*
*& Form PRINT_VOUCHER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_C_X text
* -->P_0891 text
*----------------------------------------------------------------------*
FORM print_voucher USING pu_preview TYPE tdpreview
pu_tdimmed TYPE tdimmed.
DATA: lv_fm_name TYPE rs38l_fnam,
lv_ldest TYPE usr01-spld,
lwa_controlpara TYPE ssfctrlop,
lwa_output TYPE ssfcompop.
DATA:
*& Start of Insertion CR00158 by Davy on 2013/08/06
ls_ssfcresop TYPE ssfcresop,
*& End of Insertion CR00158 by Davy on 2013/08/06
ls_ssfcrescl TYPE ssfcrescl,
ls_ssfctrlop TYPE ssfctrlop,
ls_ssfcompop TYPE ssfcompop. DATA: ls_output_info TYPE ssfcrescl,
ls_output_options TYPE ssfcresop. CLEAR lv_ldest.
SELECT SINGLE spld FROM usr01 INTO lv_ldest
WHERE bname = sy-uname. lwa_controlpara-langu = sy-langu.
lwa_controlpara-no_dialog = c_x.
lwa_controlpara-device = 'PRINTER'.
lwa_output-tddest = lv_ldest.
lwa_controlpara-preview = pu_preview.
lwa_output-tdimmed = pu_tdimmed. *Get Smartform Function Name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = c_formname
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form =
no_function_module =
OTHERS = . IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF. *--->Setup output options berfore call smartforms
ls_ssfctrlop-device = 'PRINTER'.
ls_ssfctrlop-preview = c_x.
ls_ssfctrlop-langu = sy-langu.
ls_ssfcompop-tddest = lv_ldest. "'LO01'.
ls_ssfcompop-tdimmed = c_x.
ls_ssfcompop-tdnewid = c_x. *Open spool
*& Start of Insertion CR00158 by Davy on 2013/08/06
CLEAR ls_ssfcresop.
*& End of Insertion CR00158 by Davy on 2013/08/06
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = ls_ssfctrlop
output_options = ls_ssfcompop
user_settings = ' '
*& Start of Insertion CR00158 by Davy on 2013/08/06
IMPORTING
job_output_options = ls_ssfcresop "add importing parameters
*& End of Insertion CR00158 by Davy on 2013/08/06
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled = .
CHECK sy-subrc = . *--->Call Smartforms by Function Mode Name
CLEAR ls_ssfctrlop.
ls_ssfctrlop-no_open = c_x.
ls_ssfctrlop-no_close = c_x. LOOP AT git_list WHERE sel = c_x. REFRESH git_header.
REFRESH git_detail.
git_header[] = git_head[].
git_detail[] = git_item[]. DELETE git_header WHERE bukrs <> git_list-bukrs.
DELETE git_header WHERE belnr <> git_list-belnr.
DELETE git_header WHERE gjahr <> git_list-gjahr. DELETE git_detail WHERE bukrs <> git_list-bukrs.
DELETE git_detail WHERE belnr <> git_list-belnr.
DELETE git_detail WHERE gjahr <> git_list-gjahr. *& Start of Insertion CR00158 by Davy on 2013/08/06
* Reset prc number
IF ls_ssfcresop-tdpreview IS INITIAL. "Print mode
PERFORM update_prc_log.
ENDIF.
*& End of Insertion CR00158 by Davy on 2013/08/06 CLEAR: ls_output_info,ls_output_options.
*Open Smartforms
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = ls_ssfctrlop "lwa_controlpara
output_options = lwa_output
user_settings = ''
im_report = sy-repid
IMPORTING
job_output_info = ls_output_info
job_output_options = ls_output_options
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF. *& Start of Deletion CR00158 by Davy on 2013/08/06
* PERFORM update_prc_log.
*& End of Deletion CR00158 by Davy on 2013/08/06 ENDLOOP. *Close spool
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = ls_ssfcrescl. IF NOT ls_ssfcrescl-spoolids[] IS INITIAL OR
ls_ssfcrescl-outputdone <> ''.
PERFORM modify_table TABLES git_upd09.
* MODIFY zc0000fit0009 FROM TABLE git_upd09.
* IF sy-subrc = 0.
* COMMIT WORK.
* ELSE.
* ROLLBACK WORK.
* MESSAGE s099(ba) DISPLAY LIKE c_e WITH text-m03.
* ENDIF. git_list-pflag = text-h17.
MODIFY git_list TRANSPORTING pflag WHERE sel = c_x. ENDIF. REFRESH git_upd09. ENDFORM. " PRINT_VOUCHER
*&---------------------------------------------------------------------*
*& Form UPDATE_PRC_LOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM update_prc_log .
DATA: lv_seq TYPE txnum.
DATA: lv_prcnr TYPE zc0000fit0009-prcnr.
DATA: lwa_prclg TYPE zc0000fit0009.
DATA: lit_list TYPE STANDARD TABLE OF zc0000fit0009 WITH HEADER LINE.
*& Start of Insertion CR00158 by Davy on 2013/08/06
DATA: lwa_header TYPE gty_head.
*& End of Insertion CR00158 by Davy on 2013/08/06 SELECT SINGLE * INTO lwa_prclg FROM zc0000fit0009
WHERE bukrs = git_list-bukrs
AND belnr = git_list-belnr
AND gjahr = git_list-gjahr.
CHECK sy-subrc <> . CLEAR: lv_seq,lv_prcnr.
REFRESH lit_list.
lit_list[] = git_upd09[].
DELETE lit_list WHERE bukrs <> git_list-bukrs.
DELETE lit_list WHERE gjahr <> git_list-gjahr.
DELETE lit_list WHERE monat <> git_list-monat.
SORT lit_list BY prcnr DESCENDING. READ TABLE lit_list INDEX .
IF sy-subrc = AND lit_list-prcnr <> ''.
lv_seq = lit_list-prcnr+(). ELSE. SELECT MAX( prcnr ) INTO lv_prcnr FROM zc0000fit0009
WHERE bukrs = git_list-bukrs
AND gjahr = git_list-gjahr
AND monat = git_list-monat.
IF sy-subrc = .
lv_seq = lv_prcnr+().
ENDIF. ENDIF. lv_seq = lv_seq + .
CLEAR lv_prcnr. CONCATENATE git_list-gjahr git_list-monat lv_seq INTO lv_prcnr.
lwa_prclg-prcnr = lv_prcnr.
lwa_prclg-bukrs = git_list-bukrs.
lwa_prclg-belnr = git_list-belnr.
lwa_prclg-gjahr = git_list-gjahr.
lwa_prclg-monat = git_list-monat. *& Start of Insertion CR00158 by Davy on 2013/08/06
* Reset the PRC number
lwa_header-prcnr = lv_prcnr.
MODIFY git_header FROM lwa_header TRANSPORTING prcnr
WHERE bukrs = git_list-bukrs
AND belnr = git_list-belnr
AND gjahr = git_list-gjahr.
*& End of Insertion CR00158 by Davy on 2013/08/06 APPEND lwa_prclg TO git_upd09.
CLEAR lwa_prclg. ENDFORM. " UPDATE_PRC_LOG
*&---------------------------------------------------------------------*
*& Form CONV_AMOUNT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_VA1 text
* <--P_STR text
*----------------------------------------------------------------------*
FORM conv_amount USING value(pv_source)
CHANGING value(pv_result).
DATA: scr() TYPE c, res() TYPE c,fen() TYPE c .
DATA: len TYPE i, c1 TYPE i, c2 TYPE i, c3 TYPE i, c4 TYPE i.
DATA: d1() TYPE c, d2() TYPE c, d3 TYPE i.
DATA: digit() TYPE c, weight() TYPE c.
DATA: leroy() TYPE c VALUE '零元'.
DATA: lfen() TYPE c VALUE '分'.
DATA: lint() TYPE c VALUE '整'.
DATA: rule1() TYPE c VALUE '零壹贰叁肆伍陆柒捌玖'.
DATA: rule2() TYPE c VALUE '分角元拾佰仟万拾佰仟亿拾佰仟万'.
scr = pv_source * .
CONDENSE scr NO-GAPS.
IF scr = ''.
res = leroy. "'零元'.
ELSE.
len = STRLEN( scr ).
c1 = .
d1 = ''.
CLEAR res.
DO len TIMES.
c1 = c1 + .
c2 = len - c1.
d2 = scr+c2() .
IF d2 = ''.
d3 = .
ELSE.
d3 = d2.
ENDIF.
digit = rule1+d3() .
c3 = ( c1 - ) .
weight = rule2+c3() .
IF d2 = ''.
IF c1 = .
digit = ''.
ELSEIF c1 = .
digit = ''.
IF len > .
c4 = len - .
IF scr+c4() = ''.
weight = ''.
ENDIF.
ENDIF.
ELSEIF c1 = .
digit = ''.
ELSEIF d1 = ''.
digit = ''.
weight = ''.
ELSE.
weight = ''.
ENDIF.
ENDIF.
CONCATENATE digit weight res INTO res .
d1 = d2.
ENDDO.
ENDIF.
len = STRLEN( res ) - .
fen = res+len().
IF fen <> lfen. "'分' .
CONCATENATE res lint INTO pv_result."'整'
ELSE.
pv_result = res.
ENDIF.
ENDFORM. " CONV_AMOUNT
*&---------------------------------------------------------------------*
*& Form SET_NEXT_PRCNO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GIT_BKPF_BUKRS text
* -->P_GIT_BKPF_GJAHR text
* -->P_GIT_BKPF_MONAT text
* <--P_GIT_LIST_PRCNR text
*----------------------------------------------------------------------*
FORM set_next_prcno USING p_git_bkpf_bukrs
p_git_bkpf_gjahr
p_git_bkpf_monat
CHANGING p_git_list_prcnr. DATA: lv_seq TYPE txnum.
DATA: lv_prcnr TYPE zc0000fit0009-prcnr.
DATA: lit_list TYPE STANDARD TABLE OF gty_list WITH HEADER LINE. CLEAR p_git_list_prcnr.
CLEAR: lv_seq,lv_prcnr.
REFRESH lit_list. lit_list[] = git_list[].
DELETE lit_list WHERE bukrs <> p_git_bkpf_bukrs.
DELETE lit_list WHERE gjahr <> p_git_bkpf_gjahr.
DELETE lit_list WHERE monat <> p_git_bkpf_monat.
SORT lit_list BY prcnr DESCENDING. * read table git_prclg2 with key bukrs = p_git_bkpf_bukrs
* gjahr = p_git_bkpf_gjahr
* monat = p_git_bkpf_monat. READ TABLE lit_list INDEX .
IF sy-subrc = AND lit_list-prcnr <> ''.
lv_seq = lit_list-prcnr+(). ELSE. SELECT MAX( prcnr ) INTO lv_prcnr FROM zc0000fit0009
WHERE bukrs = p_git_bkpf_bukrs
AND gjahr = p_git_bkpf_gjahr
AND monat = p_git_bkpf_monat.
IF sy-subrc = .
lv_seq = lv_prcnr+().
ENDIF. ENDIF. lv_seq = lv_seq + .
CLEAR lv_prcnr. CONCATENATE p_git_bkpf_gjahr p_git_bkpf_monat lv_seq INTO lv_prcnr.
p_git_list_prcnr = lv_prcnr. ENDFORM. " SET_NEXT_PRCNO
*&---------------------------------------------------------------------*
*& Form PF_SMART_GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IM_HEADER text
* -->P_IM_DETAIL text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form pf_smart_get_data
*&---------------------------------------------------------------------*
FORM pf_smart_get_data TABLES im_header im_detail.
im_header[] = git_header[].
* im_detail[] = git_detail[].
LOOP AT git_detail.
MOVE-CORRESPONDING git_detail TO im_detail.
APPEND im_detail.
CLEAR im_detail.
ENDLOOP.
ENDFORM. "pf_smart_get_data
*&---------------------------------------------------------------------*
*& Form PRINT_DATA_BACKGROUND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM print_data_background .
DATA: lv_fm_name TYPE rs38l_fnam,
lv_ldest TYPE usr01-spld,
lwa_controlpara TYPE ssfctrlop,
lwa_output TYPE ssfcompop.
DATA:
ls_ssfcrescl TYPE ssfcrescl,
ls_ssfctrlop TYPE ssfctrlop,
ls_ssfcompop TYPE ssfcompop. CLEAR lv_ldest.
SELECT SINGLE spld FROM usr01 INTO lv_ldest
WHERE bname = sy-uname. lwa_controlpara-langu = sy-langu.
lwa_controlpara-no_dialog = c_x.
lwa_controlpara-device = 'PRINTER'.
lwa_output-tddest = lv_ldest.
lwa_controlpara-preview = ''.
lwa_output-tdimmed = c_x.
lwa_controlpara-no_dialog = c_x. *Get Smartform Function Name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = c_formname
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form =
no_function_module =
OTHERS = . IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF. *--->Setup output options berfore call smartforms
ls_ssfctrlop-device = 'PRINTER'.
ls_ssfctrlop-preview = c_x.
ls_ssfctrlop-langu = sy-langu.
ls_ssfcompop-tddest = lv_ldest. "'LO01'.
ls_ssfcompop-tdimmed = c_x.
ls_ssfcompop-tdnewid = c_x.
ls_ssfcompop-tdnoprev = c_x. *Open spool
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = ls_ssfctrlop
output_options = ls_ssfcompop
user_settings = ' '
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled = .
CHECK sy-subrc = . *--->Call Smartforms by Function Mode Name
CLEAR ls_ssfctrlop.
ls_ssfctrlop-no_open = c_x.
ls_ssfctrlop-no_close = c_x. LOOP AT git_list. REFRESH git_header.
REFRESH git_detail.
git_header[] = git_head[].
git_detail[] = git_item[]. DELETE git_header WHERE bukrs <> git_list-bukrs.
DELETE git_header WHERE belnr <> git_list-belnr.
DELETE git_header WHERE gjahr <> git_list-gjahr. DELETE git_detail WHERE bukrs <> git_list-bukrs.
DELETE git_detail WHERE belnr <> git_list-belnr.
DELETE git_detail WHERE gjahr <> git_list-gjahr. *Open Smartforms
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = ls_ssfctrlop "lwa_controlpara
output_options = lwa_output
user_settings = ''
im_report = sy-repid
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF. PERFORM update_prc_log.
ENDLOOP. *Close spool
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = ls_ssfcrescl. IF NOT ls_ssfcrescl-spoolids[] IS INITIAL OR
ls_ssfcrescl-outputdone <> ''.
PERFORM modify_table TABLES git_upd09.
* MODIFY zc0000fit0009 FROM TABLE git_upd09.
* IF sy-subrc = 0.
* COMMIT WORK.
* ELSE.
* ROLLBACK WORK.
* MESSAGE s099(ba) DISPLAY LIKE c_e WITH text-m03.
* ENDIF.
ENDIF. REFRESH git_upd09. ENDFORM. " PRINT_DATA_BACKGROUND
*&---------------------------------------------------------------------*
*& Form CONVERT_RATE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GIT_BKPF_WAERS text
* <--P_GIT_ITEM_KURSF text
*----------------------------------------------------------------------*
FORM convert_rate USING p_git_bkpf_waers p_git_bkpf_kursf
CHANGING p_git_item_kursf. DATA: v_amount() TYPE p DECIMALS . v_amount = p_git_bkpf_kursf. TABLES: tcurx. SELECT SINGLE * FROM tcurx WHERE currkey = p_git_bkpf_waers.
IF sy-subrc = .
v_amount = v_amount * ** ( tcurx-currdec - ).
ENDIF. p_git_item_kursf = v_amount. ENDFORM. " CONVERT_RATE
*&---------------------------------------------------------------------*
*& Form MODIFY_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GIT_UPD09 text
*----------------------------------------------------------------------*
FORM modify_table TABLES p_git_upd09 STRUCTURE zc0000fit0009.
"Insert correct name for <...>.
DATA: wa_upd09 TYPE zc0000fit0009. CHECK NOT p_git_upd09[] IS INITIAL. LOOP AT p_git_upd09 INTO wa_upd09. CALL FUNCTION 'ENQUEUE_EZ_ZC0000FIT0009'
EXPORTING
mode_zc0000fit0009 = 'X'
mandt = sy-mandt
bukrs = wa_upd09-bukrs
belnr = wa_upd09-belnr
gjahr = wa_upd09-gjahr
EXCEPTIONS
foreign_lock =
system_failure =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. MODIFY zc0000fit0009 FROM wa_upd09.
IF sy-subrc = .
COMMIT WORK.
ELSE.
ROLLBACK WORK.
MESSAGE s099(ba) DISPLAY LIKE c_e WITH text-m03.
ENDIF. CALL FUNCTION 'DEQUEUE_EZ_ZC0000FIT0009'
EXPORTING
mode_zc0000fit0009 = 'X'
mandt = sy-mandt
bukrs = wa_upd09-bukrs
belnr = wa_upd09-belnr
gjahr = wa_upd09-gjahr. ENDLOOP. ENDFORM. " MODIFY_TABLE
*&---------------------------------------------------------------------*
*& Form FRM_BALANCE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form FRM_BALANCE .
DATA: l_func TYPE csks-func_area.
DATA: l_name1 TYPE kna1-name1.
SPLIT git_ska-txt50 AT '-' INTO git_item-name1 git_item-name2.
IF git_bseg-lifnr <> '' AND git_bseg-koart = 'K'.
SELECT SINGLE name1 INTO l_name1 FROM lfa1
WHERE lifnr = git_bseg-lifnr.
ENDIF.
IF git_bseg-kunnr <> '' AND git_bseg-koart = 'D'.
SELECT SINGLE name1 INTO l_name1 FROM kna1
WHERE kunnr = git_bseg-kunnr.
ENDIF. IF NOT l_name1 IS INITIAL.
CONCATENATE git_item-name2 '-' l_name1 INTO git_item-name2.
ENDIF.
endform. " FRM_BALANCE
*&---------------------------------------------------------------------*
*& Form FRM_PROFIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form FRM_PROFIT .
DATA: l_func TYPE csks-func_area.
DATA: l_name1 TYPE kna1-name1,
l_aufnr TYPE bseg-aufnr.
* first class account
SELECT SINGLE func_area INTO l_func FROM csks
WHERE kostl = git_bseg-kostl
AND bukrs = git_bseg-bukrs. "#EC *
IF sy-subrc = .
SELECT SINGLE prcnm1 INTO git_item-name1
FROM zc0000fit0010
WHERE func_area = l_func.
ENDIF.
git_item-name2 = git_ska-txt50.
* interanl order
IF NOT git_bseg-aufnr IS INITIAL.
CLEAR l_aufnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = git_bseg-aufnr
IMPORTING
output = l_aufnr.
CONCATENATE git_item-name2 l_aufnr
INTO git_item-name2 SEPARATED BY space. ENDIF.
endform. " FRM_PROFIT
05-11 20:03