on 03-21-2013 2:28 PM
I searched on scn.sap but i cant fix my problem.
The following code i'm using to download the ALV data,
data TEXT type STRING.
data XTEXT type XSTRING.
LOOP AT lt_vbak into ls_vbak where vbtyp = abap_true.
ls_vbak1-MANDT = ls_vbak-MANDT.
ls_vbak1-VBELN = ls_vbak-VBELN.
ls_vbak1-ERDAT = ls_vbak-ERDAT.
ls_vbak1-ERZET = ls_vbak-ERZET.
ls_vbak1-ERNAM = ls_vbak-ERNAM.
ls_vbak1-ANGDT = ls_vbak-ANGDT.
ls_vbak1-BNDDT = ls_vbak-BNDDT.
ls_vbak1-AUDAT = ls_vbak-AUDAT.
append ls_vbak1 to lt_vbak1.
ENDLOOP.
loop at LT_vbak1 into LS_vbak1.
concatenate TEXT
ls_vbak1-MANDT
ls_vbak1-VBELN
ls_vbak1-ERDAT
ls_vbak1-ERZET
ls_vbak1-ERNAM
ls_vbak1-ANGDT
ls_vbak1-BNDDT
ls_vbak1-AUDAT
CL_ABAP_CHAR_UTILITIES=>NEWLINE into TEXT separated by
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
endloop.
call function 'SCMS_STRING_TO_XSTRING'
exporting
TEXT = TEXT
importing
BUFFER = XTEXT.
data: lv_file type string value 'WD_JOHN.XLS',
lv_type type string value 'EXCEL'.
call METHOD CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE
exporting
**path to the word file
I_FILENAME = lv_file
* String Variable
I_CONTENT = XTEXT
* File Type
I_MIME_TYPE = lv_type
I_IN_NEW_WINDOW = ABAP_TRUE .
Tell me where i made mistake.
Hi John,
I am not sure where you are using this code, in web-dynpro or ABAP report.
For ABAP report instead of all this you can use the class CL_GUI_FRONTEND_SERVICES. It has a method of GUI_DOWNLOAD which will download the file directly from internal table.
-Manish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.