*&---------------------------------------------------------------------*
*& Form headerxls
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_OUT_TAB_LIST_1_VBELN text
*----------------------------------------------------------------------*
form. headerxls using p_vbeln.
data:poso(30) type c,
l_name1(100) type c,
l_name2(100) type c,
l_name3(100) type c,
l_name4(100) type c.
clear:l_name1,l_name2,l_name3,l_name4.
loop at invoiceheader where vbelnf = p_vbeln.
if invoiceheader-fkart = 'ZPLB' or invoiceheader-fkart = 'ZPLG'.
concatenate invoiceheader-bstnk '/' invoiceheader-vbeln into poso.
else.
concatenate invoiceheader-bstnk '' into poso.
endif.
condense invoiceheader-ship_to.
condense invoiceheader-ship_adr.
condense invoiceheader-adr_adr1.
condense invoiceheader-adr_region.
condense invoiceheader-adr_county.
condense invoiceheader-in_city.
condense invoiceheader-adr2_name1.
condense invoiceheader-adr2_st.
condense invoiceheader-adr2_supply.
condense invoiceheader-adr2_post.
condense invoiceheader-region.
condense invoiceheader-adr2_county.
concatenate invoiceheader-adr2_name1 l_name3 into l_name3.
concatenate invoiceheader-adr2_st ',' invoiceheader-adr2_supply ','
invoiceheader-adr2_post ',' invoiceheader-region ','
invoiceheader-adr2_county into l_name4.
concatenate invoiceheader-adr_name1 l_name1 into l_name1.
concatenate invoiceheader-ship_adr ',' invoiceheader-adr_adr1 ','
invoiceheader-adr_post ',' invoiceheader-in_city ','
invoiceheader-adr_region ',' invoiceheader-adr_county into l_name2.
perform. fill_cell using 11 8 invoiceheader-vbelnf.
perform. fill_cell using 12 8 invoiceheader-lfdat.
perform. fill_cell using 13 8 poso.
if invoiceheader-fkart = 'ZPLB' or invoiceheader-fkart = 'ZPLG'.
perform. fill_cell using 14 8 invoiceheader-stceg.
else.
perform. fill_cell using 14 8 invoiceheader-xblnr.
endif.
perform. fill_cell using 12 1 l_name3.
perform. fill_cell using 13 1 l_name4.
perform. fill_cell using 17 1 l_name1.
perform. fill_cell using 18 1 l_name2.
endloop.
endform. " headerxls
*&---------------------------------------------------------------------*
*& Form itemxls
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FROM text
* -->P_TO text
* -->P_DO_LOCATION text
* -->P_OUT_TAB_LIST_1_VBELN text
*----------------------------------------------------------------------*
form. itemxls using p
q
s
p_vbeln.
data: fill_i type i,
fill_i1 type i,
zpage(20) type c,
pagesn(2) type c,
pageen(2) type c.
fill_i = s.
fill_i1 = s - 15.
pagesn = i.
pageen = do_r.
concatenate 'PAGE' '' pagesn '/' pageen into zpage.
perform. fill_cell using fill_i1 9 zpage.
loop at invoicedetail3 from p to q where vbeln = p_vbeln.
perform. fill_cell using fill_i 1 invoicedetail3-posnr.
perform. fill_cell using fill_i 2 invoicedetail3-bismt.
perform. fill_cell using fill_i 4 invoicedetail3-matnr.
perform. fill_cell using fill_i 5 invoicedetail3-maktx.
perform. fill_cell using fill_i 6 invoicedetail3-kbetr.
perform. fill_cell using fill_i 7 invoicedetail3-enmng.
perform. fill_cell using fill_i 8 invoicedetail3-netpr.
fill_i = fill_i + 1.
endloop.
endform. " itemxls
*&---------------------------------------------------------------------*
*& Form fill_cell
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_11 text
* -->P_8 text
* -->P_INVOICEHEADER_VBELNF text
*----------------------------------------------------------------------*
form. fill_cell using i j val.
call method of h_sheet 'Cells' = h_zl no flush
exporting
#1 = i
#2 = j.
set property of h_zl 'Value' = val no flush.
free object h_zl.
endform. "FILL_CELL
*&---------------------------------------------------------------------*
*& Form choose_input_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
form. choose_input_file.
call function 'WS_FILENAME_GET'
exporting
def_filename = '*.xls'
def_path = 'C:\'
mask = ',*.xls.'
mode = 'O'
title = 'Choose Input file'
importing
filename = filename
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
endform. " choose_input_file
*&---------------------------------------------------------------------*
*& Form total_amount
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_INVOICEHEADER_VBELNF text
*----------------------------------------------------------------------*
form. total_amount using s p_vbeln.
data: total_amount like vbrp-netwr,
total_char(150) type c,
do_space(1) type c.
data: do_spell type spell,
w1 like spell-word,
w2 like spell-decword,
zcurrency(5) type c,
i1 type i.
clear: total_amount.
loop at invoicedetail3 where vbeln = p_vbeln.
total_amount = total_amount + invoicedetail3-netpr.
endloop.
zcurrency = 'USD'.
call function 'SPELL_AMOUNT'
exporting
amount = total_amount
currency = zcurrency
filler = ' '
language = sy-langu
importing
in_words = do_spell.
w1 = do_spell-word. w2 = do_spell-decword.
if zcurrency = 'USD'.
if w2 ne 'ZERO'.
concatenate 'SAY TOTAL U.S DOLLAR:'
w1
' AND CENTS '
w2
'ONLY.'
into total_char
separated by do_space.
else.
concatenate 'SAY TOTAL U.S DOLLAR:'
w1
'ONLY.'
into total_char
separated by do_space.
endif.
elseif zcurrency = 'TWD'
or zcurrency = 'NTD'.
concatenate 'SAY TOTAL ntd DOLLAR:'
w1
'ONLY.'
into total_char
separated by do_space.
endif.
i1 = i - 1.
if i1 < do_r and i1 >= 1.
s = s + 17.
perform. fill_cell using s 8 'Continue On next page'.
else.
s = s + 17.
perform. fill_cell using s 6 'TOTAL AMOUNT (USD):'.
perform. fill_cell using s 8 total_amount.
s = s + 1.
perform. fill_cell using s 1 total_char.
endif.
clear: w1, w2, do_spell,total_char,total_amount.
endform. " total_amount
*&---------------------------------------------------------------------*
*& Form mark_all
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0302 text
*----------------------------------------------------------------------*
form. mark_all using value(p_all).
do listline times.
clear: out_tab_list_1.
read table out_tab_list_1 index sy-index.
if p_all = 'X'.
if out_tab_list_1-selid =''.
out_tab_list_1-selid = 'X'.
modify out_tab_list_1 index sy-index.
endif.
else.
if out_tab_list_1-selid ='X'.
out_tab_list_1-selid = ' '.
modify out_tab_list_1 index sy-index.
endif.
endif.
enddo.
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
importing
e_grid = gv_grid.
call method gv_grid->check_changed_data.
call method gv_grid->refresh_table_display.
endform. " mark_all
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14397246/viewspace-666226/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14397246/viewspace-666226/