‎2009 Jan 05 3:46 PM
Hi All,
I want to download table data ( Whose name i am giving at run time ) to application server.
Problem is that, for downloading i will need to convert all fields to char type first and then only i can use following code to download.
OPEN DATASET P_DIR FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Write table contents to file
LOOP AT ITAB INTO W_ITAB.
TRANSFER W_ITAB TO P_DIR.
ENDLOOP.
How can i do this ?
Thanks.
‎2009 Jan 05 3:55 PM
‎2009 Jan 05 3:48 PM
You have to change into character type data or try different type of options like Legacy binary mode or legacy text mode
‎2009 Jan 05 3:49 PM
transfer the work area to a variable type string and then Transfer the String to dataset.
loop at it into wa.
string = wa .
Transfer wa to dataset.
endloop.
Thanks,
Adi
‎2009 Jan 05 3:50 PM
‎2009 Jan 05 3:55 PM
‎2009 Jan 05 4:10 PM
HI Deepika.. the below code can be use used for ur purpose..
DATA: gt_error TYPE STANDARD TABLE OF tt_error,
wa_error TYPE tt_error.
TYPES: BEGIN OF tt_file,
data(1000),
END OF tt_file.
DATA: gt_file TYPE STANDARD TABLE OF tt_file,
wa_file TYPE tt_file.*Conver to pipe delimited file
PERFORM fr_format_error_file TABLES gt_error gt_file.FORM fr_format_error_file TABLES p_final_table
p_output_file.
IF NOT gv_error LT 1.
DATA : lf_buf TYPE string,
lf_line TYPE string,
co_line_feed TYPE c VALUE cl_abap_char_utilities=>cr_lf.
FIELD-SYMBOLS : <fs_record> TYPE ANY,<fs_comp> TYPE ANY.
LOOP AT p_final_table ASSIGNING <fs_record>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
lf_buf = <fs_comp>.
IF sy-index = 1.
lf_line = lf_buf.
ELSE.
CONCATENATE lf_line lf_buf INTO lf_line SEPARATED BY c_sep.
ENDIF.
CLEAR lf_buf.
ENDDO.
CONCATENATE lf_line co_line_feed INTO lf_line.
APPEND lf_line TO p_output_file.
CLEAR lf_line.
ENDLOOP.
ENDIF.
ENDFORM. " FR_FORMAT_ERROR_FILE