08-26-2015 10:11 AM
Hi All,
I'm doing an Excel upload using FM 'TEXT_CONVERT_XLS_TO_SAP' in my program.
When I fill selection-screen parameters and then run the program, then Excel application opens up (no blank sheet/test data but just the application opens up).
Can you please help in this regard?
Thanks,
Venkat
08-26-2015 10:53 AM
Hi venkat ,
First Row always should be header or blank. From second row onwards only you have to give values.
with regards,
siva.
08-26-2015 10:55 AM
Hi venkat use below code,
DATA : LV_FILE TYPE RLGRAP-FILENAME.
PARAMETERS P_FILE TYPE IBIPPARMS-PATH OBLIGATORY.
PARAMETERS: C_MODE LIKE CTU_PARAMS-DISMODE DEFAULT 'A'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*BREAK-POINT .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
START-OF-SELECTION.
LV_FILE = P_FILE.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'x'
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_RAW
I_FILENAME = LV_FILE
TABLES
I_TAB_CONVERTED_DATA = It_vk11[]
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.
Message was edited by: sivakumar M
08-26-2015 11:15 AM
Hi Venkat,
Have you passing selected file path in FM. What is you selection screen parameter?
You have to call 'TEXT_CONVERT_XLS_TO_SAP' FM with file_name (i_filename) and i_tab_raw_data and i_tab_raw_data (if header requires).
here i_filename should contains the excel file with full path and i_tab_raw_data will be as empty internal table (TYPE STANDARD TABLE OF tv_blob.).
If you share you code, then it will be easy to understand the cause of error.
regards,
Praveer.
08-30-2022 8:28 PM
I just had the same problem and the cause was that the excel file had a different structure (less columns) from the destiny structure in the program. After making that adjustment, it worked well.