How to download output into Excel with Header?
Dear Friends,
I want to download a my list output into excel format with <b>Column heading</b>. How will I do this?
Another question is i want name of database table in Which SAP stores <b>DDIC object name and its property</b>, so that i can write Select * from ' ' where .... For example i have table ZABC with three fields so i need In which table it stores ZABC as table and a table in which it stores Its field name.
Hi,
Look at the sample code for Download into Excel.
data: begin of excel_sum_it occurs 0,
bukrs(80),
belnr(80),
gjahr(80),
blart(80),
budat like bkpf-budat,
monat(80),
cpudt like bkpf-cpudt,
cputm like bkpf-cputm,
usnam(80),
tcode(80),
xblnr(80),
waers(80),
dwrbtr(25),
cwrbtr(25),
end of excel_sum_it.
data: begin of titles_it occurs 10,
title(80),
end of titles_it.
at user-command.
case sy-ucomm.
when 'SUMMARY'.
perform summary_download.
when 'DETAIL'.
perform detail_download.
when others.
endcase.
******Create one PF-STATUS for one push button for download.
Before this FM you need to move your date to Execl_sum_it Internal table.
For example here I used this table for down load.
*& Form summary_download
text
--> p1 text
<-- p2 text
form summary_download.
data: fname like rlgrap-filename value 'Summary_Details.xls'.
perform fill_titles.
check not excel_sum_it[] is initial.
call function 'DOWNLOAD'
exporting
filename = fname
filetype = 'DAT'
tables
data_tab = excel_sum_it
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-e07.
endif.
endform. " summary_download
*& Form fill_titles
text
--> p1 text
<-- p2 text
form fill_titles.
refresh titles_it.
concatenate text-h06 text-h16 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h17 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h18 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h19 into titles_it-title
separated by space.
append titles_it.
concatenate text-h09 text-h20 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h21 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h22 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h23 into titles_it-title
separated by space.
append titles_it.
concatenate text-h12 text-h24 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h25 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h26 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h28 into titles_it-title
separated by space.
append titles_it.
concatenate text-h14 text-h27 into titles_it-title
separated by space.
append titles_it.
concatenate text-h15 text-h27 into titles_it-title
separated by space.
append titles_it.
endform. " fill_titles
***Here in the FILL_TITLES you give you own HEADER .
Thanks.
If this helps you reward with points.
Similar Messages
-
How to download report into excel using button?
Hello Friends,
I am creating one simple classical report.
Now, I put one "Download" button on the report output screen.
I want to do is....
When I press this download button, One pop-up should be called and should ask for where to download on local PC.and downloaded file should be in excel.
How to do this?
Regards,
RHhi..
First explain that, we hav a standard functionality in ALV to download into EXCEL to your FUNCTIONAL CONSULTANT or to your CTM. It is our duty to explain the technical functionality and make use of it wisely. There's nothing wrong in expressing your thoughts regarding requirement. And dont blindly accept requirements and try to interact with FC about it. To me, using a button to download to excel in ALV report is not wise.
regards,
Padma -
How to download data into excel by displaying field names in top 2 rows
Hi experts,
i am trying to download an internal table data into excel(open office) by reserving top 2 rows. In 1st row i want to display tech.name where as in 2nd row i want to display discription of tech name of the fields. Well, i tried with FM gui_upload and used fieldnames parameter and even its working too but i'm unable to work with 2nd col.
Please help me out....
with regards.
Praveen.Try this code:
If IT_FINAL is the internal table containing the data that you want to download :
IF IT_FINAL[] IS INITIAL.
WRITE : 'No Data Fetched'.
ELSE.
Build header table Field catelague
PERFORM UR_FIELDCAT_BUILD USING G_F_REPNM
'IT_FINAL'
CHANGING IT_FCAT_001.
DATA: L_F_LINES TYPE I,
L_F_FROM TYPE I,
L_F_TO TYPE I,
L_F_DIFF TYPE I,
L_TEMP_FINAL LIKE TABLE OF IT_FINAL.
DESCRIBE TABLE IT_FINAL LINES L_F_LINES.
IF L_F_LINES > 16000.
L_F_FROM = 1.
L_F_TO = 16000.
DO.
APPEND LINES OF IT_FINAL FROM L_F_FROM
TO L_F_TO TO L_TEMP_FINAL.
PERFORM DOWNLOAD_DATA_HEADER TABLES L_TEMP_FINAL
IT_FCAT_001
USING GF_FILE1.
IF L_F_TO >= L_F_LINES.
EXIT.
ENDIF.
L_F_FROM = L_F_TO + 1.
L_F_DIFF = L_F_LINES - L_F_TO.
IF L_F_DIFF >= 16000.
L_F_TO = L_F_TO + 16001.
ELSE.
L_F_TO = L_F_LINES.
ENDIF.
REFRESH: L_TEMP_FINAL.
ENDDO.
ELSE.
PERFORM DOWNLOAD_DATA_HEADER TABLES IT_FINAL
IT_FCAT_001
USING GF_FILE1.
ENDIF.
ENDIF.
FORM UR_FIELDCAT_BUILD
USING P_REPID
P_TABNAM
CHANGING C_T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
REFRESH C_T_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = P_REPID
I_INTERNAL_TABNAME = P_TABNAM
I_STRUCTURE_NAME = 'TY_FLODAT'
I_INCLNAME = P_REPID
I_BYPASSING_BUFFER = 'X'
CHANGING
CT_FIELDCAT = C_T_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
ENDFORM.
FORM DOWNLOAD_DATA_HEADER
TABLES T_OUTTAB
T_FIELDCAT
USING P_FILENAM.
TYPE-POOLS: SLIS.
REPLACE 'YYYYMMDD' WITH SY-DATUM INTO P_FILENAM.
DATA: T_GXXLT_O TYPE TABLE OF GXXLT_O WITH HEADER LINE,
T_GXXLT_H TYPE TABLE OF GXXLT_H WITH HEADER LINE,
T_GXXLT_H_TEMP TYPE TABLE OF GXXLT_H WITH HEADER LINE,
T_GXXLT_P TYPE TABLE OF GXXLT_P WITH HEADER LINE,
T_GXXLT_S TYPE TABLE OF GXXLT_S WITH HEADER LINE,
T_GXXLT_V TYPE TABLE OF GXXLT_V WITH HEADER LINE,
L_S_FIELDCAT TYPE SLIS_FIELDCAT_ALV..
DATA: F_FILE TYPE GXXLT_F-FILE,
F_ATT_COLS TYPE I,
F_HRZ_KEYS TYPE I,
F_VRT_KEYS TYPE I.
TYPES: BEGIN OF TY_FLDNM,
FIELDNAME(30) TYPE C,
END OF TY_FLDNM.
DATA : L_T_FLDNAME TYPE TABLE OF TY_FLDNM,
L_R_FLDNAME TYPE TY_FLDNM.
REFRESH: L_T_FLDNAME.
LOOP AT T_FIELDCAT INTO L_S_FIELDCAT .
CLEAR L_R_FLDNAME.
CONCATENATE L_S_FIELDCAT-SELTEXT_S '_'
L_S_FIELDCAT-FIELDNAME
INTO L_R_FLDNAME-FIELDNAME.
APPEND L_R_FLDNAME TO L_T_FLDNAME.
ENDLOOP.
IF T_OUTTAB[] IS INITIAL.
WRITE : /'No data Fetch !'.
ELSE.
DESCRIBE TABLE T_FIELDCAT LINES F_ATT_COLS.
LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
T_GXXLT_H-COL_NO = L_S_FIELDCAT-COL_POS.
T_GXXLT_H-ROW_NO = 1.
T_GXXLT_H-COL_NAME = L_S_FIELDCAT-FIELDNAME.
APPEND T_GXXLT_H.
CLEAR T_GXXLT_S.
T_GXXLT_S-COL_NO = L_S_FIELDCAT-COL_POS.
T_GXXLT_S-COL_OPS = 'NOP'.
T_GXXLT_S-COL_SRC = L_S_FIELDCAT-COL_POS.
CASE L_S_FIELDCAT-INTTYPE.
WHEN 'Z' OR 'P' OR 'I' OR 'F'.
T_GXXLT_S-COL_TYP = 'NUM'.
WHEN 'C' OR 'X' OR 'T' OR 'N'.
T_GXXLT_S-COL_TYP = 'STR'.
WHEN 'D'.
T_GXXLT_S-COL_TYP = 'DAT'.
WHEN OTHERS.
T_GXXLT_S-COL_TYP = 'STR'.
ENDCASE.
APPEND T_GXXLT_S.
IF L_S_FIELDCAT-KEY EQ 'X'.
CLEAR T_GXXLT_H.
T_GXXLT_H-COL_NO = L_S_FIELDCAT-COL_POS.
T_GXXLT_H-ROW_NO = 1.
T_GXXLT_H-COL_NAME = L_S_FIELDCAT-FIELDNAME.
APPEND T_GXXLT_H.
ENDIF.
ENDLOOP.
MOVE P_FILENAM TO F_FILE.
LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
READ TABLE T_GXXLT_H WITH KEY COL_NAME = L_S_FIELDCAT-FIELDNAME.
IF SY-SUBRC EQ 0.
T_GXXLT_H_TEMP-COL_NO = T_GXXLT_H-COL_NO.
T_GXXLT_H_TEMP-ROW_NO = 2.
T_GXXLT_H_TEMP-COL_NAME = L_S_FIELDCAT-SELTEXT_S.
APPEND T_GXXLT_H_TEMP TO T_GXXLT_H.
CLEAR T_GXXLT_H.
ENDIF.
ENDLOOP.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
FILENAME = F_FILE
NO_START = ''
N_ATT_COLS = F_ATT_COLS
N_HRZ_KEYS = F_HRZ_KEYS
N_VRT_KEYS = F_VRT_KEYS
SEMA_TYPE = ''
SO_TITLE = ''
TABLES
DATA = T_OUTTAB
HKEY = T_GXXLT_H
ONLINE_TEXT = T_GXXLT_O
PRINT_TEXT = T_GXXLT_P
SEMA = T_GXXLT_S
VKEY = T_GXXLT_V
EXCEPTIONS
CANCELLED_BY_USER = 1
DATA_TOO_BIG = 2
DIM_MISMATCH_DATA = 3
DIM_MISMATCH_SEMA = 4
DIM_MISMATCH_VKEY = 5
ERROR_IN_HKEY = 6
ERROR_IN_SEMA = 7
FILE_OPEN_ERROR = 8
FILE_WRITE_ERROR = 9
INV_DATA_RANGE = 10
INV_WINSYS = 11
INV_XXL = 12
OTHERS = 13.
ENDIF.
ENDFORM. -
Displaying alv output into excel with delimeter
Hai,
am downloading alv output to excel :
1. in that output one field is long text field with # delimeter at the end of sting .
while exporting this outout to excel it is not showing # and one empty column is adding after that field.Hi Satya,
Can you try out this piece of code below. It creates a demo Internal table to store some string with '#' as the final delimiter.
TYPES : BEGIN OF l_ty_demo,
data TYPE string,
END OF l_ty_demo.
DATA : l_i_demo TYPE STANDARD TABLE OF l_ty_demo.
DATA : l_wa_demo TYPE l_ty_demo.
DATA : l_v_i TYPE sy-tabix.
INCLUDE ole2incl.
* handles for OLE objects
DATA: h_excel TYPE ole2_object, " Excel object
h_mapl TYPE ole2_object, " list of workbooks
h_map TYPE ole2_object, " workbook
h_zl TYPE ole2_object, " cell
h_f TYPE ole2_object. " font
TABLES: spfli.
DATA h TYPE i.
WHILE l_v_i < 10.
l_wa_demo-data = 'Welcome to the world of computers#'.
APPEND l_wa_demo TO l_i_demo.
l_v_i = l_v_i + 1.
ENDWHILE.
* start Excel
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
PERFORM err_hdl.
SET PROPERTY OF h_excel 'Visible' = 1.
PERFORM err_hdl.
* get list of workbooks, initially empty
CALL METHOD OF h_excel 'Workbooks' = h_mapl.
PERFORM err_hdl.
* add a new workbook
CALL METHOD OF h_mapl 'Add' = h_map.
PERFORM err_hdl.
LOOP AT l_i_demo INTO l_wa_demo.
h = sy-tabix + 1.
PERFORM fill_cell USING h 1 0 l_wa_demo-data.
ENDLOOP.
*& Form FILL_CELL
* text
* -->I text
* -->J text
* -->BOLD text
* -->VAL text
FORM fill_cell USING i j bold val.
CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = i #2 = j.
PERFORM err_hdl.
SET PROPERTY OF h_zl 'Value' = val .
PERFORM err_hdl.
GET PROPERTY OF h_zl 'Font' = h_f.
PERFORM err_hdl.
SET PROPERTY OF h_f 'Bold' = bold .
PERFORM err_hdl.
ENDFORM. "FILL_CELL
*& Form ERR_HDL
* text
FORM err_hdl.
IF sy-subrc <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
STOP.
ENDIF.
ENDFORM. "ERR_HDL
Please refer to the following Demo ABAP Code for a complete reference.
RSDEMO01.
Hope this helps.
Thanks,
Samantak. -
Download data into excel with boxes
Hi Folks,
In my goods receipt report output, there is a footer with boxes for signature purpose.
This output should be able to download in Excel format.
Is it possible to show the boxes in excel file while downloading the output?
If so, please suggest me how to do so..
Thanks in advance,
Shyam.Hi ermac,
Is there any simple process other than OLE application, as it is a simple report.
Thanks,
Shyam. -
How to download output data into Excel with all Column Headings
Hi Experts,
Please tell me How to download output data of ALV Grid into Excel file with all Column Headings and I want to do this using coding,
please send me if any solution is available.
Thanks & Regards,
YogeshVERSION CONTROL (Most recent on top): *
DATE(mm.dd.yyyy) AUTHOR *
06.25.2007 Pattan Naveen *
Hi yogesh,,
Go through this in this u find ur solution.
report ZTEst_programe no standard page heading
line-size 100
line-count 50(5)
message-id zz.
*--alv type declaration
type-pools: slis.
*--Tables:
tables: anla,
anlz,
anlh,
anlb,
anlc.
data: v_pos type i.
data: v_ndjar type i.
data: v_ndper type i,
v_ndperndabp type i,
v_ndjarndabp1 type i,
v_ndjarndabp type i,
value type i,
date(10) type c value '2006.12.04'.
data: c_0000(4) type c value '0000'.
data: begin of it_final occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
anlhtxt like anlh-anlhtxt,
sernr like anla-sernr,
invnr like anla-invnr,
menge like anla-menge,
meins like anla-meins,
inken like anla-inken,
ivdat like anla-ivdat,
aktiv like anla-aktiv,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
werks like anlz-werks,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ord41 like anla-ord41,
ord44 like anla-ord44,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
lifnr like anla-lifnr,
typbz like anla-typbz,
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
vmgli like anla-vmgli,
invzu like anla-invzu,
ernam like anla-ernam,
erdat like anla-erdat,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like anlb-afabg,
ndabj like anlc-ndabj,
ndabp like anlc-ndabp,
andsj like anlc-andsj,
andsp like anlc-andsp,
safbg like anlb-safbg,
umjar like anlb-umjar,
inbda like anlb-inbda,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
deakt like anla-deakt,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
ksafa like anlc-ksafa,
kmafa like anlc-kmafa,
end of it_final.
data: begin of it_final_as91 occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
anlhtxt like anlh-anlhtxt,
sernr like anla-sernr,
invnr like anla-invnr,
menge like anla-menge,
meins like anla-meins,
inken like anla-inken,
ivdat like anla-ivdat,
aktiv like anla-aktiv,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
werks like anlz-werks,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ord41 like anla-ord41,
ord44 like anla-ord44,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
lifnr(10),
typbz(15),
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
vmgli like anla-vmgli,
invzu like anla-invzu,
ernam like anla-ernam,
erdat like anla-erdat,
end of it_final_as91.
data: it_download_as91 like it_final_as91 occurs 0
with header line."#EC NEEDED
data: begin of it_final_as92 occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
deakt like anla-deakt,
ernam like anla-ernam,
erdat like anla-erdat,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like date,
ndabj(3) type c,
ndabp(3) type c,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
ksafa like anlc-ksafa,
kmafa like anlc-kmafa,
end of it_final_as92.
data: it_download_as92 like it_final_as92 occurs 0
with header line."#EC NEEDED
data: begin of it_values occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
deakt like anla-deakt,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like date,
ndabj(3) type c,
ndabp(3) type c,
afabe_02 like anlb-afabe,
afasl_02 like anlb-afasl,
ndjar_02 like anlb-ndjar,
ndper_02 like anlb-ndper,
afabg_02 like date,
ndabj_02 like anlc-ndabj,
ndabp_02 like anlc-ndabp,
kansw01 like anlc-kansw,
knafa01 like anlc-knafa,
kaafa01 like anlc-kaafa,
kansw02 like anlc-kansw,
knafa02 like anlc-knafa,
kaafa02 like anlc-kaafa,
kansw03 like anlc-kansw,
knafa03 like anlc-knafa,
kaafa03 like anlc-kaafa,
kansw04 like anlc-kansw,
knafa04 like anlc-knafa,
kaafa04 like anlc-kaafa,
kansw05 like anlc-kansw,
knafa05 like anlc-knafa,
kaafa05 like anlc-kaafa,
kansw06 like anlc-kansw,
knafa06 like anlc-knafa,
kaafa06 like anlc-kaafa,
kansw07 like anlc-kansw,
knafa07 like anlc-knafa,
kaafa07 like anlc-kaafa,
kansw08 like anlc-kansw,
knafa08 like anlc-knafa,
kaafa08 like anlc-kaafa,
kansw09 like anlc-kansw,
knafa09 like anlc-knafa,
kaafa09 like anlc-kaafa,
kanza01 like anlc-kanza,
kaufw01 like anlc-kaufw,
kinvz01 like anlc-kinvz,
ksafa01 like anlc-ksafa,
kmafa01 like anlc-kmafa,
end of it_values.
data: it_values_xls like it_values occurs 0
with header line."#EC NEEDED
data: begin of it_itab1 occurs 0,
bukrs like anla-bukrs,
anlkl like anla-anlkl,
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
invnr like anla-invnr,
ktogr like anla-ktogr,
sernr like anla-sernr,
menge like anla-menge,
meins like anla-meins,
ivdat like anla-ivdat,
inken like anla-inken,
aktiv like anla-aktiv,
deakt like anla-deakt,
zugdt like anla-zugdt,
zujhr like anla-zujhr,
zuper like anla-zuper,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
xafabch like anla-xafabch,
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
ord41 like anla-ord41,
ord44 like anla-ord44,
vmgli like anla-vmgli,
invzu like anla-invzu,
typbz like anla-typbz,
lifnr like anla-lifnr,
ernam like anla-ernam,
erdat like anla-erdat,
end of it_itab1.
data: begin of it_itab2 occurs 0,
bukrs like anlz-bukrs,
anln1 like anlz-anln1,
anln2 like anla-anln2,
bdatu like anlz-bdatu,
werks like anlz-werks,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ipsnr like anlz-ipsnr,
end of it_itab2.
data: begin of it_itab3 occurs 0,
bukrs like anlh-bukrs,
anln1 like anlh-anln1,
anlhtxt like anlh-anlhtxt,
end of it_itab3.
data: begin of it_itab4 occurs 0,
bukrs like anlb-bukrs,
anln1 like anlb-anln1,
anln2 like anla-anln2,
afabe like anlb-afabe,
bdatu like anlb-bdatu,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like anlb-afabg,
ndurj like anlb-ndurj,
ndurp like anlb-ndurp,
umjar like anlb-umjar,
safbg like anlb-safbg,
zinbg like anlb-zinbg,
inbda like anlb-inbda,
end of it_itab4.
data: begin of it_itab5 occurs 0,
bukrs like anlc-bukrs,
anln1 like anlc-anln1,
anln2 like anla-anln2,
gjahr like anlc-gjahr,
afabe like anlc-afabe,
zujhr like anlc-zujhr,
zucod like anlc-zucod,
ndabj like anlc-ndabj,
ndabp like anlc-ndabp,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
ksafa like anlc-ksafa,
andsj like anlc-andsj,
andsp like anlc-andsp,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
kmafa like anlc-kmafa,
end of it_itab5.
ALV DECLARATIONS
*--declarations for Xls sheet header field names
data: begin of it_head occurs 0,
column(70).
data: end of it_head.
data: begin of it_head1 occurs 0,
column(70).
data: end of it_head1.
*--type declarations for field catalog for basic report
data: it_fldcat_head type slis_t_fieldcat_alv,
wa_fldcat_head type slis_fieldcat_alv."#EC NEEDED
data : w_field type slis_fieldcat_alv."#EC NEEDED
data: it_fldcat_head1 type slis_t_fieldcat_alv,
wa_fldcat_head1 type slis_fieldcat_alv."#EC NEEDED
*--type declarations for layout design
data: wa_layout type slis_layout_alv.
*--type declarations for list header on grid
*data: top_of_page type slis_t_listheader.
*--declaration of variables
data : w_repid like sy-repid.
**selection-screen
select-options: s_bukrs for anla-bukrs,
s_anln1 for anla-anln1.
select-options: s_deakt for anla-deakt,
s_gjahr for anlc-gjahr obligatory,
s_anlkl for anla-anlkl,
s_date for anla-aktiv.
*selection-screen
selection-screen begin of block blk1 with frame title text-022.
selection-screen begin of line.
parameters : r1 radiobutton group g1 default 'X'.
selection-screen comment 20(50) text-020.
selection-screen end of line.
selection-screen begin of line.
parameters : r2 radiobutton group g1.
selection-screen comment 20(50) text-021.
selection-screen end of line.
selection-screen end of block blk1.
selection-screen begin of block blk2 with frame title text-023.
select-options: s_ernam for anla-ernam,
s_erdat for anla-erdat .
selection-screen end of block blk2.
*--INITIALIZATION
initialization.
w_repid = sy-repid.
at selection-screen.
if r1 = 'X'.
perform selection_screen_validation.
endif.
if r2 = 'X'.
perform selection_screen_validation.
endif.
*--START-OF-SELCTION
start-of-selection.
if r1 = 'X'.
perform populate-data.
perform fill_finaldata.
perform comment_build using top_of_page.
perform xls_output.
perform download.
endif.
if r2 = 'X'.
perform populate-data.
perform fill_finaldata.
perform fill_as92data.
perform putdata_horizontal.
perform xls_output_as92.
perform download_as92.
endif.
*--END-OF-SELCTION
end-of-selection.
if r1 = 'X'.
perform build_layout.
perform build_fieldcatalog.
perform top_of_page.
perform list-display.
endif.
if r2 = 'X'.
perform build_layout.
perform build_fieldcatalog1.
perform list-display1.
endif.
*& Form SELECTION_SCREEN_VALIDATION
text
--> p1 text
<-- p2 text
form selection_screen_validation.
*--validating originating company code
data: l_bukrs like anla-bukrs."#EC NEEDED
if not s_bukrs[] is initial.
select single bukrs from anla
into l_bukrs
where bukrs in s_bukrs.
if sy-subrc <> 0.
message e000 with text-001 .
endif.
endif.
*--validating originating main asset no.
data: l_anln1 like anla-anln1."#EC NEEDED
if not s_anln1[] is initial.
select single anln1 from anla
into l_anln1
where anln1 in s_anln1.
if sy-subrc <> 0.
message e000 with text-002 .
endif.
endif.
*--validating originating Deactivation date
data: l_deakt like anla-deakt."#EC NEEDED
if not s_deakt[] is initial.
select single deakt from anla
into l_deakt
where deakt in s_deakt.
if sy-subrc <> 0.
message e000 with text-004 .
endif.
endif.
*--validating originating asset class.
data: l_anlkl like anla-anlkl."#EC NEEDED
if not s_anlkl[] is initial.
select single anlkl from anla
into l_anlkl
where anlkl in s_anlkl.
if sy-subrc <> 0.
message e000 with text-006 .
endif.
endif.
*--validating originating Date
data: l_date like anla-aktiv."#EC NEEDED
if not s_date[] is initial.
select single aktiv from anla
into l_date
where aktiv in s_date.
if sy-subrc <> 0.
message e000 with text-007 .
endif.
endif.
*--validating originating Fiscal year which first acquisition was posted
data: l_gjahr like anlc-gjahr."#EC NEEDED
if not s_gjahr[] is initial.
select single gjahr from anlc
into l_gjahr
where gjahr in s_gjahr.
if sy-subrc <> 0.
message e000 with text-008.
endif.
endif.
data: l_ernam like anla-ernam."#EC NEEDED
if not s_ernam[] is initial.
select single ernam from anla
into l_ernam
where ernam in s_ernam.
if sy-subrc <> 0.
message e000 with text-009.
endif.
endif.
data: l_erdat like anla-erdat."#EC NEEDED
if not s_erdat[] is initial.
select single erdat from anla
into l_erdat
where erdat in s_erdat.
if sy-subrc <> 0.
message e000 with text-010.
endif.
endif.
endform. " SELECTION_SCREEN_VALIDATION
*& Form POPULATE-DATA
text
--> p1 text
<-- p2 text
form populate-data.
select bukrs
anlkl
anln1
anln2
txt50
txa50
invnr
ktogr
sernr
menge
meins
ivdat
inken
aktiv
deakt
zugdt
zujhr
zuper
gdlgrp
anlue
xafabch
aibn1
aibn2
aibdt
posnr
ord41
ord44
vmgli
invzu
typbz
lifnr
ernam
erdat
from anla
into table it_itab1
where anlkl in s_anlkl and
anln1 in s_anln1 and
deakt in s_deakt and
bukrs in s_bukrs and
aktiv in s_date.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
if not it_itab1[] is initial.
select bukrs
anln1
anln2
bdatu
werks
gsber
kostl
kostlv
stort
raumn
txjcd
ipsnr
from anlz
into table it_itab2
for all entries in it_itab1
where bukrs = it_itab1-bukrs and
anln1 = it_itab1-anln1 and
anln2 = it_itab1-anln2.
anln2 = '0000'.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
if not it_itab2[] is initial.
select bukrs
anln1
anlhtxt
from anlh
into table it_itab3
for all entries in it_itab2
where bukrs = it_itab2-bukrs and
anln1 = it_itab2-anln1.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
if not it_itab1[] is initial.
select bukrs
anln1
anln2
afabe
bdatu
afasl
ndjar
ndper
afabg
ndurj
ndurp
umjar
safbg
zinbg
inbda
from anlb
into table it_itab4
for all entries in it_itab1
where bukrs = it_itab1-bukrs and
anln1 = it_itab1-anln1 and
anln2 = it_itab1-anln2.
anln2 = '0000'.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
sort it_itab4 by bukrs anln1 anln2 afabe.
if not it_itab4[] is initial.
select bukrs
anln1
anln2
gjahr
afabe
zujhr
zucod
ndabj
ndabp
kansw
knafa
kaafa
ksafa
andsj
andsp
kanza
kaufw
kinvz
kmafa
from anlc
into table it_itab5
for all entries in it_itab4
where bukrs = it_itab4-bukrs and
anln1 = it_itab4-anln1 and
anln2 = it_itab4-anln2 and
anln2 = '0000' and
gjahr in s_gjahr.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
sort it_itab5 by bukrs anln1 anln2 ndabj ndabp.
endform. " POPULATE-DATA
*& Form FILL_FINALDATA
text
--> p1 text
<-- p2 text
form fill_finaldata.
loop at it_itab5.
loop at it_itab4 where bukrs = it_itab5-bukrs and
anln1 = it_itab5-anln1 and
anln2 = it_itab5-anln2 and
afabe = it_itab5-afabe.
it_final-afabe = it_itab4-afabe.
it_final-afasl = it_itab4-afasl.
it_final-ndjar = it_itab4-ndjar.
it_final-ndper = it_itab4-ndper.
it_final-afabg = it_itab4-afabg.
it_final-umjar = it_itab4-umjar.
it_final-safbg = it_itab4-safbg.
it_final-inbda = it_itab4-inbda.
it_final-ndabj = it_itab5-ndabj.
it_final-ndabp = it_itab5-ndabp.
it_final-kansw = it_itab5-kansw.
it_final-knafa = it_itab5-knafa.
it_final-kaafa = it_itab5-kaafa.
it_final-andsj = it_itab5-andsj.
it_final-andsp = it_itab5-andsp.
it_final-kanza = it_itab5-kanza.
it_final-kaufw = it_itab5-kaufw.
it_final-kinvz = it_itab5-kinvz.
it_final-ksafa = it_itab5-ksafa.
it_final-kmafa = it_itab5-kmafa.
read table it_itab1 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1
anln2 = it_itab5-anln2.
if sy-subrc = 0.
it_final-anlkl = it_itab1-anlkl.
it_final-anln1 = it_itab1-anln1.
it_final-anln2 = it_itab1-anln2.
it_final-bukrs = it_itab1-bukrs.
it_final-txt50 = it_itab1-txt50.
it_final-txa50 = it_itab1-txa50.
it_final-invnr = it_itab1-invnr.
it_final-sernr = it_itab1-sernr.
it_final-menge = it_itab1-menge.
it_final-meins = it_itab1-meins.
it_final-ivdat = it_itab1-ivdat.
it_final-inken = it_itab1-inken.
it_final-aktiv = it_itab1-aktiv.
it_final-deakt = it_itab1-deakt.
it_final-gdlgrp = it_itab1-gdlgrp.
it_final-anlue = it_itab1-anlue.
it_final-aibn1 = it_itab1-aibn1.
it_final-aibn2 = it_itab1-aibn2.
it_final-aibdt = it_itab1-aibdt.
it_final-ord41 = it_itab1-ord41.
it_final-ord44 = it_itab1-ord44.
it_final-vmgli = it_itab1-vmgli.
it_final-typbz = it_itab1-typbz.
it_final-lifnr = it_itab1-lifnr.
it_final-posnr = it_itab1-posnr.
it_final-invzu = it_itab1-invzu.
endif.
read table it_itab2 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1
anln2 = it_itab5-anln2.
if sy-subrc = 0.
it_final-werks = it_itab2-werks.
it_final-gsber = it_itab2-gsber.
it_final-kostl = it_itab2-kostl.
it_final-kostlv = it_itab2-kostlv.
it_final-stort = it_itab2-stort.
it_final-raumn = it_itab2-raumn.
it_final-txjcd = it_itab2-txjcd.
endif.
read table it_itab3 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1.
if sy-subrc = 0.
it_final-anlhtxt = it_itab3-anlhtxt.
endif.
append it_final.
clear it_final.
endloop.
endloop.
loop at it_final.
move-corresponding it_final to it_final_as91.
append it_final_as91.
clear it_final_as91.
endloop.
delete adjacent duplicates from it_final_as91 comparing anlkl bukrs
anln1 anln2.
it_download_as91[] = it_final_as91[].
endform. " FILL_FINALDATA
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form build_layout.
wa_layout-zebra = 'X'.
endform. " BUILD_LAYOUT
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
form build_fieldcatalog.
if it_fldcat_head is initial.
v_pos = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLKL'.
wa_fldcat_head-seltext_l = 'Asset Class'(093).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'BUKRS'.
wa_fldcat_head-seltext_l = 'Company'(092).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLN1'.
wa_fldcat_head-seltext_l = 'Asset No'(091).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLN2'.
wa_fldcat_head-seltext_l = 'Asset Sub No'(090).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXT50'.
wa_fldcat_head-seltext_l = 'Asset Des.'(089).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXA50'.
wa_fldcat_head-seltext_l = 'Asset Des.'(088).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLHTXT'.
wa_fldcat_head-seltext_l = 'Asset main no txt'(087).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'SERNR'.
wa_fldcat_head-seltext_l = 's.no/Expl no.'(086).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INVNR'.
wa_fldcat_head-seltext_l = 'Inv No'(085).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'MENGE'.
wa_fldcat_head-seltext_l = 'Qtty'(084).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'MEINS'.
wa_fldcat_head-seltext_l = 'Units'(083).
append wa_fldcat_head to it_fldcat_head.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INKEN'.
wa_fldcat_head-seltext_l = 'Inv indi.'(082).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'IVDAT'.
wa_fldcat_head-seltext_l = 'Last inv date'(081).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AKTIV'.
wa_fldcat_head-seltext_l = 'Asset Capital date'(080).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'GSBER'.
wa_fldcat_head-seltext_l = 'Busin. Area'(079).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'KOSTL'.
wa_fldcat_head-seltext_l = 'cost centre'(078).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'KOSTLV'.
wa_fldcat_head-seltext_l = 'CC respon.for asset'(077).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'WERKS'.
wa_fldcat_head-seltext_l = 'Plant'(076).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'STORT'.
wa_fldcat_head-seltext_l = 'Asset location'(075).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'RAUMN'.
wa_fldcat_head-seltext_l = 'Room'(074).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXJCD'.
wa_fldcat_head-seltext_l = 'Tax. Jur.'(073).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ORD41'.
wa_fldcat_head-seltext_l = 'Evaluation Grp 1'(072).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ORD44'.
wa_fldcat_head-seltext_l = 'Evaluation Grp 4'(071).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'GDLGRP'.
wa_fldcat_head-seltext_l = 'Evalu. group 5'(070).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLUE'.
wa_fldcat_head-seltext_l = 'Asset Super No'(069).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'LIFNR'.
wa_fldcat_head-seltext_l = 'Vendor Acct. No.'(068).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TYPBZ'.
wa_fldcat_head-seltext_l = 'Reference no'(067).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBN1'.
wa_fldcat_head-seltext_l = 'Original Asset Trans.'(066).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBN2'.
wa_fldcat_head-seltext_l = 'Original Asset Trans.'(065).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBDT'.
wa_fldcat_head-seltext_l = 'Trans. Asset'(064).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'POSNR'.
wa_fldcat_head-seltext_l = 'WBS Elt. Invt. Proj.'(063).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'VMGLI'.
wa_fldcat_head-seltext_l = 'Property clas.key'(062).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INVZU'.
wa_fldcat_head-seltext_l = 'suppl.inv spec.'(061).
append wa_fldcat_head to it_fldcat_head.
endif.
endform. " BUILD_FIELDCATALOG
*& Form COMMENT_BUILD
text
-->P_TOP_OF_PAGE text
*form comment_build using top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
****Header
clear : ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = 'ASSET MASTER DATA LIST'.
append ls_line to top_of_page.
****Selection
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'Asset Records'.
append ls_line to top_of_page.
****Action
clear ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: not used for this type
ls_line-info = 'for AS91'.
append ls_line to top_of_page.
*endform. "comment_build
FORM top_of_page *
*form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = top_of_page.
*endform. "top_of_page
*& Form LIST-DISPLAY
text
--> p1 text
<-- p2 text
form list-display.
wa_layout-colwidth_optimize = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = it_fldcat_head
i_background_id = 'ALV_BACKGROUND'
tables
t_outtab = it_final_as91
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
write:/'No Top of Page'(098).
endif.
endform. " LIST-DISPLAY
*& Form DOWNLOAD
text
--> p1 text
<-- p2 text
form download.
perform setup_header.
call function 'DOWNLOAD'
exporting
filetype = 'DAT'
tables
data_tab = it_download_as91
fieldnames = it_head
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 <> 0.
write:/'Error in file Type'(097).
endif.
endform. " DOWNLOAD
*& Form setup_header
text -
Download the output into Excel...(List- export- spreadsheet)
Dear friends,
I want to download the output into Excel...
I am using all SAP standards and using the ALV Block list
Ex: List->export->local file.. is anable from here i can download to excell .....but the same there is anothere option : List->export->spreadsheet...( this one inactive.)
I want to activate the List->export->spreadsheet option.
how to do this???
Thanks,
Sridhar.Hi
Use the Function Module:
EXCEL_OLE_STANDARD_DAT
For your purpose.
But by default you can get the option to download into several formats including your desired one.
Regards,
Sreeram -
Download to Excel with Header but one field data is repeating
Hi All,
I'm downloading to Excel with Header. But One field is repeating and another is not. This is happening only when I use 'CONCATENATE ' . With Out this key usage data download to excel is correct. But CONCATENATE is required as constant need to add before the one field.
My coding is as below.
DATA: BEGIN OF IT_FINAL OCCURS 0,
P1(10) TYPE C,
SI(19) type c,
END OF IT_FINAL.
DATA : BEGIN OF IT_HEADER OCCURS 0,
TITLE(100) TYPE C,
END OF IT_HEADER,WA_HEADER LIKE IT_HEADER.
loop at it_final.
CONCATENATE '894412' it_final-SI INTO IT_FINAL.
modify it_final.
endloop.
CLEAR:WA_HEADER.
WA_HEADER-TITLE = 'Mat No'.
APPEND WA_HEADER TO IT_HEADER.
CLEAR:WA_HEADER.
WA_HEADER-TITLE = 'Serial'.
APPEND WA_HEADER TO IT_HEADER.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = P_FILE " path offile where u need to download
TABLES
DATA_TAB = IT_FINAL
FIELDNAMES = IT_HEADER.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = P_FILE " path offile where u need to download
TABLES
DATA_TAB = IT_FINAL
FIELDNAMES = IT_HEADER.
Excel OUT PUT:
Mat No Serial
11Z52321 8944126000
11Z52394 8944126000
11Z52395 8944126000
Thank You,
Pranithahi,
it would have been better if u hve opt for creating workarea for ur internal table.
Try to use "clear it_final" after
CONCATENATE '894412' it_final-SI INTO IT_FINAL.
n also change the modify statement :
modify it_final transporting SI .
hope this will surely help you
Regards,
Punit
Edited by: punit raval on Aug 26, 2011 2:55 PM -
Facing problem while downloading ALV grid Output into Excel
Hi Guys,
I am facing problem while downloading ALV grid Output into Excel.
It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
Can someone help me regarding this
thanks for your helpHi,
Open up Excel on your desktop. Goto Tools > Macro > Security.
Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
Was this your problem? Don't forget those points, either.
check with this wetther it is solved or not.
Regards,
sana. -
How GET Output to Excel with Oracle9i Report using OC4J
how GET Output to Excel with Oracle9i Report using OC4J.
I FINISHED THE SETPS CONCIDERING THE JSP CODE NEEDED TO GET THE EXCEL OUTPUT ON LOCAL MACHINE.
I NEED TO PUBLISH THIS REPORT THROUGH APPLICATION SERVER.
THE QUESTION IS:
1- HOW TO START AN OC4J INSTANCE FROM ORACLE 9I DS FOR THIS REPORT?
2- WHERE (PATH) TO PUBLISH THE REPORT ON THE APPLICATION SERVER?
3- WHAT IS THE DEFAULT URL TO RUN THIS REPORT AND WHERE TO PUT IT?
4- HOW TO MAKE MAPPING FOR DIRECOTRY PATH TO TRANSLATED AS URL FOR THIS REPORT?
5- IF ANY ONE CAN GIVE ME THE FULL CODE TO RUN AND CALL SIMPLE JSP REPORT TO BE VIED IN INTERNET EXPLORER.
THANK YOUHi,
I can't answer to all your questions, however I can tell you that:
2) The directory where to put the report file is specifiend in a file named
<serverName>.conf
in the sourceDire property
<property name="sourceDir" value="/directory/dove/mettere/i/report"/>
that you can find under ORACLE_HOME/reports/conf
3) The URL is
http://<server IAS address>:<port number>/<jsp file path>/<repName>.jsp?server=<report server name>&userid=<user>/<pwd>@<DB conn string>[&<param>=<valore>[&...]]
5) In IE you have only to set the previous URL in the address bar.
Hope this helps you
Bye
Raffy -
How to download data into two different columns 2003 excel format in ole
Hi ALL
when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
both fields come in only one column .Can any one suggest
CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI IN CHARACTER MODE.If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
FORM fill_cell USING p_row p_col p_value.
CALL METHOD OF obj_excel 'CELLS' = obj_cell
EXPORTING
#1 = p_row
#2 = p_col.
SET PROPERTY OF obj_cell 'VALUE' = p_value.
ENDFORM. "fill_cell -
How to export report output into excel.
Hi all
how to export report output into excel sheet can any on give me answer step by step please as soon as possible
kkHi Prashanth,
If you are executing Query from WAD ---> Right click on Table (only on Characteristics Data) --> Enhanced Menu ---> Export as --> CSV file or MS Excel
assign points if this helps,
Thanks,
Sudhakar -
Output to Excel with Oracle9i Report -- DEMO DOWN
The Viewlet "Output to Excel with Oracle9i Report" (as well as the others) at
http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
Does not work. I keep getting a 'Incorrect skin. Stoppting' Error.
Please update the viewlet or make it available to email or download.
ThanksActually you don't need to see that viewlet. Just follow the easy follow-by steps in Metalink Note 240819.1 "How to Generate Excel output in browser using Reports9i JSP". This is faster done than watching the viewlet! You can use it for 9i and as well for 10g.
Please note the reference to note 271590.1 in the end of the document. Without that it won't work on 10g.
Regards,
Martin Malmstrom
ORACLE Consulting -
Ability to download Spool into Excel
Hi,
I have a requirement that the ALV report needs to be run in background with ability to download spool into excel .Can anyone please help in this regard.
Many Thanks,
SharathHi,
First check whether the status of the job is Completed or Cancelled.
WHILE 1 = 1.
* GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '35'
* JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
* CHANGING
* RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)
* READ THE JOBSTEPLIST & GET THE SPOOL NUMBER
IF wa_jobhead-status = c_a OR wa_jobhead-status = c_f.
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident space.
w_spool_number = wa_jobsteplist-listident.
EXIT.
ENDIF.
ENDWHILE.
Use FM "RSPO_DOWNLOAD_SPOOLJOB".
Best Regards,
Sunil. -
I had to wipe out my laptop, I am waiting to get my serial number back. I need to know how I download Logic Pro 9 with the codes I already have.
If you bought the boxed set of Logic Studio 2.0 which includes LP9, then you cannot download it. You must use the disks that came as part of the boxed set... to install from.
If you bought the App Store version of Logic Pro 9 then go to the Mac App Store App, Sign into the Store using the same Apple ID you used to purchase LP originally, look under the Purchase Tab and you shouldl find LP9 ready and waiting for you to download and install.
Maybe you are looking for
-
Printing Problem with CS 6 extended and Canon Pro 9500
My prints are no longer coming out centered. I have the "center" box checked in the CS6 print dialogue box. The prints are not centered left to right or top to bottom. This seems to be a problem since I upgraded to CS 6 extended and or newest print d
-
Old Toad's automator workflow to backup Library6.iPhoto database
Dear Old Toad, I just today downloaded your workflow to backup the iPhoto database file, and am having problems making it work. When I run it, either from the dock or the script menu, it launches Automator but then closes without doing anything. I do
-
Why do I get an error page when I select Toolkit for CreateJS? I am using CS6 Flash Pro.
-
2 different computers but want January upgrade
Hello - my ancient laptop houses my email (no additional space & not worth more $$) but I sync my tunes etc with my husbands's laptop - both Windows XP. The Apple Store in Toronto said I could buy the upgrade, by loading ITunes onto the ancient lapto
-
What are the setups required to perform any inventory transactions
Hello freinds . What are the bare minimum mandatory setups required in order to perform any inventory transaction