12-20-2006 1:11 PM
12-20-2006 1:40 PM
12-20-2006 1:44 PM
What type of doc do you want???
If you got the field on a internal table you can use a <b>GUI_DOWNLOAD</b> or maybe you can send it to spool and convert it to PDF with.... <b>CONVERT_ABAPSPOOLJOB_2_PDF</b>
Greetings,
Blag.
12-20-2006 1:46 PM
Hi ,
Once the entire list is displayed , use the FM LIST_DOWNLOAD , to download the list.
Please try and revert back in case of any further queries.
Regards
Arun
Please reward points if ans is helpful
12-20-2006 1:49 PM
hi,
this program to convert abap list to PDF file.
&----
*& Report ZWARUN_TEST4
*&
&----
REPORT ZWARUN_TEST4.
tables:mara,bseg.
data:begin of itab occurs 2,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab.
data:begin of it_bseg occurs 2,
bukrs like bseg-bukrs,
belnr like bseg-belnr,
gjahr like bseg-gjahr,
shkzg like bseg-shkzg,
dmbtr like bseg-dmbtr,
blart like bkpf-blart,
end of it_bseg.
data: lv_numbytes type i,
lv_spoolno type tsp01-rqident,
c_layout like pri_params-paart value 'X_65_132',
C_X type c value 'X',
numbers type i,
cancel.
data:it_pdf like tline occurs 10 with header line.
data:p_down like rlgrap-filename.
*at selection-screen.
selection-screen:begin of block blk with frame.
select-options:s_matnr for mara-matnr,
s_bukrs for bseg-bukrs.
parameter: download as checkbox default 'X',
p_file like rlgrap-filename default 'c:\warun.pdf'.
p_down LIKE RLGRAP-FILENAME DEFAULT 'c:\warun2.txt'.
selection-screen:end of block blk .
selection-screen pushbutton 12(20) push user-command cl1.
at selection-screen.
perform validate.
top-of-page.
write:/10 sy-repid inverse color 3.
write:/2 'Date:' , sy-datum,
40 'Time:' , sy-uzeit.
write:/2 sy-uline.
end-of-page.
write:/50 'Intelligroup Asia Pvt'.
write:/20 sy-pagno.
start-of-selection.
select matnr
ernam
into table itab
from mara
where matnr in s_matnr.
if sy-subrc = 0.
sort itab by matnr.
endif.
perform besg_data.
set pf-status 'PUSH'.
at user-command.
if sy-ucomm = 'DOWNLOAD'.
if download = space.
perform get_file.
endif.
end-of-selection.
if download = 'X'.
perform PDFfile.
ENDIF.
&----
*& Form validate
&----
FORM validate .
data: v_temp(40).
select single
matnr
into v_temp
from mara
where matnr in s_matnr.
if sy-subrc <> 0.
message e000(zz) with 'no data found'.
endif.
ENDFORM. " validate
at line-selection.
set parameter ID 'MAT' FIELD ITAB-MATNR.
CALL TRANSACTION 'MM03' .
WRITE:/ 'Material data displayed' .
write:/2 itab-matnr.
&----
*& Form PDFfile
&----
FORM PDFfile .
data:lk_params type pri_params,
lv_valid.
All the parameters passed are constants, so exceptions
doesn't get raised
call function 'GET_PRINT_PARAMETERS'
EXPORTING
immediately = ' '
layout = c_layout "'X_65_132'
no_dialog = c_x
IMPORTING
out_parameters = lk_params
valid = lv_valid.
if lv_valid <> space .
new-page print on parameters lk_params no dialog.
*--To display the final report
perform print_report.
new-page print off.
*---To convert the download to PDF
perform conv_to_pdf_download.
perform download.
endif.
endif.
*--To display the final report
perform print_report.
ENDFORM. " PDFfile
&----
*& Form print_report
&----
FORM print_report .
loop at itab.
write:/2 sy-vline,
4 itab-matnr color 4 HOTSPOT,
40 sy-vline ,
41 itab-ernam color 5,
55 sy-vline.
HIDE: ITAB-MATNR.
endloop.
ENDFORM. " print_report
&----
*& Form conv_to_pdf_download
&----
FORM conv_to_pdf_download .
wait up to 2 seconds.
lv_spoolno = sy-spono.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = lv_spoolno
no_dialog = ''
DST_DEVICE =
PDF_DESTINATION =
importing
pdf_bytecount = lv_numbytes
PDF_SPOOLID = pdfspoolid
LIST_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
tables
pdf = it_pdf.
ENDFORM. " conv_to_pdf_download
&----
*& Form download
&----
FORM download .
check download = 'X'.
call function 'DOWNLOAD'
EXPORTING
bin_filesize = lv_numbytes
filename = p_file
filetype = 'BIN'
IMPORTING
act_filename = p_file
filesize = lv_numbytes
cancel = cancel
TABLES
data_tab = it_pdf.
if cancel = space.
write: / lv_numbytes, p_file.
endif.
ENDFORM. " download
&----
*& Form get_file
&----
FORM get_file .
Data: s_filename like rlgrap-filename,
s_filepath like rlgrap-filename,
tm_filepath like rlgrap-filename.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = s_filename
DEF_PATH = s_filepath
MASK = ' '
MODE = ' '
TITLE = ' '
IMPORTING
FILENAME = tm_filepath
.
IF SY-SUBRC = 0.
p_down = tm_filepath.
perform download2.
endif.
ENDFORM. " get_file
&----
*& Form download2
&----
FORM download2 .
DATA: LV_STRING TYPE STRING.
LV_STRING = P_DOWN.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = LV_STRING
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = itab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " download2
&----
*& Form besg_data
&----
FORM besg_data .
if itab is initial.
select bukrs
belnr
gjahr
shkzg
dmbtr
into corresponding fields of table it_bseg
from bseg
where bukrs in s_bukrs.
endif.
ENDFORM. " besg_data
regards
warun
12-20-2006 1:53 PM
12-20-2006 1:59 PM