‎2006 Aug 21 9:43 AM
‎2006 Aug 21 9:43 AM
‎2006 Aug 21 9:50 AM
Hi,
Check here the sample code.......
*----
at user-command.
*----
case sy-ucomm.
when 'HDR_DETAIL'.
perform dnld_header.
when others.
endcase.
loop at bkpf_it.
clear: it_ehdr.
if intensified = 'X'.
format color col_normal intensified on.
clear intensified.
else.
format color col_normal intensified off.
intensified = 'X'.
endif.
write:/ a, (06) bkpf_it-mandt,
a, (04) bkpf_it-bukrs,
a, (10) bkpf_it-belnr hotspot,
a, (04) bkpf_it-gjahr,
a, (03) bkpf_it-blart,
a, (10) bkpf_it-bldat,
a, (10) bkpf_it-budat,
a, (04) bkpf_it-monat,
a, (06) bkpf_it-tcode,
a, (16) bkpf_it-xblnr,
a, (10) bkpf_it-dbblg,
a, (25) bkpf_it-bktxt,
a, (05) bkpf_it-waers,
a, (06) bkpf_it-bstat,
a, (10) bkpf_it-xnetb,
a, (20) bkpf_it-awkey,
a, (10) bkpf_it-xsnet, a.
move: bkpf_it-mandt to it_ehdr-mandt,
bkpf_it-bukrs to it_ehdr-bukrs,
bkpf_it-belnr to it_ehdr-belnr,
bkpf_it-gjahr to it_ehdr-gjahr,
bkpf_it-blart to it_ehdr-blart,
bkpf_it-bldat to it_ehdr-bldat,
bkpf_it-budat to it_ehdr-budat,
bkpf_it-monat to it_ehdr-monat,
bkpf_it-tcode to it_ehdr-tcode,
bkpf_it-xblnr to it_ehdr-xblnr,
bkpf_it-dbblg to it_ehdr-dbblg,
bkpf_it-bktxt to it_ehdr-bktxt,
bkpf_it-waers to it_ehdr-waers,
bkpf_it-bstat to it_ehdr-bstat,
bkpf_it-xnetb to it_ehdr-xnetb,
bkpf_it-awkey to it_ehdr-awkey,
bkpf_it-xsnet to it_ehdr-xsnet.
hide: bkpf_it-belnr,
bkpf_it-bukrs,
bkpf_it-gjahr.
append: it_ehdr.
clear bkpf_it.
endloop.
form dnld_header.
data mydesktop type string.
data: fname like rlgrap-filename,
dnld_fname(50).
call method cl_gui_frontend_services=>get_desktop_directory
changing
desktop_directory = mydesktop.
concatenate 'Header_Doc_Details' '_' sy-datum '_'
sy-uzeit '.xls' into dnld_fname.
concatenate mydesktop '\' dnld_fname into fname.
perform fill_titles.
if it_ehdr[] is initial.
message i000 with text-e02.
stop.
else.
call function 'DOWNLOAD'
exporting
filename = fname
filetype = 'DAT'
tables
data_tab = it_ehdr
fieldnames = titles_it
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.
if sy-subrc ne 0.
message e000 with text-e03.
endif.
endif.
endform. " dnld_header
&----
*& Form fill_titles
&----
text
----
--> p1 text
<-- p2 text
----
form fill_titles.
refresh titles_it. " Header details
concatenate text-h01 text-h31 into titles_it-title
separated by space.
append titles_it.
concatenate text-h02 text-h31 into titles_it-title
separated by space.
append titles_it.
concatenate text-h03 text-h33 into titles_it-title
separated by space.
append titles_it.
concatenate text-h04 text-h34 into titles_it-title
separated by space.
append titles_it.
concatenate text-h39 text-h61 into titles_it-title
separated by space.
append titles_it.
concatenate text-h03 text-h38 into titles_it-title
separated by space.
append titles_it.
concatenate text-h10 text-h38 into titles_it-title
separated by space.
append titles_it.
concatenate text-h05 text-h35 into titles_it-title
separated by space.
append titles_it.
concatenate text-h62 text-h31 into titles_it-title
separated by space.
append titles_it.
concatenate text-h51 text-h03 into titles_it-title
separated by space.
append titles_it.
concatenate text-h63 text-h03 into titles_it-title
separated by space.
append titles_it.
concatenate text-h26 text-h56 into titles_it-title
separated by space.
append titles_it.
concatenate text-h64 text-h40 into titles_it-title
separated by space.
append titles_it.
concatenate text-h39 text-h65 into titles_it-title
separated by space.
append titles_it.
concatenate text-h03 text-h66 into titles_it-title
separated by space.
append titles_it.
concatenate text-h21 text-h51 into titles_it-title
separated by space.
append titles_it.
concatenate text-h67 text-h68 into titles_it-title
separated by space.
append titles_it.
endform.
Thanks.
If this helps you reward with points.
‎2006 Aug 21 10:01 AM
There are two FMs used to get ur requirement.
XXL_FULL_API
XXL_SIMPLE_API2.
Check these Std example programs
<b>XXLFTEST
XXLSTEST
XXLTTEST.</b>