on 04-02-2013 1:59 PM
Dear Experts,
I used the below mentioned code to download data from table. I am able to succesfully download the data but the first column is coming as blank. It will be helpful if i get help to remove the blank column from the excel sheet.
DATA: str TYPE string,
str1 TYPE string,
xstr TYPE xstring.
LOOP AT lt_ekko INTO ls_ekko .
IF str = ' ' .
CONCATENATE 'Ebeln'
'BUKRS'
'BSTYP'
'BSART'
cl_abap_char_utilities=>newline INTO str SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
else.
CONCATENATE str
ls_ekko-EBELN
ls_ekko-BUKRS
ls_ekko-BSTYP
ls_ekko-BSART
cl_abap_char_utilities=>newline INTO str SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
endif.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
IMPORTING
buffer = xstr
EXCEPTIONS
failed = 1.
"Attach file
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'Download.xls'
i_content = xstr
i_mime_type = 'EXCEL'
i_in_new_window = abap_false
i_inplace = abap_false.
Thanks & Regards
Arun.K.P
check this thread,
http://scn.sap.com/docs/DOC-26034
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try populating the string variable like this to avoid first column blank.
CONCATENATE lv_text
ls_output-sno cl_abap_char_utilities=>horizontal_tab
ls_output-short cl_abap_char_utilities=>horizontal_tab
ls_output-stext cl_abap_char_utilities=>horizontal_tab
ls_output-begda cl_abap_char_utilities=>horizontal_tab
ls_output-endda cl_abap_char_utilities=>horizontal_tab
ls_output-rsign cl_abap_char_utilities=>horizontal_tab
ls_output-relat cl_abap_char_utilities=>horizontal_tab
ls_output-sclas cl_abap_char_utilities=>horizontal_tab
ls_output-sobid cl_abap_char_utilities=>horizontal_tab
ls_output-mess cl_abap_char_utilities=>horizontal_tab
ls_output-posi cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>newline
INTO lv_text.
Best Regards,
Arun Krishnamoorthy
Hi,
Did you removed the statement SHIFT str BY 1 PLACES LEFT. May be it could be the reason.
If the value is 30000004 irrespective of its data type is string or number it will be displayed as 30000004. The same if the value is 00004 and the data type is numeric then it will be displayed as 4 in the excel.
What is the value in the text string you are getting at runtime??
Best Regards,
Arun Krishnamoorthy
Hi Arun
only the code
LOOP AT lt_ekko INTO ls_ekko .
CONCATENATE str
ls_ekko-EBELN cl_abap_char_utilities=>horizontal_tab
ls_ekko-BUKRS cl_abap_char_utilities=>horizontal_tab
ls_ekko-BSTYP cl_abap_char_utilities=>horizontal_tab
ls_ekko-BSART cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>newline
INTO str.
ENDLOOP.
is there. i removed shift and other statements.
Thanks & Regards
Arun.K.P
Hi Arun,
Could you share the structure of lt_ekko.
Thanks,
Namrata
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.