Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Uploading Excel File in application server

Former Member
0 Likes
1,932

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.

5 REPLIES 5
Read only

Former Member
0 Likes
914

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

Read only

Former Member
0 Likes
914

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.

Read only

Former Member
0 Likes
914

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.

Read only

Former Member
0 Likes
914

This message was moderated.

Read only

vijy_mukunthan
Active Contributor
0 Likes
914

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