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

OPEN DATASET to column

Former Member
0 Likes
987

I want to write an internal table to an EXCEL file on application server. The problem is that all columns in the internal table are merged and written to 1st column in excel sheet. I want it in seperate columns.

I am using following code.

OPEN DATASET y_lv_filename FOR OUTPUT IN LEGACY TEXT MODE.

IF sy-subrc EQ 0.

LOOP AT p_y_i_file INTO y_wa_ymdcoseph.

TRANSFER y_wa_ymdcoseph TO y_lv_filename.

ENDLOOP.

IF sy-subrc EQ 0.

  • Close File On Application server

PERFORM y_f_close_file_0700 IN PROGRAM yti_utility_routines

USING y_lv_filename

CHANGING y_v_subrc.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
730

Hi,

For this you need to create a tab delimited file and upload the same.

If you are using 4.6C or below, declare the tab variable as Hexadecimal else you can use class ABAP_CHAR_UTILITIES>>Horizontal Tab.

Just check the right name of the class in system.

Hope this would be helpful.

Regards,

Lalit Kabra

I want to write an internal table to an EXCEL file on application server. The problem is that all columns in the internal table are merged and written to 1st column in excel sheet. I want it in seperate columns.

I am using following code.

OPEN DATASET y_lv_filename FOR OUTPUT IN LEGACY TEXT MODE.

IF sy-subrc EQ 0.

LOOP AT p_y_i_file INTO y_wa_ymdcoseph.

TRANSFER y_wa_ymdcoseph TO y_lv_filename.

ENDLOOP.

IF sy-subrc EQ 0.

  • Close File On Application server

PERFORM y_f_close_file_0700 IN PROGRAM yti_utility_routines

USING y_lv_filename

CHANGING y_v_subrc.

ENDIF.

3 REPLIES 3
Read only

Former Member
0 Likes
730

see below sample program from application server to presentation server for view data...

data : fp_v_filepath type string.

fp_v_filepath = 'C:\BDC.prn'. * PRN (file extension

used notepad)

data : begin of it_data occurs 0,

age(4),

name(15),

end of it_data.

data : begin of wa_data,

age(4),

name(15),

end of wa_data.

*Open the file and transfer the data into the internal table

open dataset fp_v_filepath " give the file path

for

input in text mode encoding default.

if sy-subrc = 0.

do.

read dataset

fp_v_filepath "again file path

into wa_data .

if sy-subrc = 0.

append wa_data to it_data. "it_data the same structure as of your flat file + workarea same structure

clear wa_data.

else.

exit.

endif.

enddo.

endif.

loop at it_data into wa_data.

write : / wa_data-age , wa_data-name.

endloop.

<REMOVED BY MODERATOR>

s.suresh.

Edited by: Alvaro Tejada Galindo on Jan 23, 2008 12:13 PM

Read only

Former Member
0 Likes
731

Hi,

For this you need to create a tab delimited file and upload the same.

If you are using 4.6C or below, declare the tab variable as Hexadecimal else you can use class ABAP_CHAR_UTILITIES>>Horizontal Tab.

Just check the right name of the class in system.

Hope this would be helpful.

Regards,

Lalit Kabra

Read only

Former Member
0 Likes
730

thanks