2009 Jul 31 7:12 AM
Hi,
I am uploading data from internal table to excel file in application server.I am using Open dataset to put in appln server.(background job).But the problem is it is not sitting in different colums,all data goes to single column.I want every field in separate columns.Please suggest to proceed.
Hi,
I am uploading data from internal table to excel file in application server.I am using Open dataset to put in appln server.(background job).But the problem is it is not sitting in different colums,all data goes to single column.I want every field in separate columns.Please suggest to proceed.
2009 Jul 31 7:23 AM
Hi,
save the internal table as a desktop file and then use CG3Z transaction to put the data from desktop to application server.
then to read the application file use the logic given below:
DATA: wa_file_data TYPE text4096,
lv_app_server_file TYPE string.
lv_app_server_file = pa_afile.
To read file from Application server
OPEN DATASET lv_app_server_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET lv_app_server_file INTO wa_file_data.
IF sy-subrc = 0.
APPEND wa_file_data TO gi_file_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET lv_app_server_file.
DATA: lv_file_separator TYPE c.
lv_file_separator = cl_abap_char_utilities=>horizontal_tab.
To upload file in other formats(CSV, Tab delimited etc)
CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
EXPORTING
i_field_seperator = lv_file_separator
i_tab_raw_data = gi_file_data
TABLES
i_tab_converted_data = gi_zhralcon_file
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.
Hope it helps.
Regards,
Rajesh Kumar
2009 Jul 31 7:24 AM
hi,
In application server, you can't view the file in a tabular form. download the file to your desktop and open it in excel. you can see it in tabular form. Please make sure that you have used a proper delimiter.
thanks,
Renjith.
2009 Jul 31 7:30 AM
Hi,
While uploading the data into application server using the open dataset command, move all the columns into one string using the CONCATENATE statement separated by TAB. i.e. | symbol.
Now when you are downloading, if you choose the option of type EXCEL, then immeaditely it will download in the EXCEL in separate columns.
Regards,
Santhosh.
2009 Jul 31 7:40 AM
2009 Jul 31 7:53 AM
Hi
You can use of the FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the data from your excel file. This FM uses some class check that how he is using to upload same way you use if the alignment is the problem. The Fm uses single coloumn wise data filling. Use same logic.
Regards
vijay
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |