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

Function module:EXCEL_OLE_STANDARD_DAT

Former Member
0 Likes
2,876

hi ,

I have a problem in downloading the records into the excel sheet using the function module: <b>EXCEL_OLE_STANDARD_DAT</b>

I have passed my internal table<it_tab1> (for a structure) into the function module.

My output goes to dump.

Can anyone help me out in this.

Regards,

Thasneem

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
982

check this

DATA : BEGIN OF FLDITAB OCCURS 0,

FLDNAME(21) TYPE C,

END OF FLDITAB.

data: begin of t_excel1 occurs 0,

cmpmatnr like wa_SUM-cmpmatnr,

CMPMAKTX like wa_SUM-CMPMAKTX,

ACTBI(15), " like wa_SUM-ACTBI,

ACTPR(15), " like wa_SUM-ACTPR,

ACTST(15), " like wa_SUM-ACTST,

ACTEI(15), " like wa_SUM-ACTEI,

WIP_BI(15), " like wa_SUM-WIP_BI,

WIP_EI(15), " like wa_SUM-WIP_EI,

WIP_BSU(15), " like wa_SUM-WIP_BSU,

USAGE(15), " like wa_SUM-USAGE,

theo_usg(15), " type p decimals 2,

waste(15), " type p decimals 2,

std_price(15), " like wa_sum-std_price,

end of t_excel1.

 CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
     EXPORTING
          FILE_NAME                 = 'c:Total_Plant Waste.xls'
    TABLES
*         PIVOT_FIELD_TAB           =
         DATA_TAB                  = T_EXCEL1
         FIELDNAMES                = FLDITAB
     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.
  clear: T_EXCEL1,FLDITAB.
  REFRESH: T_EXCEL1,FLDITAB.

regards

Prabhu

3 REPLIES 3
Read only

Former Member
0 Likes
983

check this

DATA : BEGIN OF FLDITAB OCCURS 0,

FLDNAME(21) TYPE C,

END OF FLDITAB.

data: begin of t_excel1 occurs 0,

cmpmatnr like wa_SUM-cmpmatnr,

CMPMAKTX like wa_SUM-CMPMAKTX,

ACTBI(15), " like wa_SUM-ACTBI,

ACTPR(15), " like wa_SUM-ACTPR,

ACTST(15), " like wa_SUM-ACTST,

ACTEI(15), " like wa_SUM-ACTEI,

WIP_BI(15), " like wa_SUM-WIP_BI,

WIP_EI(15), " like wa_SUM-WIP_EI,

WIP_BSU(15), " like wa_SUM-WIP_BSU,

USAGE(15), " like wa_SUM-USAGE,

theo_usg(15), " type p decimals 2,

waste(15), " type p decimals 2,

std_price(15), " like wa_sum-std_price,

end of t_excel1.

 CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
     EXPORTING
          FILE_NAME                 = 'c:Total_Plant Waste.xls'
    TABLES
*         PIVOT_FIELD_TAB           =
         DATA_TAB                  = T_EXCEL1
         FIELDNAMES                = FLDITAB
     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.
  clear: T_EXCEL1,FLDITAB.
  REFRESH: T_EXCEL1,FLDITAB.

regards

Prabhu

Read only

former_member508729
Active Participant
0 Likes
982

Hi,

Just try to use FM like this.

call function 'EXCEL_OLE_STANDARD_DAT'

exporting

file_name = 'C:\USR03.XLS'

data_sheet_name = 'USER LIST'

tables

data_tab = itabusr03

fieldnames = flditab

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.

otherwise just try to use FM gui_download.

Regards

Ashutosh

Reward points if helpful

Read only

Former Member
0 Likes
982

The type of filename must be: data: l_file type RLGRAP-FILENAME.

Luck

Marcos