Add download to excel icon
Hi All,
I am using the two below mentioned methods in my program:
CALL METHOD g_alv_tree->add_node
CALL METHOD g_alv_tree->set_table_for_first_display
for displaying some details in hierarchial format.
I need to add the download to Excel icon in the output layout.
Please provide the necessary solution.
Thanks in advance,
Neethu
Hi Neethu,
I'm also facing the same issue.I have xl download icon on the output display screen,but when I click xl sheet is opening, but not data are getting download.
Pls assist me.
Regards,
Siva
Similar Messages
-
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 -
ALV Report Error while downloading to Excel
Hi All,
when i downloading to Excel from a alv grid following message has been displayed.
Template not found in BDS - Layout: Template-
Guid:
please give me any solution to download the report to excel
Thanks & Regards
Ramu GHi,
Standard Function code for Download to Excel Icon used '&VEXCEL'(Microsoft Excel) instead of '&XXL'(Spreadsheet...) it solved my problem.
Thanks & Regards
Ramu Ganji -
Need help in attaching Excel files to emails......Excel spreadsheet created yesterday cannot be located to attach? The file can be located by entering the Excel icon but not visable when creating an email and attempting to attach.....seems to only inpact newly created files?
Support - Office.com - Microsoft
-
ALV download to EXCEL with column headings etc.
Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimboGetting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimbo -
Error log in BI Add-in from Excel
I have Oracle BI Add-In for Microsoft Excel, v 1.0.3027.22876, installed. I can see "Oracle BI" icon in Excel tool bar. I tested connection by clicking Oracle BI/Preference/Connection Detail/Test Connection, it said "Test connection successful". But when I tried to login from Excel, I got an error message "Unknown error occurred". What could be wrong?
I have Excel 2003.I don't have BI server installed on my computer. I searched websites and tried to find more info on bioffice.war. Not sure whether I am right, think I can see this file only if I have BI server installed on my pc.
By the way, I downloaded BI add-in program from BI Analytics web version. I had used BI add-in in Excel for a few months. But about a month ago, when I tried to log in, it just gave me the unknown error message. -
I have a wirless network. I connect all my computers to it and a printer. I can print wirelessly from all computers. I tried to add the printer to my new Macbook, which is connecte to the network, but can't find the printer on the add printer and scan icon on preferences. I downloaded a installation printer utility from the Manufacturer (lexmark), but it didn't work. Any sugestions?
Thanks,
IvetteYou would need to get the IP address of your printer then manually add a network print queue.
To get the IP address, on the control panel of your printer, press on Setup > Network Setup > TCP/IP > View/Set IP address. -
How can I add the hard drive icon to the menu bar on a MBPr
How can I add the hard drive icon to the menu bar on a MBPr? I have downloaded Google Earth and it wants me to drag it to the hard drive for install. I was able to display the icon but now I would like to put it on the menu bar. Is this possible? Or can I add it to the hardware section under system preferences?
I'm a new Apple user, coming out of the dark ages of a lifetime in the PC Windows world.
ThanksIt's on your Desktop, is it not? You cannot put it on the menubar through OS X although you may find third-party utilities that will. If you want it on the Desktop:
Select Preferences from the Finder's Finder menu and check the desired boxes:
Click on the Sidebar icon in the toolbar to set what you want displayed in the Sidebar. -
Reg: ALV output download using excel option
Hi Team,
I created a report using ALV Function modules, I want to download in Excel sheet the output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
is there any settings for these download.
<<removed by moderator>>
Thanks & Regards,
Mahendar patha.hi mahendra;
use this step-by-step procedure it will help u a lot:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma
Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM -
ALV output download to excel with top of page
Hi,
i want to download ALV grid output to excel sheet including the top of page. i am using the icon in application tool bar. but only data's are download to excel sheet. i cannot download the top of page. with out write coding in program can we download it. if yes pls explain.
thanks.I'm sorry but I can't find FM with DOWNLOAD_EXCEL_*.
I want to know more detail thing.
plz. give answer to me anytime.
I'm waiting..
Edited by: Kwang Seop Kim on Sep 26, 2008 6:57 AM -
ALV toolbar excel icon using REUSE_ALV_GRID_DISPLAY
Hi!
Ive created an ALV with using REUSE_ALV_GRID_DISPLAY. In ALV out put on toolbar Ive excel, sort default icons.
If I sort my ALV on some column and press excel icon one row has got deleted and some column I dont get data in rows (where my rows are more than 20).
If anyone know any SAP not or patch or has faced this problem before please let me know on priority basis.
Please find below SAP support pack info. We are running on ECC6.0.
Software component Release Level Highest Suppost Package Short description of softwar componenet
SAP_BASIS 700 13 SAPKB70013 SAP Basis Component
SAP_ABA 700 13 SAPKA70013 Cross-Application Component
PI_BASIS 2006_1_700 2 SAPKIPYM02 Basis Plug-In (PI_BASIS) 2006_1_700
ST-PI 2005_1_700 5 SAPKITLQI5 SAP Solution Tools Plug-In
SAP_BW 700 15 SAPKW70015 SAP NetWeaver BI 7.0
SAP_AP 700 11 SAPKNA7011 SAP Application Platform
SAP_APPL 600 11 SAPKH60011 Logistics and Accounting
SAP_HR 600 22 SAPKE60022 Human Resources
EA-IPPE 400 11 SAPKGPID11 SAP iPPE
EA-APPL 600 11 SAPKGPAD11 SAP Enterprise Extension PLM, SCM, Financials
EA-DFPS 600 11 SAPKGPDD11 SAP Enterprise Extension Defense Forces & Public Security
EA-FINSERV 600 11 SAPKGPFD11 SAP Enterprise Extension Financial Services
EA-GLTRADE 600 11 SAPKGPGD11 SAP Enterprise Extension Global Trade
EA-HR 600 22 SAPKGPHD22 SAP Enterprise Extension HR
EA-PS 600 11 SAPKGPPD11 SAP Enterprise Extension Public Services
EA-RETAIL 600 11 SAPKGPRD11 SAP Enterprise Extension Retail
FINBASIS 600 11 SAPK-60011INFINBASIS Fin. Basis
MDM_TECH 555_700 4 SAPK-57004INMDMTECH MDM_TECH 555 : Add-On Installation
ECC-DIMP 600 11 SAPK-60011INECCDIMP DIMP
ERECRUIT 600 11 SAPK-60011INERECRUIT E-Recruiting
FI-CA 600 11 SAPK-60011INFICA FI-CA
FI-CAX 600 11 SAPK-60011INFICAX FI-CA Extended
INSURANCE 600 11 SAPK-60011ININSURANC SAP Insurance
IS-CWM 600 11 SAPK-60011INISCWM Industry Solution Catch Weight Management
LSOFE 600 11 SAPK-60011INLSOFE SAP Learning Solution Front-End
IS-UT 600 11 SAPK-60011INISUT SAP Utilities/Telecommunication
IS-PS-CA 600 11 SAPK-60011INISPSCA IS-PUBLIC SECTOR CONTRACT ACCOUNTING
IS-OIL 600 11 SAPK-60011INISOIL IS-OIL
SEM-BW 600 11 SAPKGS6011 SEM-BW: Strategic Enterprise Management
IS-M 600 11 SAPK-60011INISM SAP MEDIA
IS-H 600 11 SAPK-60011INISH SAP Healthcare
ST-A/PI 01J_ECC600 0 - Application Servicetools for ECC 600
Warm Regards
NKMuse grid display instead of list display
in grid you have an icon which display the data in excel-sheet
Regards
Phani -
Leading 0 while downloading to excel
Hi All,
I am displaying my output in ALV using REUSE_ALV_GRID_DISPLAY,but when i download the report to excel using standard download button in the tool bar(local file icon), the leading zeros are getting truncated
eg 0004 is displayed as 4
field is VBKD-ZTERM....
Whats the way out?
<REMOVED BY MODERATOR>
Regards
Gunjan
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:52 PM1.Introduce another field in internal table of type Numeric.
2.Before you pass the internal table to Reuse_alv_grid Display
3.Move the character field to Numeric type and use this
numeric field to display in Reuse_alv_grid_display.
Then the leading zeros will also be displayed while downloading to Excel.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:53 PM -
Problem in downloading to excel sheet
hi,
i have a file in the application server which needs to be downloaded into excel sheet and send it via attachment to outlook id's..
file is getting downloaded into excel sheet ( Via custom function module) and the attachment is being sent to the mail box, but the problem is everything appears in the first column..how to set the delimiters in excel sheet, i mean each field should appear in a separate coloumn...
format of the file in the application server
data: begin of dt_string occurs 0,
data(150) type c,
end of dt_string.
ex: dt_string+0(4) = 'name'.
dt_string+4(5) = 'place'. .....
append dt_string
clear dt_string.
same way, each record is inserted into the dt_string and the table was transferred to the app server.
thanksHi Mahesh,
Assuming that you are using 'GUI_DOWNLOAD'.
Add the thing in bold <b>WRITE_FIELD_SEPARATOR</b>.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename =
* FILETYPE = 'ASC'
* APPEND = ' '
<b> WRITE_FIELD_SEPARATOR = '#' "Tab Delimiter between fields</b>
Regards,
AS -
How can I disenable the EXCEL field format when use ALV download to excel ?
Dear friends,
I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first position in field value.when I download the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
I add a space in u2018 -abcdeu2026u2019,So this value can be download to Excel .
Have you any solve method?
User does not use excel logo button to download.
User use Local fileu2026 button to download
Thanks
Sunadd a single quote to the beginning of the field.
like: '-abcde
in excel it will be shown as : -abcde -
Download to Excel using METHODS
I want to change the Worksheet name which in default being created as Sheet1/ Sheet2/ Sheet3 on creation of Excel file while downloading using Objects.
How should I change the name of Sheet1/ Sheet2/ Sheet3 to my requirement. Attached the coding part. Please help me out in finding the place where I should rename it using which statement.
FORM excel_download.
gv_step = 'Starting Excel'.
CREATE OBJECT gw_excel 'EXCEL.APPLICATION'.
PERFORM xls_error_hdl.
SET PROPERTY OF gw_excel 'VISIBLE' = 0.
GET PROPERTY OF gw_excel 'WORKBOOKS' = gw_wbooks.
CALL METHOD OF gw_wbooks 'Add'.
*Create Excel Sheet
CALL METHOD OF gw_excel 'Worksheets' = gw_worksheet
EXPORTING
#1 = 1.
CALL METHOD OF gw_wbooks 'Activate'.
SET PROPERTY OF gw_wbooks 'Name' = 'Sheet1'.
CALL METHOD OF gw_wbooks 'OPEN' = gw_wbooks
EXPORTING
#1 = gv_fname.
CALL METHOD OF gw_wbooks 'Activate' .
*Download to Worksheet 1.
GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
exporting #1 = 'Sheet1'. "S4M1MR
exporting #1 = 'Appd_Sites'. "S4M1MR
PERFORM xls_error_hdl.
CALL METHOD OF gw_worksheet 'Activate' .
gv_step = 'Adding data to Excel'.
gv_row = 0.
LOOP AT gi_yps_down_tab1 INTO gw_yps_grid2.
CLEAR gw_yps_common-anln1.
gv_row = gv_row + 1.
gv_col = 2.
DO 4 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE gw_yps_grid2 TO <comp>.
PERFORM fill_cell USING gv_row gv_col <comp>.
gv_col = gv_col + 1.
ENDDO.
ENDLOOP.
*Download to Worksheet 2.
GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
exporting #1 = 'Sheet2'.
exporting #1 = 'Appd Sites'. "S4M1MR
PERFORM xls_error_hdl.
CALL METHOD OF gw_worksheet 'Activate' .
gv_step = 'Adding data to Excel'.
gv_row = 0.
LOOP AT gi_yps_down_tab2 INTO gw_yps_common.
LOOP AT gi_yps_down_tab2 INTO gw_exclusion.
PERFORM conversion.
ENDLOOP.
*Download to Worksheet 3.
GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
exporting #1 = 'Sheet3'.
PERFORM xls_error_hdl.
CALL METHOD OF gw_worksheet 'Activate' .
gv_step = 'Adding data to Excel'.
gv_row = 0.
LOOP AT gi_yps_down_tab3 INTO gw_yps_common.
LOOP AT gi_yps_down_tab3 INTO gw_exclusion.
PERFORM conversion.
ENDLOOP.
*Download to Worksheet 4.
CALL METHOD OF gw_excel 'Sheets' = gw_worksheet.
Add new workbook (create a file)
CALL METHOD OF gw_worksheet 'Add'.
FREE OBJECT gw_worksheet.
GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
exporting #1 = 'Sheet4'.
PERFORM xls_error_hdl.
CALL METHOD OF gw_worksheet 'Activate' .
gv_step = 'Adding data to Excel'.
gv_row = 0.
LOOP AT gi_yps_down_tab4 INTO gw_yps_common.
LOOP AT gi_yps_down_tab4 INTO gw_exclusion.
PERFORM conversion.
ENDLOOP.
To Save the Book after downloading.
PERFORM save_excel.
ENDFORM. " EXCEL_DOWNLOAD
Thanks in advancehi,
chk a sample pgm.
*& Include YHCON9051INCL *
* SUBROUTINES *
*& Form F_CHECK_LOCAL_FILE_EXIST
* CHECK WETHER LOCAL FILE EXIST
* -->P_FILE LOCAL FILE NAME
FORM f_check_local_file_exist USING p_file.
DATA: loc_filename TYPE string,
loc_flag TYPE abap_bool.
loc_filename = p_file.
IF loc_filename Eq ' '.
MESSAGE e053(8i) .
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = loc_filename
RECEIVING
result = loc_flag
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc NE wl_yes.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF loc_flag NE wl_true.
MESSAGE e000(8i) WITH text-020 p_file.
ENDIF.
ENDFORM. " F_CHECK_LOCAL_FILE_EXIST
*& Form F_UPLOAD_DATA_FROM_LOCAL_FILE
* GET DATA FROM EXCEL FILE AND CONVERT TO SAP FORMAT
* -->P_FILE LOCAL FILE NAME
FORM f_upload_data_from_local_file USING p_file.
DATA: loc_filename TYPE rlgrap-filename,
int_raw TYPE truxs_t_text_data.
loc_filename = p_file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = int_raw
i_filename = loc_filename
TABLES
i_tab_converted_data = int_content_lfile
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc NE wl_yes.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR : int_record , int_content_lfile ,int_record[].
LOOP AT int_content_lfile.
* Moving the records to the Internal table for process
int_record-adm_area = int_content_lfile-adm_area .
int_record-dsrd_loc = int_content_lfile-dsrd_loc.
int_record-fl_ind = int_content_lfile-fl_ind.
int_record-loc_loc = int_content_lfile-loc_loc.
int_record-loc_desc = int_content_lfile-loc_desc .
APPEND int_record.
CLEAR int_record.
ENDLOOP.
ENDFORM. " F_UPLOAD_DATA_FROM_LOCAL_FILE
*& Form GET_FILE_OPEN_DIALOG
* F4 TO FETCH THE FILE
FORM get_file_open_dialog .
DATA: lint_filetable TYPE filetable,
ls_filetable TYPE file_table,
li_count TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Please select the file'
default_extension = '*.XLS'
* DEFAULT_FILENAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
multiselection = ''
* WITH_ENCODING =
CHANGING
file_table = lint_filetable
rc = li_count
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
ELSE.
READ TABLE lint_filetable INDEX 1 INTO ls_filetable.
IF sy-subrc EQ wl_yes.
p_lcl = ls_filetable-filename.
ENDIF.
ENDIF.
ENDFORM. " GET_FILE_OPEN_DIALOG
*& Form F_UPLOAD_DATA
* text
* --> p1 text
* <-- p2 text
FORM f_upload_data .
* To move the data to Internal table fields.
PERFORM data_transfer.
ENDFORM. " F_UPLOAD_DATA
*& Form F_UPDATE_TABLE
* ZTABLE UPDATION
FORM f_update_table .
DATA: wl_sess TYPE c,
loc_wf_loc_desc TYPE zhofs_loc_desc.
REFRESH : int_caltrscc, int_caltrerr .
LOOP AT int_record.
** Moving the data as desired for the Z -table updation
* PERFORM MOVE_DATA.
MOVE :
int_record-adm_area TO loc_wf_loc_desc-adm_area ,
int_record-dsrd_loc TO loc_wf_loc_desc-dsrd_loc ,
int_record-fl_ind TO loc_wf_loc_desc-fl_ind ,
int_record-loc_loc TO loc_wf_loc_desc-loc_loc ,
int_record-loc_desc TO loc_wf_loc_desc-loc_desc .
* Inserting the data to the Table ZHOFS_LOT_TABLE
INSERT zhofs_loc_desc FROM loc_wf_loc_desc .
IF sy-subrc EQ wl_yes.
* Entry Inserted Correctly
wf_suc = wf_suc + 1.
int_caltrscc-adm_area = int_record-adm_area .
int_caltrscc-dsrd_loc = int_record-dsrd_loc.
int_caltrscc-fl_ind = int_record-fl_ind.
int_caltrscc-loc_loc = int_record-loc_loc.
int_caltrscc-reason = text-007.
APPEND int_caltrscc.
CLEAR int_caltrscc.
ELSE.
* Entry Not Inserted
wf_err = wf_err + 1.
int_caltrerr-adm_area = int_record-adm_area .
int_caltrerr-dsrd_loc = int_record-dsrd_loc.
int_caltrerr-fl_ind = int_record-fl_ind.
int_caltrerr-loc_loc = int_record-loc_loc.
int_caltrerr-reason = text-006.
APPEND int_caltrerr.
CLEAR int_caltrerr.
ENDIF.
CLEAR : loc_wf_loc_desc-loc_desc,int_record .
ENDLOOP.
ENDFORM. " F_UPDATE_TABLE
*& Form DATA_TRANSFER
* text
* --> p1 text
* <-- p2 text
FORM data_transfer .
DATA : loc_int_loc_desc TYPE TABLE OF zhofs_loc_desc WITH HEADER LINE.
CLEAR: int_record.
LOOP AT int_record.
wf_rec = wf_rec + 1.
* To Check Whether an already any records exists
SELECT *
FROM zhofs_loc_desc
INTO TABLE loc_int_loc_desc
WHERE
adm_area = int_record-adm_area AND
dsrd_loc = int_record-dsrd_loc AND
loc_loc = int_record-loc_loc.
IF sy-subrc EQ wl_yes.
* The entry already exist in the Table
int_error-adm_area = int_record-adm_area.
int_error-dsrd_loc = int_record-dsrd_loc.
int_error-fl_ind = int_record-fl_ind .
int_error-loc_loc = int_record-loc_loc.
int_error-message = text-005.
APPEND int_error.
CLEAR : int_error.
wf_err_rec = wf_err_rec + 1.
CONTINUE.
ELSE.
wf_cor_rec = wf_cor_rec + 1 .
ENDIF.
CLEAR: int_record.
ENDLOOP.
CLEAR: int_record .
LOOP AT int_error.
READ TABLE int_record
WITH KEY
adm_area = int_error-adm_area
dsrd_loc = int_error-dsrd_loc
loc_loc = int_error-loc_loc .
IF sy-subrc EQ wl_yes.
* Delete the duplicate entries
DELETE int_record
WHERE
adm_area = int_error-adm_area AND
dsrd_loc = int_error-dsrd_loc AND
fl_ind = int_error-fl_ind AND
loc_loc = int_error-loc_loc .
ENDIF.
CLEAR int_error.
ENDLOOP.
ENDFORM. " DATA_TRANSFER
*& Form f_check_data
* Check DATA
FORM f_check_data .
*ERROR FULL DATA
IF wf_err_rec GT 0.
WRITE:/060(1) sy-vline, text-000 COLOR 6,sy-vline.
LOOP AT int_error.
FORMAT RESET.
FORMAT COLOR 6 .
WRITE:/001(1) sy-vline,
002(3) int_error-adm_area ,
005(1) sy-vline CENTERED ,
006(4) int_error-dsrd_loc ,
010(1) sy-vline CENTERED ,
011(1) int_error-fl_ind ,
012(1) sy-vline CENTERED,
013(4) int_error-loc_loc ,
017(1) sy-vline CENTERED ,
018(25) int_error-message ,
043(1) sy-vline CENTERED .
FORMAT COLOR OFF .
ENDLOOP.
WRITE:/001(25) text-002,wf_err_rec.
WRITE:/001(25) text-003,wf_rec .
ENDIF.
*SUCCESSFULL DATA
IF wf_cor_rec GT 0.
WRITE:/060(1) sy-vline, text-001 COLOR 1 ,sy-vline.
LOOP AT int_record.
FORMAT RESET.
FORMAT COLOR 1 ON .
WRITE:/001(1) sy-vline,
002(3) int_record-adm_area ,
005(1) sy-vline CENTERED ,
006(4) int_record-dsrd_loc ,
010(1) sy-vline CENTERED ,
011(1) int_record-fl_ind ,
012(1) sy-vline CENTERED,
013(4) int_record-loc_loc ,
017(1) sy-vline CENTERED ,
018(25) 'PROPER ENTRY' ,
043(1) sy-vline CENTERED .
FORMAT COLOR OFF .
ENDLOOP.
WRITE:/001(25) text-002,wf_cor_rec .
WRITE:/001(25) text-003,wf_rec .
ENDIF.
ENDFORM. " f_check_data
*& Form f_check_db_data
* text
* --> p1 text
* <-- p2 text
FORM f_check_db_data .
*ERROR FULL DATA - WHILE INSERTING TO TABLE
IF wf_err GT 0.
WRITE:/060(1) sy-vline,text-004 COLOR 6,sy-vline.
LOOP AT int_caltrerr.
FORMAT RESET.
FORMAT COLOR 6 .
WRITE:/001(1) sy-vline,
002(3) int_caltrerr-adm_area ,
005(1) sy-vline CENTERED ,
006(4) int_caltrerr-dsrd_loc ,
010(1) sy-vline CENTERED ,
011(1) int_caltrerr-fl_ind ,
012(1) sy-vline CENTERED,
013(4) int_caltrerr-loc_loc ,
017(1) sy-vline CENTERED ,
018(25) int_caltrerr-reason ,
043(1) sy-vline CENTERED .
FORMAT COLOR OFF .
ENDLOOP.
WRITE:/001(25) text-002,wf_err.
WRITE:/001(25) text-003,wf_rec .
ENDIF.
* ERROR BY DUPLICATION
IF wf_err_rec GT 0.
WRITE:/060(1) sy-vline,text-000 COLOR 6,sy-vline.
LOOP AT int_error.
FORMAT RESET.
FORMAT COLOR 6 .
WRITE:/001(1) sy-vline,
002(3) int_error-adm_area ,
005(1) sy-vline CENTERED ,
006(4) int_error-dsrd_loc ,
010(1) sy-vline CENTERED ,
011(1) int_error-fl_ind ,
012(1) sy-vline CENTERED,
013(4) int_error-loc_loc ,
017(1) sy-vline CENTERED ,
018(25) int_error-message ,
043(1) sy-vline CENTERED .
FORMAT COLOR OFF .
ENDLOOP.
WRITE:/001(25) text-002,wf_err_rec.
WRITE:/001(25) text-003,wf_rec .
ENDIF.
*SUCCESSFULL DATA
IF wf_suc GT 0.
WRITE:/060(1) sy-vline,text-001 COLOR 1 ,sy-vline.
LOOP AT int_caltrscc.
FORMAT RESET.
FORMAT COLOR 1 ON .
WRITE:/001(1) sy-vline,
002(3) int_caltrscc-adm_area ,
005(1) sy-vline CENTERED ,
006(4) int_caltrscc-dsrd_loc ,
010(1) sy-vline CENTERED ,
011(1) int_caltrscc-fl_ind ,
012(1) sy-vline CENTERED,
013(4) int_caltrscc-loc_loc ,
017(1) sy-vline CENTERED ,
018(25) int_caltrscc-reason ,
043(1) sy-vline CENTERED .
FORMAT COLOR OFF .
ENDLOOP.
WRITE:/001(25) text-002,wf_cor_rec .
WRITE:/001(25) text-003,wf_rec .
ENDIF.
ENDFORM. " f_check_db_data
rgds
Anver
if hlped pls mark points
Maybe you are looking for
-
March 2015 TechNet Guru Awards! See who's boss in PowerShell! It could be YOU!
The results for March's TechNet Guru competition were posted! http://blogs.technet.com/b/wikininjas/archive/2015/04/17/the-microsoft-technet-guru-awards-march-2015.aspx Below is a summary of the medal winners for December. The last column being a few
-
Freeze problem in user interface initiatilisation after all NVDIA update and 8.0.1
I just received Pre 8 and installed it When starting the various modules - Organiser works more or less fine (it crash when it looks at my folders with 28000 pictures), but it works when doing import folder by folder - but when I am starting a new pr
-
Essbase ANCESTOR_NAMES property is empty
Hi all, I am using obiee 11.1.1.5 on top of essbase. I get the following error when I try to drill down from the organisation dimension. *[nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: Essbase ANCESTOR_NAMES property is
-
New domains support in Adobe Muse CC2014.1
HEy there, Are there any problems in Adobe Muse with the new domains. Can't put my "[email protected]" in the contact formulars for my site. Is this bug already known? thanks!
-
Bit operations are very strange help me
class BitDemo { public static void main(String[] args) { int bitmask = 0x0000000F; int val = -3; System.out.println(val & bitmask); // prints "13" why not 3 int zmienna = -3; // 1000 ... 0011 ( 2^3