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

Data upload to internal table failed.

Former Member
0 Likes
2,089

Dear Experts,

When i try to read the data uploaded in a excel sheet into an internal table using the below function module,

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
  EXPORTING
    i_tab_raw_data   = i_raw   " WORK TABLE
    i_filename       = p_file
  TABLES
    i_tab_converted_data = i_fetchtab"ACTUAL DATA
  EXCEPTIONS
    conversion_failed= 1
    OTHERS           = 2.

i am getting an error

Data upload to internal table failed.

Can somebody help in getting solution

Thanks

Santhosh

15 REPLIES 15
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,970

Hello Santhosh.

     Have you declared i_raw type TRUXS_T_TEXT_DATA?

Regards.

Read only

0 Likes
1,970

hi arun,

the below is my declaration for i_raw.

  

i_raw  TYPE truxs_t_text_data,

" FM XLS_TO_SAP - variable

the same case working in gui 710, whereas not working in gui 730.

Read only

Former Member
0 Likes
1,970

Hi Santosh,

What is the data type of your delcared work area 'I_RAW'.

One more thing make sure you are calling this FM  'TEXT_CONVERT_XLS_TO_SAP' after FM 'F4_FILENAME'.

if possible, can you attach your code for better understanding!.

Thanks & Regards

Syed

Read only

0 Likes
1,970

hi syed,

My code is as mentioned below

TYPE-POOLS : truxs,

             slis.

*TYPES USED-----------------------------------------------------------*

TYPES : BEGIN OF ty_fetchtab,

        col1 TYPE char1,

        col2 TYPE char18,

        col3 TYPE char30,

        col4 TYPE char10,

        col5 TYPE char10,

        col6 TYPE char10,

        col7 TYPE char10,

        col8 TYPE char10,

        col9 TYPE char10,

        col10 TYPE char10,

        END OF ty_fetchtab.

data: i_fetchtab TYPE STANDARD TABLE OF ty_fetchtab,

      i_raw      TYPE truxs_t_text_data.    " FM XLS_TO_SAP - variable

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-upl.

" Upload File

PARAMETERS : p_file TYPE rlgrap-filename OBLIGATORY." Pres.Serv FilePath

*PARAMETERS : p_error TYPE string OBLIGATORY. "rlgrap-filename.

SELECTION-SCREEN :  END OF BLOCK b1.

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_tab_raw_data       = i_raw       " WORK TABLE

        i_filename           = p_file

      TABLES

        i_tab_converted_data = i_fetchtab    "ACTUAL DATA

      EXCEPTIONS

        conversion_failed    = 1

        OTHERS               = 2.

    IF sy-subrc <> 0.

      MESSAGE e601(mepo) WITH text-005.

    ENDIF.

The case working in gui 710, whereas not working in gui 730. is there any problem with sap gui 730 and office 2003

Read only

0 Likes
1,970

Hi Santhosh,

Basically it won't happend in general becuase it's nothing to do with the SAP GUI version because it's happening in the backend.

And for the SAP GUI and office relation i'm not sure about it.

Better you check with this.

Just a guess,

while calling FM 'F4_FILENAME'

pass the program name and dynpro_number and comment the field_name parameter.

CALL FUNCTION 'F4_FILENAME'

    EXPORTING

      program_name  = syst-cprog

      dynpro_number = syst-dynnr

*     FIELD_NAME    = ' '

    IMPORTING

      file_name     = p_file.

just try with this and see it's getting resolved or not?

Wait for seniors reply.what they are saying about it.

Thanks & Regards

Syed

Read only

0 Likes
1,970

hi syed,

its not working

Read only

0 Likes
1,970

Hi Santhosh,

Just for the testing, i have created a XL file and save it with 97-2003 workshhet formt and uploaded the xl content to itab and  it's working very much fine.

So not seems to be SAP gui and office version issue.

Any way what is the sy-subrc value of FM 'TEXT_CONVERT_XLS_TO_SAP' in debug mode. And do not display your custom message if FM 'TEXT_CONVERT_XLS_TO_SAP' failed rather display the standard message

     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

.

Thanks & Regards

Syed

Read only

Former Member
0 Likes
1,970

Hi Santhosh,

Check whether your internal table "I_FETCHTAB" is having all the fields as character type! In order to use the aforesaid function module "TEXT_CONVERT_XLS_TO_SAP" you need to have all your columns in character type format i.e., have your internal table type structure as -

TYPES: BEGIN OF GTY_INP_FILE,
                COL1
TYPE CHAR8  ,    
                COL2
TYPE CHAR10 ,    
                COL3
TYPE CHAR4  ,    
                COL4
TYPE CHAR2  ,    
                COL5
TYPE CHAR8  ,

             END   OF GTY_INP_FILE.


DATA: I_FETCHTAB TYPE STANDARD TABLE OF GTY_INP_FILE.


and do also check while uploading your file it is not opened!


I certainly hope this solves your problem.

Regards,

Varun Sahu

Read only

Former Member
0 Likes
1,970

Hi Santhosh,

Please check the below Code .

REPORT ZMANOJ_TESTING.

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE  rlgrap-filename.

TYPES: BEGIN OF t_datatab,

      col1(30)    TYPE c,

      col2(30)    TYPE c,

      col3(30)    TYPE c,

      END OF t_datatab.

DATA: it_datatab type standard table of t_datatab,

      wa_datatab type t_datatab.

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.

START-OF-SELECTION.

  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

    EXPORTING

*     I_FIELD_SEPERATOR        =

      i_line_header            = 'X'

      i_tab_raw_data           = it_raw       " WORK TABLE

      i_filename               =  p_file

    TABLES

      i_tab_converted_data     = it_datatab[]    "ACTUAL DATA

   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.

END-OF-SELECTION.

  LOOP AT it_datatab INTO wa_datatab.

    WRITE:/ wa_datatab-col1,

            wa_datatab-col2,

            wa_datatab-col3.

  ENDLOOP.

Read only

0 Likes
1,970

Hi manoj,

i have used same code of yours,

but the probelm with sap gui 730 and ms office 2003 combination

Regards,

Santhosh.

Read only

0 Likes
1,970

Hi Santhosh,

Yeah may be that is the case! Strange it seems, shouldn't happen like this. But any ways if possible install office 2007 and then run it from your SAP GUI 730 Final release version.

Regards,

Varun

Read only

0 Likes
1,970

hi varun,

Thanks for your reply. Its already running from office 2007. But since client machine is not having office 2003. wanted to find a solution through 2003 or need a correct reason to say that gui 730 is not compatible with office 2003

Regards,

Santhosh.

Read only

0 Likes
1,970

Santosh may be you can try data upload via function module ALSM_EXCEL_TO_INTERNAL_TABLE a bit tedious as compared to FM TEXT_CONVERT_XLS_TO_SAP excel file being in office 2003.

Regards,

Varun

Read only

srikanthv2
Participant
0 Likes
1,970

Hi,

Please go through the below link once. May be helpful to you.

Regards

Srikanth

Read only

0 Likes
1,970

hi srikanth,

Thanks for your response. the issue is there in gui 730, whereas its not there in 710.

So its not a extension problem

Regards,

Santhosh