Download to excel from alv grid
I developed a alv report and I have one percentage field(say PER) in the grid.When I sum on that field PER then it comes in my formula basis.Suppose If I have 5 line items and all PER field have a value 2 then when I sum in PER column then it come 7 inseted of 10 becoze of my formula basis and it comes perfect.But my query is when I download to excel then it comes real value 10 insted of 7. here my formula basis sum which is 7 for all 5 line items is not comming. Can any body help me how will it come?
Thanks,
Rakesh
Hi
try this code----
*& Form DOWNLOAD_EXCEL_TEMPLATE
text
--> p1 text
<-- p2 text
FORM download_excel_template .
TYPES: BEGIN OF lt_data,
field1(20),
field2(30),
field3(20),
field4(20),
field5(20),
field6(30),
field7(15),
field8(10),
field9(10),
field10(20),
field11(20),
field12(10),
field13(20),
field14(20),
END OF lt_data.
DATA: lv_file TYPE rlgrap-filename,
li_data TYPE STANDARD TABLE OF lt_data,
wa_data TYPE lt_data,
lv_pathcheck type c,
lv_file1 type string.
wa_data-field1 = ''.
APPEND wa_data TO li_data.
REFRESH gi_header.
wa_header-name = 'Company Code'.
APPEND wa_header TO gi_header.
wa_header-name = 'Main Asset Number'.
APPEND wa_header TO gi_header.
wa_header-name = 'Asset Sub Number'.
APPEND wa_header TO gi_header.
wa_header-name = 'Document Date'.
APPEND wa_header TO gi_header.
wa_header-name = 'Posting Date'.
APPEND wa_header TO gi_header.
wa_header-name = 'Asset Value Date'.
APPEND wa_header TO gi_header.
wa_header-name = 'Item Text'.
APPEND wa_header TO gi_header.
wa_header-name = 'Reference'.
APPEND wa_header TO gi_header.
wa_header-name = 'Allocation'.
APPEND wa_header TO gi_header.
wa_header-name = 'Amount Posted'.
APPEND wa_header TO gi_header.
wa_header-name = 'Percentage Rate'.
APPEND wa_header TO gi_header.
wa_header-name = 'Quantity'.
APPEND wa_header TO gi_header.
wa_header-name = 'Prior-Yr Quantity'.
APPEND wa_header TO gi_header.
wa_header-name = 'Curr-Yr Quantity'.
APPEND wa_header TO gi_header.
lv_file = gv_file.
lv_file1 = gv_file.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = lv_file1
RECEIVING
result = lv_pathcheck
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
FIND '.xls' IN lv_file IGNORING CASE.
IF sy-subrc = 0.
REPLACE '.XLS' IN lv_file WITH ' ' IGNORING CASE.
ENDIF.
FIND '.TXT' IN lv_file IGNORING CASE.
IF sy-subrc = 0.
REPLACE '.TXT' IN lv_file WITH ' ' IGNORING CASE.
ENDIF.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = lv_file
data_sheet_name = 'DATA'
TABLES
data_tab = li_data
fieldnames = gi_header
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_pivot_fields = 6
download_problem = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID gv_msgid TYPE 'E' NUMBER 002.
ENDIF.
ENDFORM. " DOWNLOAD_EXCEL_TEMPLATE
regards,
Prashant
Similar Messages
-
Taking download into excel from ALV Grid - header is printing in two lines
Hi All,
I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
I am using function module "Reuse_alv_grid_display" for the purpose.
Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
Thanks in Advance,
ChandanHi..
1. Pass header name in internal table appned first line.
2. after that pass u r data .
3. Use FM. WS_DOWNLOAD
Salil ......
Edited by: salil chavan on Nov 26, 2008 11:07 AM -
Why is the spreadsheet empty when users download to Excel from ALV grid?
Users are seeing SAP GUI transaction results display in the ALV Grid when running an SAP Report; however, when they click the Download to Excel icon the spreadsheet is empty. When they use List...Export...Spreadsheet, the spreadsheet is filled.
This seems to only be happening with 'Z' transactions. Standard delivered transactions are OK.
Using SAP GUI for Windows and Excel 2003.Hi All,
I also have same Problem I my case when i click on 'Microsoft Excel' it does nothing. It does not even open a sheet.
Please suggest,
regards,
Vinit -
Last digit truncates while downloading to Excel from ALV Grid
Hi All,
I have been using REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY in my report program.
While i use REUSE_ALV_GRID_DISPLAY and downloading the data to a local file(Excel) the last digit of the Vendor code is truncated. But in REUSE_ALV_LIST_DISPLAY the datas are downloaded correctly as displayed in the ALV.
I have copied the code for the reference.
REPORT zfirp001 .
TYPE-POOLS: slis.
TABLES: bsak.
SELECT-OPTIONS: s_bukrs FOR bsak-bukrs,
s_lifnr FOR bsak-lifnr,
s_blart FOR bsak-blart,
s_augdt FOR bsak-augdt,
s_zterm FOR bsak-zterm.
PARAMETERS: s_list AS CHECKBOX,
s_vari LIKE disvariant-variant.
DATA: g_ext_num(24) TYPE c.
DATA: BEGIN OF gt_bsak OCCURS 0,
bukrs LIKE bsak-bukrs,
lifnr LIKE bsak-lifnr,
augdt LIKE bsak-augdt,
gjahr LIKE bsak-gjahr,
belnr LIKE bsak-belnr,
blart LIKE bsak-blart,
zterm LIKE bsak-zterm,
END OF gt_bsak.
DATA: BEGIN OF gt_bseg OCCURS 0,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
wrbtr LIKE bseg-wrbtr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
hkont LIKE bseg-hkont,
END OF gt_bseg.
ALV
DATA: gt_fieldtab TYPE slis_t_fieldcat_alv,
g_save(1) TYPE c,
g_variant LIKE disvariant.
DATA: BEGIN OF gt_result OCCURS 0,
bukrs LIKE bsak-bukrs,
lifnr LIKE bsak-lifnr,
name1 LIKE lfa1-name1,
augdt LIKE bsak-augdt,
gjahr LIKE bsak-gjahr,
belnr LIKE bsak-belnr,
blart LIKE bsak-blart,
zterm LIKE bsak-zterm,
wrbtr LIKE bseg-wrbtr,
waers LIKE bkpf-waers,
ext_num(24) TYPE c,
txt20 LIKE skat-txt20,
usr00 LIKE prps-usr00,
usr01 LIKE prps-usr01,
usr02 LIKE prps-usr02,
usr03 LIKE prps-usr03,
END OF gt_result.
CONSTANTS: c_credit(1) TYPE c VALUE 'H',
c_x(1) TYPE c VALUE 'X',
c_en(2) TYPE c VALUE 'EN',
c_mrc(4) TYPE c VALUE 'CA01'.
*====================================================
INITIALIZATION.
PERFORM initialize_variant.
AT SELECTION-SCREEN.
PERFORM pai_of_selection_screen.
*====================================================
START-OF-SELECTION.
REFRESH gt_result.
find clearing documents
SELECT bukrs
lifnr
augdt
gjahr
belnr
blart
zterm
INTO TABLE gt_bsak
FROM bsak
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr
AND augdt IN s_augdt
AND blart IN s_blart
AND zterm IN s_zterm.
CHECK NOT gt_bsak[] IS INITIAL.
LOOP AT gt_bsak.
read WBS items
SELECT bukrs
belnr
gjahr
dmbtr
projk
shkzg
hkont
INTO TABLE gt_bseg
FROM bseg
WHERE bukrs = gt_bsak-bukrs
AND belnr = gt_bsak-belnr
AND gjahr = gt_bsak-gjahr
AND projk > space.
gt_result-bukrs = gt_bsak-bukrs.
gt_result-lifnr = gt_bsak-lifnr.
gt_result-augdt = gt_bsak-augdt.
gt_result-belnr = gt_bsak-belnr.
gt_result-gjahr = gt_bsak-gjahr.
gt_result-blart = gt_bsak-blart.
gt_result-zterm = gt_bsak-zterm.
document currency
SELECT SINGLE waers
INTO gt_result-waers
FROM bkpf
WHERE bukrs = gt_bsak-bukrs
AND belnr = gt_bsak-belnr
AND gjahr = gt_bsak-gjahr.
vendor name
SELECT SINGLE name1
INTO gt_result-name1
FROM lfa1
WHERE lifnr = gt_result-lifnr.
for each accounting document
LOOP AT gt_bseg.
convert to external WBS
CALL FUNCTION 'PSPNUM_INTERN_TO_EXTERN_CONV'
EXPORTING
edit_imp = c_x
int_num = gt_bseg-projk
IMPORTING
ext_num = gt_result-ext_num
EXCEPTIONS
not_found = 1
OTHERS = 2.
debit or credit
IF gt_bseg-shkzg = c_credit.
gt_result-wrbtr = gt_bseg-wrbtr.
ELSE.
gt_result-wrbtr = gt_bseg-wrbtr * -1.
ENDIF.
GL short Text
SELECT SINGLE txt20
INTO gt_result-txt20
FROM skat
WHERE spras = c_en
AND ktopl = 'CA01'
AND saknr = gt_bseg-hkont.
user fields
SELECT SINGLE usr00
usr01
usr02
usr03
INTO (gt_result-usr00,
gt_result-usr01,
gt_result-usr02,
gt_result-usr03)
FROM prps
WHERE pspnr = gt_bseg-projk.
append to result table
APPEND gt_result.
ENDLOOP.
ENDLOOP.
*====================================================
END-OF-SELECTION.
PERFORM initialize_fieldcat USING gt_fieldtab[].
g_variant-report = sy-repid.
g_save = 'A'.
IF s_list = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = gt_fieldtab
i_default = 'A'
i_save = g_save
is_variant = g_variant
TABLES
t_outtab = gt_result.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = gt_fieldtab
i_default = 'A'
i_save = g_save
is_variant = g_variant
TABLES
t_outtab = gt_result.
ENDIF.
*& Form initialize_variant
FORM initialize_variant.
g_save = 'A'.
CLEAR g_variant.
g_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = g_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
s_vari = g_variant-variant.
ENDIF.
ENDFORM. " INITIALIZE_VARIANT
*& Form pai_of_selection_screen
FORM pai_of_selection_screen.
IF NOT s_vari IS INITIAL.
MOVE s_vari TO g_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = g_variant.
ELSE.
PERFORM initialize_variant.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
*& Form initialize_fieldcat
FORM initialize_fieldcat USING p_fieldtab TYPE slis_t_fieldcat_alv.
DATA: l_fieldcat TYPE slis_fieldcat_alv.
CLEAR l_fieldcat.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'BUKRS'.
l_fieldcat-seltext_L = 'Company'.
l_fieldcat-outputlen = '8'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'LIFNR'.
l_fieldcat-seltext_L = 'Vendor'.
l_fieldcat-outputlen = '10'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'NAME1'.
l_fieldcat-seltext_L = 'Name'.
l_fieldcat-outputlen = '35'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'AUGDT'.
l_fieldcat-seltext_L = 'Cleared'.
l_fieldcat-outputlen = '10'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'GJAHR'.
l_fieldcat-seltext_L = 'Year'.
l_fieldcat-outputlen = '5'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'BELNR'.
l_fieldcat-seltext_L = 'Document'.
l_fieldcat-outputlen = '10'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'BLART'.
l_fieldcat-seltext_L = 'Type'.
l_fieldcat-outputlen = '4'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'ZTERM'.
l_fieldcat-seltext_L = 'Pay Terms'.
l_fieldcat-outputlen = '4'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'WRBTR'.
l_fieldcat-seltext_L = 'Amount'.
l_fieldcat-outputlen = '13'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'WAERS'.
l_fieldcat-seltext_L = 'CURR'.
l_fieldcat-outputlen = '5'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'EXT_NUM'.
l_fieldcat-seltext_L = 'WBS'.
l_fieldcat-outputlen = '24'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'TXT20'.
l_fieldcat-seltext_L = 'Short Text'.
l_fieldcat-outputlen = '20'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'USR00'.
l_fieldcat-seltext_L = 'H/O File Ref'.
l_fieldcat-outputlen = '20'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'USR01'.
l_fieldcat-seltext_L = 'Local File Ref'.
l_fieldcat-outputlen = '20'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'USR02'.
l_fieldcat-seltext_L = 'INFORM Agree ID'.
l_fieldcat-outputlen = '10'.
APPEND l_fieldcat TO p_fieldtab.
l_fieldcat-tabname = 'GT_RESULT'.
l_fieldcat-fieldname = 'USR03'.
l_fieldcat-seltext_L = 'INFM Prim Ag ID'.
l_fieldcat-outputlen = '10'.
APPEND l_fieldcat TO p_fieldtab.
ENDFORM. " INITIALIZE_FIELDCAT
Could the experts do help to overcome the probs.
Thanks in Advance.
Regards,
Anbalagan.VHi Anbalagan,
i've tested your program - but it works fine (Rel. 4.6C,SAPKB46C30)
download is ok and direct transfer (excel inplace) is ok.
but i've a question to the selection of waers in your program -
why do you select waers from bkpf and not from bsak ?
i think sel. of bkpf is'nt necessary !
regards Andreas -
Facing a Problem while downloading the data from ALV Grid to Excel Sheet
Hi Friends,
Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
Can any one help me out in this case.hi...
if this problems happens dont display the same internal as u finally got.
just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
for eg.
ur final internal int table for disp,
data : begin of itab occur 0,
matnr like mara-matnr,
end of itab.
create new like this,
data : begin of itab occur 0,
matnr(12) type N,
end of itab. -
Download to excel from alv display
Hi,
How to download to excel from alv display.I am using object oriented abap for using alv.If i click export->spreadsheet i am getting fatal error and if i export->local file->spreadsheet i am getting only the column names and heading but no contents.Can anyone tell me how to overcome this problem.
Regards,
Sowmya.Hi Sowmya,
Just put break point near FM reuse_alv_grid_display and check if internal table which is used to display output is popullated or not.
Regards Sachin. -
Issue with Data download to excel from ALV
Hi,
I am trying to download data to excel from ALV.
The number of records are 26000.
When I am trying to download I am getting an error displaying a pop up saying that
problems came up in the following areas during the load
TABLE
The log displayed is not clear.
I need to know the limitations while downloading to excel... I tried in SDN but of no use. I am using office 2007.
What is the max downloading limit(MB)
What must be the Length of line that can be downloaded.
RegardsHi ,
First check whether your ALV grid OUTPUT is Consistent or Not .
if there are any inconsistency then you need to rectify that .
for Checking COnsistency / Inconsistency .do following steps
1) execute ALV report
2) Press Shift+Mouse Right Button (Twice) in blank area of report
3) you will get result whether ALV is good or not .
regards
Deepak. -
Short Dump when downloading to EXCEL from ALV
Hi,
I have an ALV grid display program. The data in the grid is displayed correctly. But when trying to download the data to excel it gives a short dump.
Assignment error: Overwriting a protected field.
What happened?
Error in ABAP application program.
The current ABAP program "SAPLKKBL" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Some times it allows to download the data, but sometimes it gives short dump.
Thanks,
DeepthiThis is my part of the code:
i_fieldcat-key = gc_x.
i_fieldcat-no_zero = gc_x.
i_fieldcat-fix_column = 'X'.
i_fieldcat-hotspot = gc_x.
perform bild_fieldcat using
'' 'AUFNR' 'GT_REPORT ' ' ' 'CAUFV' ' ' 'C' '12' ' '.
perform bild_fieldcat using
'' 'DISGR' 'GT_REPORT ' ' ' 'MARC' ' ' 'C' '4' ' '.
perform bild_fieldcat using
'' 'AUART' 'GT_REPORT ' ' ' 'CAUFV' ' ' 'C' '04' ' '.
perform bild_fieldcat using
'' 'DISPO' 'GT_REPORT ' ' ' 'CAUFV' ' ' 'C' '06' ' '.
i_fieldcat-no_zero = gc_x.
perform bild_fieldcat using
'' 'MATNR' 'GT_REPORT ' ' ' 'MARA' ' ' 'C' '18' ' '.
i_fieldcat-no_zero = gc_x.
perform bild_fieldcat using
'' 'CHARG' 'GT_REPORT ' ' ' 'MDFA' ' ' 'C' '14' ' ' .
*begin insert RCHALASA
i_fieldcat-no_zero = gc_x.
i_fieldcat-fix_column = 'X'.
perform bild_fieldcat using
'' 'FTRMI' 'GT_REPORT ' ' ' 'CAUFV' ' ' 'D' '08' ' '.
*end insert
i_fieldcat-no_zero = gc_x.
i_fieldcat-fix_column = 'X'.
perform bild_fieldcat using
'' 'GLTRP' 'GT_REPORT ' ' ' 'CAUFV' ' ' 'D' '10' ' '.
i_fieldcat-no_zero = gc_x.
perform bild_fieldcat using
'' 'GLTRS' 'GT_REPORT' ' ' 'CAUFV' ' ' 'D' '10' ' '.
perform bild_fieldcat using
'' 'GSTRP' 'GT_REPORT' ' ' 'CAUFV' ' ' 'D' '10' ' '.
perform bild_fieldcat using
'' 'AGE' 'GT_REPORT' ' ' ' ' 'Age' 'C' '08' ' '.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
i_fieldcat-fix_column = 'X'.
perform assign_alv_qty_format.
perform bild_fieldcat using
'' 'GAMNG' 'GT_REPORT' ' ' ' ' 'Order Qty' 'QUAN' '09' ' '.
perform bild_fieldcat using
'' 'STK_PROD_FLAG' 'GT_REPORT' ' ' ' ' 'Stk/Prod' 'C' '06' ' '.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
i_fieldcat-fix_column = 'X'.
perform assign_alv_qty_format.
perform bild_fieldcat using
'' 'IGMNG' 'GT_REPORT' ' ' ' ' 'Order Yield Qty' 'QUAN' '11' ' '.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
i_fieldcat-fix_column = 'X'.
perform assign_alv_qty_format.
perform bild_fieldcat using
'' 'IASMG' 'GT_REPORT' ' ' ' ' 'Order Scrap Qty' 'QUAN' '11' ' '.
**begin insert RCHALASA
perform bild_fieldcat using
'' 'YIELD_PER' 'GT_REPORT' ' ' ' ' 'Yield' 'C' '05' ' '.
**end insert
DATA: col_pos like sy-colno.
col_pos = '17'.
loop at gt_oper.
gv_tabix = sy-tabix.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
i_fieldcat-fix_column = 'X'.
col_pos = col_pos + 1.
perform assign_alv_qty_format.
gv_yield6(03) = gt_oper-vornr1(03).
*begin insert RCHALASA
move gt_oper-ltxa1 to gv_text.
translate gv_text to upper case.
gv_text = gv_yield.
*end insert
gv_tabixn = gv_tabix.
gv_yield+6(03) = gv_tabixn.
gv_fieldname = gv_yield.
translate gv_fieldname to upper case.
perform bild_fieldcat using
'' gv_fieldname 'GT_REPORT' ' ' ' ' gv_text 'QUAN' '04' ' '.
perform assign_alv_qty_format.
gv_scrap6(03) = gt_oper-vornr1(03).
select single
grdtx
from trugt
into gv_text1
where
grund = gt_oper-vornr
and werks in s_werks.
gv_text = gv_scrap.
i_fieldcat-no_zero = gc_x.
gv_tabixn = gv_tabix.
gv_scrap+6(03) = gv_tabixn.
gv_fieldname = gv_scrap.
translate gv_fieldname to upper case.
perform bild_fieldcat using
gv_fieldname 'GT_REPORT' ' ' gv_text1 'X' 'QUAN' '08' ' '.
clear gv_text1.
endloop. " GT_OPER
DATA: count type c.
DESCRIBE table gt_grund lines count.
loop at gt_grund into gl_grund.
gv_tabix = sy-tabix.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
i_fieldcat-fix_column = 'X'.
perform assign_alv_qty_format.
if gl_grund-grund is initial.
gl_grund = 'NONE'.
gv_text = gl_grund.
else.
gv_text = gl_grund-grdtx.
endif.
gv_tabixn = gv_tabix.
gv_scrap_code+11(03) = gv_tabixn.
gv_fieldname = gv_scrap_code.
translate gv_fieldname to upper case.
col_pos = col_pos + 1.
perform bild_fieldcat using
'' gv_fieldname 'GT_REPORT' 'XMNGA' 'AFRU' gv_text 'QUAN' '12' ' ' .
endloop. " GT_OPER
gb_layout-zebra = 'X'.
gb_print-no_print_listinfos = 'X'.
gb_variant-variant = p_varia.
perform create_events using gt_events[].
call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Reading SAP Records.......'(600).
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gv_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'CALL_UP_SAP_TRANS'
it_fieldcat = i_fieldcat[]
is_layout = gb_layout
i_grid_title = gb_title
i_default = 'X'
i_save = 'X'
is_variant = gb_variant
is_print = gb_print
it_events = gt_events[]
tables
t_outtab = gt_report
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
***********ALV SUBROUTINE**************
TYPE-POOLS: slis.
DATA: gv_repid LIKE sy-repid.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: gb_layout TYPE slis_layout_alv.
DATA: gb_selfield TYPE slis_selfield.
DATA: gb_print TYPE slis_print_alv.
DATA: i_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA: gv_keyinfo TYPE SLIS_KEYINFO_ALV.
DATA: gb_variant LIKE disvariant,
gb_def_variant LIKE disvariant.
DATA: gb_title(70).
DATA: gt_events TYPE slis_t_event,
gt_sort TYPE SLIS_T_SORTINFO_ALV,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.
DATA: it_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
*--- Rotinas ---
FORM alv_init.
CLEAR: gb_variant.
gv_repid = sy-repid.
gb_variant-report = gv_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gb_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_varia = gb_variant-variant.
ENDIF.
ENDFORM. " ALV_INIT
FORM alv_f4.
gb_variant-report = gv_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gb_variant
i_save = 'A'
IMPORTING
es_variant = gb_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
p_varia = gb_variant-variant.
ENDIF.
ENDFORM. " ALV_F4
FORM bild_fieldcat USING x_pos x_field x_tab x_reffld x_ref x_text x_type x_tam x_sym.
i_fieldcat-col_pos = x_pos.
i_fieldcat-fieldname = x_field.
i_fieldcat-tabname = x_tab.
i_fieldcat-ref_fieldname = x_reffld.
i_fieldcat-ref_tabname = x_ref.
i_fieldcat-seltext_l = x_text.
i_fieldcat-seltext_m = x_text.
i_fieldcat-seltext_s = x_text.
i_fieldcat-ddictxt = 'M' .
i_fieldcat-inttype = x_type.
i_fieldcat-outputlen = x_tam.
i_fieldcat-symbol = x_sym.
APPEND i_fieldcat.
CLEAR i_fieldcat.
ENDFORM. " BILD_FIELDCAT
FORM create_events USING rt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. " -
How to remove values formatting in export to excel from ALV grid
Hi all,
I have small issue, I have ALV Grid with some data, but the problem is with columns containing e.g. gross amounts, because it is displayed in the grid as e.g. 1.764,81, and after export to excel it is still in this format (with dot and comma), so excel doesn't treat it as numeric value but as text, and then when I try to calculate total on the column then this values are not taken to the total. Do you know if that is possible to remove column formatting?
kind regards,
MarcinI replied too soon to Peter's suggestions. For some reason, I was able to add new info. to my first new row, but not the second. However, I finally figured out the problem.
I found the Help Center page on: "Here are ways to change custom formats and apply changes to table cells:"
To change the elements associated with a custom format that’s been applied to cells, select the cells and click Show Format in the Format pane of the Table inspector.
I saw that the "cell format" was listed as "automatic," so I changed it to "Custom;" then left the new custom window at it's default settings. Now my cells would accept pasted info. without spreading it through the lower rows. Whatever automatic was in the table, it was not what I wanted. Doing this to other new cells, solved my problem. Thanks again. -
Download to excel from ALV via portal
HI,
Could anyone out there help me resolve one issue which I am facing.
We have developed a ALV report and the same is working fine in GUI screen and also the various ALV features such as Download to Local File, Print Preview and others are working very well.
But if I deploy the same report on EP. The report is executing just fine but all the ALV features such as download to excel file and all other features are not working as desired.
I have done some reasearch on this issue and everytime people talk about having the updated Java version and to run this features on IE 7 or below. We have tried all these but still no luck.
Request you to provide your valuable inputs which can help me resolve this issue.
Thanks much!
Regards,
SumanthHi,
I guess this is due to the gui statements like call screen for popup to download which will not work in browser, instead of using FM for ALV or CL_GUI_ALV_GRID class, try using CL_SALV CLasses or create ALV in Web dynpro and integrate it in portal which will work well.
Hope this helps u.,
Thanks & Regards,
Kiran. -
PO No is not coming complete in length while downloading in excel from ALV
Hi to all
My problem is
I have declared
EBELN LIKE EBAN-EBELN.
length is 10.
Now in ALV report it is showing complete PO no but
when downloading itto excel , last digit is cut, only 9 digits are displayed.
Why it is so.
Please guide me...
Thanks & regards
AnubhavHi
Please try to declre the field EBELN as character of length 10 in the internal table for ALV.
EBELN type char(10)
<REMOVED BY MODERATOR>
Thanks
Edited by: Alvaro Tejada Galindo on Feb 22, 2008 6:00 PM -
Hi,
I ran the program 'BALVEX02' and i got the output i clicked on ALV standard application tool bar button 'Spreadsheet' (Ctrl_shift+F7) and unfortunately i selected HTML format radio button and selected check box that 'Always use the same format'. I need to change that format to excel. How can i get that pop-up box again. Looks like simple but could not see the alternative.
ThanksModerator message - Please do not add a meaningless comment when you mark a post as solved. It only brings old posts to the top of the forum list and pushes current ones down.
Rob -
Downloads from ALV GRID-Text conversion to dates in EXCEL
When downloading table displays of data from ALV-GRID for excel spreadsheet, we end of with files that have a header and various line ifnromation. IF we manually clear up the display, then we can have the individicual column headers used and force them to text but if we just call the file up as an EXCEL spreadsheet, some part numbers such 12-3465 appear in Excel as Dec-65.
The following is an example of the record (but it is word wrapped within this display limit). In actuality, the verbage enclosed with the <b> represent the start of the lines that have actual display data running out about 90 characters.
Suggestions on how to make the download immediately correct in Excel direct from SAP ALV-GRID without cleaning out the heading lines and manually forcing the affected columns to TEXT format?
thanks
<b>03/02/2007</b> Dynamic List Display 1
<b>Materials-Inforecord Details Report</b>
<b>Purchasing Org: ILMO</b>
<b>Report Run Date:03/02/2007</b> <b>Report Time:14:31:16</b>
<b>Plnt Mat Grp Vendor Name 1 Material Material</b> description Vendor Cat Mfr MPN PC Item Chg. OUn Eq to BUn Net price Per OPUn Inforecord PGr Mv Avg per ValCl
<b>0042 04 106070 BURROWS COMPANY</b> 184110 Glv Exam Ltx Non Ster 02-5001 TILLOTSON 02-5001 CA 2,000 EA 93.40 1 CA 5300006999 999 93.40 2,000 6438there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
try the different export to excel options perhaps there is one that behaves the way you want
kind regards
arthur de smidt -
Download from ALV grid to PDF format
hai Friends!
plz tell me how can i download from ALV grid to PDF format..
send me some sample codescheck this thread
ALV Grid to PDF
and do use the search functionality from next time and post the question only wheb u dont find the answer
кu03B1ятu03B9к -
Leading Zeros Missing - When exporting data from ALV grid display to Excel
Hi,
Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
(eg) in ALV o/p - 0029.
in Excel - Only 29 is appearing.
As per the requiement i have to show the leading zeros in excel also.
Pls help on this issue.
Thanks in advance..Hi ,
Please set the property :
wa_fieldcat-lzero = 'X' .
when you are creating field catalog for display alv data .
your prob will solved .
Regards ,
Nilesh Jain
Maybe you are looking for
-
Important Note: Skype Manager Message Board
Dear Readers, Welcome to the Skype Manager message board! "Skype Manager" is the name of one of Skype's business products. Skype Manager offers a simple way to manage Skype in your business. This message board is reserved for users of Skype Manage
-
What Function Module is used in a Virtual Cube
Hi, where can is see what Function Module is used for a Virtual Provider(Cube)?
-
Hi, I'm using LabVIEW 2010 and a cRIO-9118 to broadcast my RT Front Panel on the web with a Web Server. I successfully configured the web server to be able to control my Front Panel remotely. However, I have an issue with "Refreshing" the browser. Wh
-
How to redeem my 30 dollar itunes card without the code
i scratched of my code how can i redeem my 30 dollars
-
OAF Tutorial screenshots and instructions don't tie up with the version of JDEV
I'm trying to learn OAF from the supplied toolbox tutorial and I'm finding that the toolbox tutorial instructions supplied in the download do not match what I see in JDEV. Example of sucha tutorial instruction: "Select the TutorialLabs.jpr project in