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

long text upload problem from excel

former_member420959
Participant
0 Likes
2,703

hello,

i have an excel file with a column for long text in it.

im using TEXT_CONVERT_XLS_TO_SAP fm to upload to itab

but the long text field is filling only upto 255 characters.

searched a lot in sdn reagrding this and common solutins are:

use ALSM_EXCEL_TO_INTERNAL_TABLE fm

copy ALSM_EXCEL_TO_INTERNAL_TABLE and table strcuture in it and increase length of it

and use gui_upload.

i tried all these things but none worked out for me.

pls help

Ujwal

13 REPLIES 13
Read only

FredericGirod
Active Contributor
0 Likes
1,916

Hi,

for me the Excel file is limit to 40 char field long

if you want more, you must use CSV file

but maybe someone will have a better solution

regards

Fred

Read only

0 Likes
1,916

CSV file is not preferred by the user.

Anyways thanks for reply.

Ujwal

Read only

0 Likes
1,916

It took a little looking, but it looks like you could :

  1. copy ALSM_EXCEL_TO_INTERNAL_TABLE to Z_ALSM_EXCEL_TO_INTERNAL_TABLE
  2. copy structure ALSMEX_TABLINE to Z_ALSMEX_TABLINE changing value to a longer length.
  3. Then work backward testing and correcting.

There'd be a whole lot of work to do to make it all work out in the end, but I'd think it could be done...

Neal

Read only

0 Likes
1,916

Looks like this note for ISOil pumps it up to 200 characters...

  1739333

Neal

Read only

0 Likes
1,916

But maybe you'd like a simpler solution?

What if your users put the first 50 characters on the existing row.  Then they insert additional rows with only long text up to 50 characters until they get the whole text in.  In your logic, then you can assume that if the key cells are blank then the text should be appended to the long text of the last key...

Neal

Read only

0 Likes
1,916

Hello Ujwal,

Kindly go through below link, a very useful Document written by Ranjan Mohanty.

http://scn.sap.com/docs/DOC-45423

-Venkat

Read only

0 Likes
1,916

That is one heck of a great find!

Read only

0 Likes
1,916

hi Venkat,

i have seen the link already and followed it.

but no use.its taking only 255 characters into internal table.

Ujwal

Read only

0 Likes
1,916

Hi Ujwal,

What is the field length of your internal table coumn ? Did you try gving more than 255 in the field length ?

Thanks,

Ajay Bose

Read only

0 Likes
1,916

Hi Ujwal

Did you create your Z FM with same length as mentioned in documents.. Please hsare your sample code.

Nabheet

Read only

0 Likes
1,916

Hi ,

Can you check this Internal Table Declaration in this document http://scn.sap.com/docs/DOC-45423

it takes more then 255 Character .

Regard's

Smruti

Read only

0 Likes
1,916

yes i gave 2000 characters

Read only

former_member188282
Active Participant
0 Likes
1,916

Hi UJwal,

First of all, some assumption MUST be made as how the input file will be formatted.

So, if you needed to update the long text id 'BEST' and object 'MATERIAL' of all materials given in a file, that file must have in its structure the material code, a line id and a fixed length field with the text. So if the long text for material code 10 comprises of 260 characters, you could requeste that the input txt file has the following structure (tab delimited):

matnr(18), line(3), line(100)

-


10(tab)1(tab) bla bla ..... (100 chars)

10(tab)2(tab) bla bla ...... (100 chars)

10(tab)3(tab) bla bla....    (remaining 60 characters)

the respective program then would be as follows:

REPORT zupload_texts.

    • EXTERNAL TABLES DEFINITIONS *************************

TABLES: mara.

    • VARIABLES DEFINITIONS *****************************

DATA: wl_file TYPE string.

    • INTERNAL TABLES DEFINITIONS *************************

DATA:  BEGIN OF i_data OCCURS 0,         matnr LIKE mara-matnr,         lino(3) TYPE n,         txt(100) TYPE c,       END OF i_data. DATA: wa_data LIKE i_data. DATA: i_lines LIKE tline OCCURS 15 WITH HEADER LINE,      i_thead LIKE thead.

    • SELECTION SCREEN / OPTIONS - PARAMETERS *****************

SELECTION-SCREEN SKIP 2. SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME.PARAMETERS:  p_file LIKE ibipparms-path OBLIGATORY DEFAULT 'C:\'.SELECTION-SCREEN SKIP 1.PARAMETERS: p_lang LIKE makt-spras OBLIGATORY DEFAULT sy-langu. SELECTION-SCREEN   END OF BLOCK bl1.

    • INITIALIZATION  EVENT  ***************************

INITIALIZATION. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.  CALL FUNCTION 'F4_FILENAME'    IMPORTING      file_name = p_file.

    • START OF SELECTION EVENTS ****************************

START-OF-SELECTION.

  MOVE p_file TO wl_file.

  CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

      filename                = wl_file

      filetype                = 'ASC'

      has_field_separator     = ';'

    TABLES

      data_tab                = i_data

    EXCEPTIONS

      file_open_error         = 1

      file_read_error         = 2

      no_batch                = 3

      gui_refuse_filetransfer = 4

      invalid_type            = 5

      no_authority            = 6

      unknown_error           = 7

      bad_data_format         = 8

      header_not_allowed      = 9

      separator_not_allowed   = 10

      header_too_long         = 11

      unknown_dp_error        = 12

      access_denied           = 13

      dp_out_of_memory        = 14

      disk_full               = 15

      dp_timeout              = 16

      OTHERS                  = 17.

  IF sy-subrc <> 0.

    WRITE:/ text-001.

    EXIT.

  ENDIF.

END-OF-SELECTION.

  LOOP AT i_data.

    wa_data = i_data.

    i_lines-tdformat = 'TX'.

    i_lines-tdline = i_data-txt.    " current line's characters

    APPEND i_lines.

"at the and of the material, save its long text

    AT END OF matnr.

      i_data = wa_data.

      DATA: w_size TYPE i.

      i_thead-tdname = '000000000000000000'.

      w_size = STRLEN( i_data-matnr ).

      w_size = 18 - w_size.

      i_thead-tdname+w_size = i_data-matnr.

      i_thead-tdobject = 'MATERIAL'.

      CALL FUNCTION 'CREATE_TEXT'

        EXPORTING

          fid         = 'BEST'

          flanguage   = p_lang

          fname       = i_thead-tdname

          fobject     = i_thead-tdobject

          save_direct = 'X'

          fformat     = '*'

        TABLES

          flines      = i_lines

        EXCEPTIONS

          no_init     = 1

          no_save     = 2

          OTHERS      = 3.

      IF sy-subrc <> 0.

        WRITE:/ text-002, i_data-matnr.

      ENDIF.

      CLEAR: i_lines, i_lines[].

    ENDAT.

  ENDLOOP.

  WRITE:/ 'Program ended'.

Regards,

Rajesh.B