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: 

Excel FM 'TEXT_CONVERT_XLS_TO_SAP' Open Excel app on running.

tennisfanvenkat
Participant
0 Kudos

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

4 REPLIES 4

sivakumar_mobility
Active Participant
0 Kudos

Hi venkat ,

First Row always should be header or blank. From second row onwards only you have to give values.

with regards,

siva.


sivakumar_mobility
Active Participant
0 Kudos

   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

ipravir
Active Contributor
0 Kudos

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.

former_member683046
Discoverer
0 Kudos

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.