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

FM for printing variable data in excel sheet.

Former Member
0 Likes
548

Hi Guru,

Here i stuck with one problem, i need to print dara in excel sheet which having 255 char length, my data length is more than that is there any FM to match this requirement.

Thanks,

Namdev.

Hi Guru,

Here i stuck with one problem, i need to print dara in excel sheet which having 255 char length, my data length is more than that is there any FM to match this requirement.

Thanks,

Namdev.

2 REPLIES 2
Read only

Former Member
0 Likes
485

Hi Namdev,

You can print excel using below FM:

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

EXPORTING

file_name = p_xlfile

TABLES

data_tab = it_final

fieldnames = it_fieldnames

EXCEPTIONS

file_not_exist = 1

filename_expected = 2

communication_error = 3

ole_object_method_error = 4

ole_object_property_error = 5

invalid_filename = 6

invalid_pivot_fields = 7

download_problem = 8

OTHERS = 9

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

Regards,

Venkat.

Read only

Former Member
0 Likes
485

Using FM TABLE_COMPRESS & TABLE_DECOMPRESS we can solve this problem.

Create internal table with 1000 lines which is shown below,

types: begin of ty_file,

line(2000) TYPE c,

end of ty_file.

DATA: it_file type STANDARD TABLE OF ty_file,

wa_file like line of it_file.

and define two tables for compress and decompress purpose like below shown.

DATA: itab_comp type standard table of soli,

wa_comp like line of itab_comp.

DATA: itab_unco type standard table of soli,

wa_unco like line of itab_unco.

After that use both function module ,

CALL FUNCTION 'TABLE_COMPRESS'

TABLES

in = it_file

out = itab_comp.

CALL FUNCTION 'TABLE_DECOMPRESS'

TABLES

in = itab_comp

out = itab_unco.

CLEAR T_ATTACHMENT.

REFRESH T_ATTACHMENT.

T_ATTACHMENT[] = itab_unco[].

pass this in internal table which is going to attachent.

Its work Fine..........