06-24-2009 3:55 PM
Hi Experts,
please give me solution about the Hoe to convert the data internal table to excel format.this level 1 issus
can any one help me regarding this issus. I am trying to "sap_convert_to_xls_format" this function module but in this FM not haveing export perameters and not releted import perameters and also exception also.
actually previous output is PDF format but my new requirment is need to output excel format.
It's great help full to me.........
thanks & regards
sankar.
06-24-2009 4:06 PM
06-24-2009 4:14 PM
06-24-2009 4:10 PM
06-24-2009 4:16 PM
ALSM_EXCEL_TO_INTERNAL_TABLE this FM is releted to convert the data Excel to internal table.
But need to convert the data internal table to Excel.
Thanks.
sankar.
06-24-2009 4:22 PM
06-25-2009 4:35 AM
Hi,
Can u plz send that releted code to me.In this FM (gui_download) haveing some problem that is in EXPORTING , there is no file format.what can i do? plz send me code.
Thankas
sankar.
06-25-2009 5:06 AM
Hi,
DATA : c_path(3) TYPE c VALUE 'C:\'.
*Input record structure from Excel.
DATA : BEGIN OF input_rec OCCURS 0,
Sno(3) type n,
Name(30) type c,
Address(30) type c,
END OF input_rec.
PARAMETERS : p_fname LIKE rlgrap-filename DEFAULT c_path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = 'D:\'
mask = ',.xls,.*.'
mode = 'O'
title = 'Hello'
IMPORTING
filename = p_fname
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0 AND sy-subrc <> 3.
MESSAGE e100(zm) WITH text-007.
ENDIF.
start-of-selection.
input_rec-sno = 12.
input_rec-name = 'GGGGG'.
input_rec-address = 'PPM'.
append input_rec.
clear input_rec.
input_rec-sno = 14.
input_rec-name = 'YYYYY'.
input_rec-address = 'GNT'.
append input_rec.
clear input_rec.
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
i_filename = p_fname "'D:\file1.xls'
I_APPL_KEEP = ' '
tables
i_tab_sap_data = input_rec
CHANGING
I_TAB_CONVERTED_DATA =
EXCEPTIONS
CONVERSION_FAILED = 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.
Regards,
Kumar Bandanadham
06-25-2009 5:31 AM
06-25-2009 5:42 AM
Hi,
Previous in my output is PDF format that code is:
FORM send_mail .
t_otf[] = wa_return-otfdata[].
***removing the initial and final markers from the OTF data*********
DELETE wa_return-otfdata WHERE tdprintcom = '//'.
searching for the end-of-page in OTF table************
READ TABLE i_otf INTO w_otf WITH KEY tdprintcom = 'EP'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = c_pdf
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = t_otf
lines = t_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF v_len_in < 0 OR sy-subrc <> 0. "#EC NEEDED
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT t_tline INTO wa_tline.
TRANSLATE wa_tline USING '~'.
CONCATENATE wa_buffer wa_tline INTO wa_buffer.
CLEAR wa_tline.
ENDLOOP.
TRANSLATE wa_buffer USING '~'.
DO.
wa_record = wa_buffer.
APPEND wa_record TO t_record.
CLEAR wa_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
But present i want to convert the excel format.
please give me suggestion.
thanks
sankar.
06-25-2009 5:48 AM
Hi Sankar,
Could you pls. let me know where is t_otf table is filled... and from which internal table data t_otf table is populated...
If possible paste that code as well.....
Regards,
Siddarth
06-25-2009 6:11 AM
hi shankar
u can replace the itab which i had used with yours
i think that should work
with cheers
s.janagar
06-25-2009 8:31 AM
Hi,
this is declaration part plz check it.
&----
*& Program Name : YLRNPOSTATUS_IN *
*& Author : Ajit Pardikar/Parag Telgaonkar *
*& Creation Date : 04.11.2008 *
*& Program Type : Smart Form *
*& Description : This is a driver program for SmartForm. *
*& The form will be sent to SCM professional via email with *
*& PDF attachment for notification Status for the Purchase *
*& Orders for input plant and username i.e. Approved/Rejected *
*& Status & its Date, etc. *
&----
*& Transport No : DE1K918407 *
*& Transaction : ZINMR002 *
&----
&----
_______________________________________________________________________
&----
*& Types Declaration *
&----
Declaration of type for PO Number (EKKO)
TYPES : BEGIN OF ty_ekko,
objectid TYPE cdobjectv, " Object value
ebeln TYPE ebeln, " Purchasing Document Number
lifnr TYPE elifn, " Vendor Account Number
name1 TYPE name1_gp, " Vendor (Supplier Name)
bedat TYPE ebdat, " PO Date
frgke TYPE frgke, " Release Indicator: Purchasing Document
desc TYPE name1, " Plant Description
END OF ty_ekko,
BEGIN OF ty_ekko1,
objectid TYPE cdobjectv, " Object value
ebeln(70) TYPE c, "SIBFBORIID, " Purchasing Document Number
lifnr TYPE elifn, " Vendor Account Number
name1 TYPE name1_gp, " Vendor (Supplier Name)
frgke TYPE frgke, " Release Indicator: Purchasing Document
bedat TYPE ebdat, " PO Date
desc TYPE name1, " Plant Description
END OF ty_ekko1,
Declaration of type for Item Details (EKPO)
BEGIN OF ty_ekpo,
ebeln TYPE ebeln, " Purchasing Document Number
werks TYPE werks_d, " Plant
ebelp TYPE ebelp, " Item Number of Purchasing Document
txz01 TYPE txz01, " Short Text
END OF ty_ekpo,
Declaration of type for Plant (T001W)
BEGIN OF ty_t001w,
werks TYPE werks_d, " Plant
name1 TYPE name1, " Plant Description
END OF ty_t001w,
Declaration for Workflow event log table
BEGIN OF ty_swfrevtlog,
event TYPE swo_event, "event
objkey TYPE sibfboriid, "Instance Ident. in BOR Compat. Persistent Object References
reckey TYPE sibfboriid, "Instance Ident. in BOR Compat. Persistent Object References
crea_stmp TYPE tzntstmps,
END OF ty_swfrevtlog,
BEGIN OF ty_swfrevtlog1,
event TYPE swo_event, "event
objkey TYPE sibfboriid, "Instance Ident. in BOR Compat. Persistent Object References
reckey TYPE swfrtwiid, "Instance Ident. in BOR Compat. Persistent Object References
crea_stmp TYPE tzntstmps,
END OF ty_swfrevtlog1,
Declaration for Work flow Runtime
BEGIN OF ty_swwwihead,
top_wi_id TYPE swfrtwiid, " Workflow: Unique ID of Top-Level Instance (6.1/get)
wi_id TYPE sww_wiid, " Work item ID
approver TYPE emnam, " Approver Name
usrid TYPE sysid, "
END OF ty_swwwihead,
Declaration of type for CDPOS
BEGIN OF ty_cdpos,
objectid TYPE cdobjectv, " Object value
changenr TYPE cdchangenr, " Document change number
END OF ty_cdpos,
Declaration of type for Function module
BEGIN OF ty_agents,
otype TYPE otype, "Object Type
objid TYPE actorid, "Agent ID in Organizational Management
END OF ty_agents,
Declaration of type for CDHDR
BEGIN OF ty_cdhdr,
objectid TYPE cdobjectv, " Object value
udate TYPE cddatum, " Creation date of the change document
END OF ty_cdhdr,
Declaration of type for ZXWFLOG
BEGIN OF ty_zxwflog,
objkey TYPE swo_typeid,
timestamp TYPE tmstmp,
appuser TYPE emnam,"XUBNAME,
action TYPE zaction,
END OF ty_zxwflog,
Declaration of type for Final
BEGIN OF ty_final,
werks TYPE werks_d, " Plant
desc TYPE name1, " Plant Description
ebeln TYPE ebeln, " Purchasing Document Number
apprej TYPE char25, " Approved & Blocked
udate TYPE cddatum, " Creation date of the change document
bedat TYPE ebdat, " PO Date
name1 TYPE name1_gp, " Vendor Name
txz01 TYPE txz01, " Short Text
reckey TYPE swfrtwiid,
approver TYPE emnam, " PO approver
END OF ty_final.
*_____________________________________________________________________*
&----
*& Declaration of internal tables
&----
DATA :
Internal Table declaration for PO
t_ekko TYPE STANDARD TABLE OF ty_ekko,
t_header TYPE STANDARD TABLE OF ty_ekko1,
t_header1 TYPE STANDARD TABLE OF ty_ekko1,
t_header2 TYPE STANDARD TABLE OF ty_ekko1,
Internal Table declaration for Item details
t_ekpo TYPE STANDARD TABLE OF ty_ekpo,
Internal Table Declaration for Plant
t_t001w TYPE STANDARD TABLE OF ty_t001w,
Internal Table Declaration for Workflow log
t_swfrevtlog TYPE STANDARD TABLE OF ty_swfrevtlog,
t_swfrevtlog1 TYPE STANDARD TABLE OF ty_swfrevtlog1,
Internal Table Declaration for Function module
t_agents TYPE STANDARD TABLE OF ty_agents,
Internal Table Declaration for workflow routine (work item)
t_swwwihead TYPE STANDARD TABLE OF ty_swwwihead,
t_temp_swwwihead TYPE STANDARD TABLE OF ty_swwwihead,
t_swwwihead1 TYPE STANDARD TABLE OF ty_swwwihead,
Internal Table declaration for table CDPOS data is stored
t_cdpos TYPE STANDARD TABLE OF ty_cdpos,
t_cdpos_temp TYPE STANDARD TABLE OF ty_cdpos,
Internal Table declaration for table cdhdr
t_cdhdr TYPE STANDARD TABLE OF ty_cdhdr,
Internal Table Declaration for table ZXWFLOG
t_zxwflog TYPE STANDARD TABLE OF ty_zxwflog,
t_zxwflog1 TYPE STANDARD TABLE OF ty_zxwflog,
Internal Table declaration for ty_final
t_final TYPE STANDARD TABLE OF ty_final,
*_____________________________________________________________________*
&----
*& Declaration of work-areas
&----
Work Area declaration for PO
wa_ekko TYPE ty_ekko,
wa_header TYPE ty_ekko1,
wa_header1 TYPE ty_ekko1,
wa_header2 TYPE ty_ekko1,
Work Area declaration for Item details
wa_ekpo TYPE ty_ekpo,
Work Area declaration for Plant
wa_t001w TYPE ty_t001w,
Work Area declaration for Workflow Log
wa_swfrevtlog TYPE ty_swfrevtlog,
wa_swfrevtlog1 TYPE ty_swfrevtlog1,
Work Area declaration for Workitem Id
wa_swwwihead TYPE ty_swwwihead,
wa_temp_swwwihead TYPE ty_swwwihead,
wa_swwwihead1 TYPE ty_swwwihead,
Work area declaration for Function module.
wa_agents TYPE ty_agents,
Work Area declaration for table CDPOS data is stored
wa_cdpos TYPE ty_cdpos,
wa_cdpos_temp TYPE ty_cdpos,
Work Area declaration for table cdhdr
wa_cdhdr TYPE ty_cdhdr,
Work area declaration for table zxwflog
wa_zxwflog TYPE ty_zxwflog,
wa_zxwflog1 TYPE ty_zxwflog,
Work Area declaration for ty_final
wa_final TYPE ty_final,
*_____________________________________________________________________*
&----
*& Declaration of Selection Screen Variables
&----
v_werks TYPE ewerk, " (ekpo-werks) Plant
v_bname TYPE usr21-bname, " (xubname) User Name in User Master Record,
*_____________________________________________________________________*
&----
*& Declaration of Global Variables
&----
v_email TYPE ad_smtpadr, " E-Mail Address (ADR6-SMTP_ADDR).
v_mailid TYPE char40, " Mail-ID
v_persnumber TYPE ad_persnum, " Person number
v_addrnumber TYPE ad_addrnum, " Address number
v_changenr TYPE cdchangenr, " Change Number
v_objectid TYPE cdobjectv, " Object value
v_subject TYPE char100, " Variable for Mail Body
c_fm_name TYPE rs38l_fnam. " Name of the Function Module
*_____________________________________________________________________*
&----
*& Declaration of constants
&----
CONSTANTS : c_form TYPE tdsfname VALUE 'YLFNPOSTATUS_IN',
c_bsart TYPE char4 VALUE '0005',
c_bsart1 TYPE char4 VALUE '0034',
c_ebelp TYPE char5 VALUE '00010',
c_einkbeleg TYPE char9 VALUE 'EINKBELEG',
c_ekko TYPE char4 VALUE 'EKKO',
c_frgke TYPE char5 VALUE 'FRGKE',
c_const TYPE c VALUE 'X',
c_lp01 TYPE char4 VALUE 'LP01',
c_pdf TYPE char3 VALUE 'PDF',
c_r TYPE c VALUE 'R',
c_b TYPE c VALUE 'B',
c_f TYPE c VALUE 'F',
c_raw TYPE char3 VALUE 'RAW',
c_u TYPE c VALUE 'U',
****Addition by prasad
c_bus2012 TYPE char7 VALUE 'BUS2012',
c_reset TYPE char5 VALUE 'RESET',
c_workitem TYPE char8 VALUE 'WORKITEM',
c_0000 TYPE char4 VALUE '0000',
c_started TYPE char7 VALUE 'STARTED',
c_ready TYPE char5 VALUE 'READY'.
*_____________________________________________________________________*
&----
*& Declaration PDF Conv. & Mail Parameters
&----
Internal table & Work Areas to hold the OTF data
DATA : t_otf TYPE TABLE OF itcoo INITIAL SIZE 0, " OTF Structure
Internal table to hold the data from the FM CONVERT_OTF
t_tline TYPE TABLE OF tline INITIAL SIZE 0, " Text Line
wa_tline TYPE tline,
t_record TYPE TABLE OF solisti1 INITIAL SIZE 0, " Single List with Column Length 255
wa_record TYPE solisti1,
Objects to send mail
t_objpack TYPE TABLE OF sopcklsti1 INITIAL SIZE 0, " Description of Imported Object Components
wa_objpack TYPE sopcklsti1,
t_objtxt TYPE TABLE OF solisti1 INITIAL SIZE 0,
wa_objtxt TYPE solisti1,
t_objbin TYPE TABLE OF solisti1 INITIAL SIZE 0,
t_reclist TYPE TABLE OF somlreci1 INITIAL SIZE 0,
wa_reclist TYPE somlreci1,
Work Area declarations
wa_objhead TYPE soli_tab, " Table Type line, length 255
wa_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
wa_compop TYPE ssfcompop, " Smart Forms: Smart Composer (transfer) options
wa_return TYPE ssfcrescl, " Smart Forms: Return value at end of form printing
wa_doc_chng TYPE sodocchgi1, " Data of an object which can be changed
wa_buffer TYPE string, " To convert from 132 to 255
Variables declarations
v_len_in TYPE sood-objlen, " Size of Document Content(Input)
v_lines_txt TYPE i,
v_lines_bin TYPE i.
*_____________________________________________________________________
06-25-2009 8:38 AM
Hi,
I meant which piece of code fill the internal table t_otf.....
06-25-2009 11:23 AM
Hi,
DATA : t_otf TYPE TABLE OF itcoo INITIAL SIZE 0, " OTF Structure
Internal table to hold the data from the FM CONVERT_OTF
t_tline TYPE TABLE OF tline INITIAL SIZE 0, " Text Line
wa_tline TYPE tline,
t_record TYPE TABLE OF solisti1 INITIAL SIZE 0, " Single List with Column Length 255
wa_record TYPE solisti1,
06-25-2009 12:00 PM
Hi,
check it out this way..........
i think u still didnt understand my point.......
before converting in pdf, you get the records in the t_otf table.... how and from where these records are filled in this table......
just check out with this code if this solves your purpose......
if not pls. let me knwo how do you get the records in the internal table t_otf....
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\filename.xls'
tables
data_tab = t_otf.
06-29-2009 10:43 AM
Hi,
t_otf[] = wa_return-otfdata[].
and wa_returm table attached in smartforms.present i want to comment the smartforms and call function convert_otf also, need to convert the data unternal table to excel format with out download i mean (gui_download)FM.
thanks,
sankar.
06-29-2009 11:48 AM
Hi,
t_otf[] = wa_return-otfdata[].
and wa_returm table attached in smartforms.present i want to comment the smartforms and call function convert_otf also, need to convert the data unternal table to excel format with out download i mean (gui_download)FM.
thanks,
sankar.
06-29-2009 11:56 AM
Hi,
its nothing like converting data to excel format without download....... instead you can use ALV Grid to display in the similar way of excel.... and if you want to comment the call of smartforms.... then in the program you will have a call function <smartform_function_module> may be it would start with //BC something followed with numbers.... just check it out.....
comment the function call and then at that place write the convert_otf function call.....
Regards,
Siddarth
07-30-2009 11:04 AM
Hi,
Can you pls sent me that related code.and declaration part & ligic also.
Thanks
07-30-2009 11:06 AM
Hi,
Can you pls sent me that related code.Internal table declaration and logic also.
Thanks
06-25-2009 5:20 AM
hi ,
try this function module
MS_EXCEL_OLE_STANDARD_DAT
hope this helps
Regards
Ritesh J
06-25-2009 5:39 AM
hi you can try using this wiki
https://wiki.sdn.sap.com/wiki/display/Snippets/OLEprogramforconvertingtomultitabexcel
This is the wiki done by me
for multitab excel
hope u can use this
with cheers
s.janagar
06-25-2009 5:43 AM
hi
try this
DATA: it_raw TYPE truxs_t_text_data.
&----
*&Function module called to upload xls data into an internal table
&----
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file "file path browsed
TABLES
i_tab_converted_data = it_upload[] "int table populated
EXCEPTIONS
conversion_failed = 1 "browsed file's data
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.
hope this helps
Regards
RItesh j
06-25-2009 6:10 AM
Hi,
You can do the same thing in many ways...
here i am giving two options.....
You can use 'MS_EXCEL_OLE_STANDARD_DAT' in the following way
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'* EXPORTING
file_name = 'C:\data'
TABLES
DATA_TAB = outrec1
FIELDNAMES = i_field
EXCEPTIONS
FILE_NOT_EXIST = 1
_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_PIVOT_FIELDS = 6
DOWNLOAD_PROBLEM = 7
OTHERS = 8
.
or you can use the GUI_DOWNLOAD
DATA: lv_file_name TYPE string.
lv_file_name = p_cpath.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_file_name
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
tables
data_tab = outrec1
FIELDNAMES = i_field
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i hope you will get some help...
Thanks & Regards
Ashu SIngh
06-25-2009 10:35 AM
hi,
TABLES:
sflight.
* header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'Suresh',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
* Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.
* Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .
* Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .
* Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.
* Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.
* Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.
* Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.
* Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'ABCD'.
APPEND t_online.
* Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.
t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.
* Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
* Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
06-25-2009 10:38 AM
* populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
* DATA_ENDING_AT = 54
* DATA_STARTING_AT = 5
filename = 'TESTFILE'
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
* SO_TITLE = ' '
TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey
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
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Taken from sdn wiki.
Plz go through sdn.
Thanks.
06-29-2012 4:13 PM
Check out the Code Exchange Project abap2xlsx (https://cw.sdn.sap.com/cw/groups/abap2xlsx). It provides a BindTable Method that will take an internal table and fill an worksheet with it's content.
07-02-2012 10:27 PM
Gregor,
When using ABAP2XLSX it only seems to work if I declare the internal table based on a standard SAP DDIC table.
e.g. DATA: itab TYPE STANDARD TABLE OF SFLIGHt works fine
DATA: BEGIN O FITAB OCCURS 0,
EBELN TYPE EKKO-EBELN,
EBELP TYPE EKPO-EBELP,
END OF ITAB.
does not work. the data saves in the speadsheet but when you open it you get error messages about unreadable content. i have put the sample code I am using in the "discussions" section of the ABAP2XLS project site on SDN.
I must be missing something really obvious. Everyone would want to use self defined internal tables surely?
Cheersy Cheers
Paul