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

excel uploading

Former Member
0 Likes
984

Hi Experts,

i am uploading the EXCEL file to SAP using Function Module 'TEXT_CONVERT_XLS_TO _SAP', In that flat file i have one text field around 700 charecters, but from Function Module it is uploading only 256 charcters.

i have tried with both STRING and CHAR

data : var_text type string, and

data : var_text(4096) type c.

But this variables are not storing more than 256 charecters...

please give me UR valuable and HELPFUL suggestion.....

Regards

Prasad.EV

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
939

Hi,

I do not think it is a DATA TYPE problem. As far as I understand one cannot export/import more that 256 characters into excel/word for a single field. I think this is more like a constrain.

I had a scenario where I tried replacing a word in WORD doc using a macro and it had a similar issue.

Refer to link http://support.microsoft.com/kb/212543

Regards,

Saurabh

8 REPLIES 8
Read only

Former Member
0 Likes
939

Hi,

Please do try the following function module,"'ALSM_EXCEL_TO_INTERNAL_TABLE'"

which will collect the excell to an internal table from where you can update to DB table.

regards,

Ajith

Read only

Former Member
0 Likes
939

EV,

just use like that:

DATA: BEGIN OF it_excel OCCURS 0,
  belnr(10),
  xblnr(16),
  bktxt(25),
  bldat(10),
  zuonr(18),
  oac(1),
  dmbtr(16),
  pszah(15),
  wrbtr(16),
  kunnr(10),
  budat(10),
  konto(16),
  bukrs(04),
  waers(05),
  agkon(16),
  prctr(10),
  wrbtr1(16),
  spesw(15),
  kostl(10),
  sgtxt(50),

END OF it_excel.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
*     I_FIELD_SEPERATOR          =
      i_line_header              = 'X'
      i_tab_raw_data             = it_raw
      i_filename                 = pfile
    TABLES
      i_tab_converted_data       = it_excel[]
*   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.

Amit.

Read only

Former Member
0 Likes
939

Have a look at FM ALSM_EXCEL_TO_INTERNAL_TABLE this is fine until it gets to teh following statement

perform separated_to_intern_convert tables excel_tab intern

using ld_separator.

You should be able to utilise a lot of the code from here.

Regards

J

Read only

Former Member
0 Likes
939

use function

CALL FUNCTION 'GUI_UPLOAD'

if u r using ecc 5.0/6.0

..

regds

jigar

Read only

Subhankar
Active Contributor
0 Likes
939

Hi

You have do the fallowing steps

1) Copy the FM ALSM_EXCEL_TO_INTERNAL_TABLE and make a zFM use this FM.

2) Copy the table ALSMEX_TABLINE make a Ztable using this table.

3) Change the filed(VALUE) in ztable with a 1000 char dataelement.

4) Use this table as table parameter associated type.

then the ZFM

Read only

former_member787646
Contributor
0 Likes
939

Hi,

The Character Data Type (C) can store upto 255 characters.

If you want to store more than 255 characters then go for

STRING Data Type.

Hope it helps you.

Murthy.

Read only

Former Member
0 Likes
940

Hi,

I do not think it is a DATA TYPE problem. As far as I understand one cannot export/import more that 256 characters into excel/word for a single field. I think this is more like a constrain.

I had a scenario where I tried replacing a word in WORD doc using a macro and it had a similar issue.

Refer to link http://support.microsoft.com/kb/212543

Regards,

Saurabh

Read only

Former Member
0 Likes
939

Hii!

Check Out this code


REPORT  z_file3.

DATA: fname(40),
      w_line TYPE i VALUE 1,
      w_file TYPE rlgrap-filename.


DATA:
  t_tab LIKE
  TABLE OF ALSMEX_TABLINE
  WITH HEADER LINE.

DATA: fs_tab LIKE LINE OF t_tab.


w_file = 'C:\Documents and Settings\abc\Desktop\Book1.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = w_file
    i_begin_col                   = 1
    i_begin_row                   = 1
    i_end_col                     = 10
    i_end_row                     = 100
  tables
    intern                        = t_tab
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
  WRITE: 'UPLOAD SUCCESSFUL'.
ENDIF.

fname = '.\zfile.xls'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_tab INTO fs_tab.
  TRANSFER fs_tab TO fname.
ENDLOOP.

IF sy-subrc EQ 0.
  WRITE: / 'FILE OPENED ON APPS SERVER'.
ELSE.
  WRITE: / 'FILE COULD NOT BE OPENED'.
ENDIF.

Regards

Abhijeet Kulshreshtha