top-of-page.
perform. list_column_header(zcbx0001) using 1 2.
uline.
perform. list_column_header(zcbx0001) using 1 2.
uline.
at user-command.
perform. user_command.
perform. user_command.
start-of-selection.
perform. extract_document_data.
perform. list_extracted_data.
end-of-selection.
*&---------------------------------------------------------------------*
*& Form list_column_header
*&---------------------------------------------------------------------*
form. list_column_header using value(fromline) value(toline).
data: textpool like textpool occurs 0 with header line,
textline type i.
*& Form list_column_header
*&---------------------------------------------------------------------*
form. list_column_header using value(fromline) value(toline).
data: textpool like textpool occurs 0 with header line,
textline type i.
read textpool sy-cprog into textpool language sy-langu.
format color col_heading intensified on.
loop at textpool where id eq 'H'.
add 1 to textline.
if textline between fromline and toline.
write: textpool-entry.
endif.
endloop.
format color off.
endform. " list_column_header
format color col_heading intensified on.
loop at textpool where id eq 'H'.
add 1 to textline.
if textline between fromline and toline.
write: textpool-entry.
endif.
endloop.
format color off.
endform. " list_column_header
*&---------------------------------------------------------------------*
*& Form extract_document_data
*&---------------------------------------------------------------------*
form. extract_document_data.
select * into table zmm010tab from zmm010
where zmm010~docnumber in s_docnum
and zmm010~doctype in s_dtype
and zmm010~badat in s_badat
and zmm010~employid in s_empid
and zmm010~aufnr in s_aufnr
and zmm010~kostl in s_kostl
and zmm010~commenttext in s_commt
and zmm010~docyear = sdocyear .
sort zmm010tab by docnumber .
endform. " extract_document_data
*& Form extract_document_data
*&---------------------------------------------------------------------*
form. extract_document_data.
select * into table zmm010tab from zmm010
where zmm010~docnumber in s_docnum
and zmm010~doctype in s_dtype
and zmm010~badat in s_badat
and zmm010~employid in s_empid
and zmm010~aufnr in s_aufnr
and zmm010~kostl in s_kostl
and zmm010~commenttext in s_commt
and zmm010~docyear = sdocyear .
sort zmm010tab by docnumber .
endform. " extract_document_data
*&---------------------------------------------------------------------*
*& Form list_extracted_data
*&---------------------------------------------------------------------*
form. list_extracted_data.
data: l_docnum like zmt013-docnumber,
doctypetext like dd07t-ddtext,
remainder type i,
color type i.
*& Form list_extracted_data
*&---------------------------------------------------------------------*
form. list_extracted_data.
data: l_docnum like zmt013-docnumber,
doctypetext like dd07t-ddtext,
remainder type i,
color type i.
loop at zmm010tab.
at first.
set pf-status '1000'.
endat.
at first.
set pf-status '1000'.
endat.
listindex = sy-tabix.
remainder = sy-tabix mod 2.
if remainder eq 1.
format color col_normal intensified off.
endif.
format color col_normal intensified off.
endif.
select zmt013~docnumber into l_docnum from zmt013
where zmt013~docnumber = zmm010tab-docnumber
and zmt013~markdeletion <> 'X'.
exit.
endselect.
check sy-subrc eq 0.
where zmt013~docnumber = zmm010tab-docnumber
and zmt013~markdeletion <> 'X'.
exit.
endselect.
check sy-subrc eq 0.
perform. get_dommain_value_text(zcbx0001) using 'ZDOCTYPE'
zmm010tab-doctype
doctypetext.
select adrnr into lfa1-adrnr from lfa1
where lifnr eq zmm010tab-employid.
exit.
endselect.
select name1 into adrc-name1 from adrc
where addrnumber eq lfa1-adrnr.
exit.
endselect.
if sy-subrc ne 0.
clear adrc-name1.
endif.
zmm010tab-doctype
doctypetext.
select adrnr into lfa1-adrnr from lfa1
where lifnr eq zmm010tab-employid.
exit.
endselect.
select name1 into adrc-name1 from adrc
where addrnumber eq lfa1-adrnr.
exit.
endselect.
if sy-subrc ne 0.
clear adrc-name1.
endif.
write:/ zmm010tab-selid as checkbox,
(12) zmm010tab-docnumber,
(12) doctypetext,
(12) zmm010tab-badat,
zmm010tab-employid,
(08) adrc-name1,
zmm010tab-aufnr,
(11) zmm010tab-kostl,
zmm010tab-commenttext.
format color off.
hide listindex.
uline.
listline = sy-linno. "List screen, current line
endloop.
endform.
(12) zmm010tab-docnumber,
(12) doctypetext,
(12) zmm010tab-badat,
zmm010tab-employid,
(08) adrc-name1,
zmm010tab-aufnr,
(11) zmm010tab-kostl,
zmm010tab-commenttext.
format color off.
hide listindex.
uline.
listline = sy-linno. "List screen, current line
endloop.
endform.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
form. user_command.
case sy-ucomm.
when 'OUTPUT' .
perform. list_document .
endcase.
endform.
*& Form user_command
*&---------------------------------------------------------------------*
form. user_command.
case sy-ucomm.
when 'OUTPUT' .
perform. list_document .
endcase.
endform.
*&---------------------------------------------------------------------*
*& Form list_document
*&---------------------------------------------------------------------*
form. list_document .
do listline times.
zmm010tab-selid = space.
listindex = 0.
read line sy-index field value zmm010tab-selid.
check sy-subrc eq 0 and listindex gt 0.
modify zmm010tab index listindex transporting selid.
enddo.
read table zmm010tab with key selid = 'X'.
if sy-subrc ne 0.
message i000 with 'Please first choose collective no'.
exit.
endif.
perform. write_document .
endform. " list_purchase_order
*& Form list_document
*&---------------------------------------------------------------------*
form. list_document .
do listline times.
zmm010tab-selid = space.
listindex = 0.
read line sy-index field value zmm010tab-selid.
check sy-subrc eq 0 and listindex gt 0.
modify zmm010tab index listindex transporting selid.
enddo.
read table zmm010tab with key selid = 'X'.
if sy-subrc ne 0.
message i000 with 'Please first choose collective no'.
exit.
endif.
perform. write_document .
endform. " list_purchase_order
*&---------------------------------------------------------------------*
*& Form write_document
*&---------------------------------------------------------------------*
form. write_document .
data:l_program like rs38m-programm,
abaplist like abaplist occurs 0,
ascilist(120) occurs 0 with header line,
linesize type i,
linecount type i,
layout like pri_params-paart,
dest like pri_params-pdest.
*& Form write_document
*&---------------------------------------------------------------------*
form. write_document .
data:l_program like rs38m-programm,
abaplist like abaplist occurs 0,
ascilist(120) occurs 0 with header line,
linesize type i,
linecount type i,
layout like pri_params-paart,
dest like pri_params-pdest.
loop at zmm010tab where selid eq 'X'.
case zmm010tab-doctype .
when '1'.
if p_a4 = 'X' .
l_program = 'ZLRM0021A'.
linesize = 132.
linecount = 51.
layout = 'ZX_51_132_L'.
endif.
endcase.
case zmm010tab-doctype .
when '1'.
if p_a4 = 'X' .
l_program = 'ZLRM0021A'.
linesize = 132.
linecount = 51.
layout = 'ZX_51_132_L'.
endif.
endcase.
submit (l_program)
with s_docnum eq zmm010tab-docnumber
with sdocyear eq zmm010tab-docyear
exporting list to memory
and return.
with s_docnum eq zmm010tab-docnumber
with sdocyear eq zmm010tab-docyear
exporting list to memory
and return.
call function 'LIST_FROM_MEMORY' "Prepared list import from m
tables
listobject = abaplist
exceptions
not_found = 1
others = 2.
tables
listobject = abaplist
exceptions
not_found = 1
others = 2.
call function 'LIST_TO_ASCI'
exporting
list_index = -1
with_line_break = ' '
tables
listasci = ascilist
listobject = abaplist
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
exporting
list_index = -1
with_line_break = ' '
tables
listasci = ascilist
listobject = abaplist
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
new-page line-count linecount line-size linesize.
dest = 'LOCL'.
dest = 'LOCL'.
call function 'SET_PRINT_PARAMETERS'
exporting
layout = layout
destination = dest.
exporting
layout = layout
destination = dest.
call function 'WRITE_LIST'
exporting
write_only = 'X'
tables
listobject = abaplist
exceptions
empty_list = 1
others = 2.
endloop.
exporting
write_only = 'X'
tables
listobject = abaplist
exceptions
empty_list = 1
others = 2.
endloop.
zmm010tab-selid = space.
modify zmm010tab transporting selid where selid eq 'X'.
modify zmm010tab transporting selid where selid eq 'X'.
endform.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-661617/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15117617/viewspace-661617/