on 05-28-2012 10:53 AM
Hi
Can any one please share the code for exporting table to excel sheet .
Thanks & Regards
Deepika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hii deepika there is a lot of links for downloading table data into excel sheet..
pls go through the links....
i tried with these links nd i got output ..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Deepika, Please use the following to check the integration of different options for WD http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b9157c878a2d67e10000000a42189c/frameset.htm
Rohit
Hi
I have used the below code for exporting table data to excel .
data str type string.
data xstr type xstring.
DATA LO_ND_ITAB TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LT_ITAB TYPE WD_THIS->ELEMENTS_ITAB.
DATA Lw_ITAB TYPE WD_THIS->ELEMENT_ITAB.
* navigate from <CONTEXT> to <ITAB> via lead selection
LO_ND_ITAB = WD_CONTEXT->PATH_GET_NODE( PATH = `ZHR_SUBORDINATES_FM.CHANGING.ITAB` ).
* @TODO handle non existant child
* IF lo_nd_itab IS INITIAL.
* ENDIF.
LO_ND_ITAB->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_ITAB ).
*
* DATA lo_nd_p0001 TYPE REF TO if_wd_context_node.
*
* DATA: lt_p0001 TYPE wd_this->elements_p0001,
* lw_p0001 like line of lt_p0001.
* navigate from <CONTEXT> to <P0001> via lead selection
* lo_nd_p0001 = wd_context->get_child_node( name = wd_this->wdctx_p0001 ).
* @TODO handle non existant child
* IF lo_nd_p0001 IS INITIAL.
* ENDIF.
* lo_nd_p0001->get_static_attributes_table( IMPORTING table = lt_p0001 ).
loop at LT_ITAB into Lw_ITAB.
concatenate str
Lw_ITAB-EMPNO
Lw_ITAB-EMPLOYEENAME
Lw_ITAB-MANAGERNAME
Lw_ITAB-LOCATION
Lw_ITAB-EMAILID
Lw_ITAB-USRID
cl_abap_char_utilities=>newline into str
separated by cl_abap_char_utilities=>horizontal_tab.
endloop.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
MIMETYPE = ' '
* ENCODING =
IMPORTING
BUFFER = xstr
EXCEPTIONS
FAILED = 1
.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'TIMESHEET.xls'
i_content = xstr
i_mime_type = 'EXCEL'
* i_in_new_window = ABAP_FALSE
* i_inplace = ABAP_FALSE
.
*
But in the excel I am able to see only item data ,no header data is avaiable .
More over when i am trying to download first i am getting one popup task bar as shown in the screen shot and when I click on download file it trigger automatically to the main page instead of downloading the excel and again for the second time when exe the application that time it is able to export the data to excel.
How to achieve exporting data to excel for the first time only and how to get header data in the excel sheet.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.