Application Development 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: 

Error generating Function Module 'TEXT_CONVERT_XLS_TO_SAP'

Former Member
0 Kudos

Hi All,

When i am executing the FM 'TEXT_CONVERT_XLS_TO_SAP' i am getting the error Error generating the test frame.

Can you please tell me how to execute the FM.

Thanks & Regards,

Vivek Agarwal

1 ACCEPTED SOLUTION

Former Member
0 Kudos

'i_tab_raw_data' should be of type 'truxs_t_text_data'. Please add 'TYPE-POOLS: truxs.' statement in your code. Structure of 'i_tab_converted_data' should match with your input excel file.

Regards,

Aparna.

7 REPLIES 7

Former Member
0 Kudos

'i_tab_raw_data' should be of type 'truxs_t_text_data'. Please add 'TYPE-POOLS: truxs.' statement in your code. Structure of 'i_tab_converted_data' should match with your input excel file.

Regards,

Aparna.

Former Member
0 Kudos

Hi

Refer This LInk

Ranga

Former Member
0 Kudos

Hello...

Iam sending a sample code.

Hope it will helps U how to deal with FM : TEXT_CONVERT_XLS_TO_SAP.

TYPE-POOLS : TRUXS.

TYPES : BEGIN OF TY_TAB,

F1(10) TYPE C,

F2(10) TYPE C,

F3(10) TYPE C,

END OF TY_TAB.

DATA : WA_TAB TYPE TY_TAB,

LT_TAB LIKE STANDARD TABLE OF WA_TAB.

DATA : I_TAB_RAW_DATA TYPE TRUXS_T_TEXT_DATA.

DATA : FNAM TYPE IBIPPARMS-PATH.

PARAMETER : P_FNAM TYPE RLGRAP-FILENAME.

*****

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

FILE_NAME = FNAM

.

P_FNAM = FNAM.

*****

START-OF-SELECTION.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

I_TAB_RAW_DATA = I_TAB_RAW_DATA

I_FILENAME = FNAM

TABLES

I_TAB_CONVERTED_DATA = LT_TAB.

LOOP AT LT_TAB INTO WA_TAB.

WRITE 😕 WA_TAB-F1, WA_TAB-F2.

ENDLOOP.

**********

But my suggestion is why cant you use FM : ALSM_EXCEL_TO_INTERNAL_TABLE

instead of TEXT_CONVERT_XLS_TO_SAP.

The performance can be improved much by ALSM... FM.

Thanks and Regards

Sekhar.C

Former Member
0 Kudos

TYPE-POOLS: truxs.

DATA: it_raw TYPE truxs_t_text_data.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw

i_filename = p_file

TABLES

i_tab_converted_data = i_XCEL[]

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.

Former Member
0 Kudos

check this link

Regards,

Ajay

former_member209914
Participant
0 Kudos

HI Ajay,

Do not execute this function module directly through SE37. If you do so it will through error.

Call this functionmodule directly in the program. and make sure that number of fileds in excel sheet and internal tablefileds(i_xls internal table below) must be same.

DATA: l_c(4096) TYPE c OCCURS 0.

REFRESH i_xls.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

i_line_header = 'X'

i_tab_raw_data = l_c

i_filename = 'D:\test.xls'

TABLES

i_tab_converted_data = i_xls

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

Regards,

vinod

Former Member
0 Kudos

Thank you all