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: 

Uploading the data from excel to sap R/3

Former Member
0 Kudos
69

Hi Guys,

Actually i know how to upload the data from text file to sap.when ever i come to excel file while calling 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM I AM NOT ABLE TO HANDLE THE PARAMETERS .

How can we handle this thing.Plz give me the example code.

Regards,

Venkat.

6 REPLIES 6

sachin_jadhav8
Participant
0 Kudos
39

Hi ,

Try This,

FM SAP_CONVERT_TO_XLS_FORMAT

Former Member
0 Kudos
39

Create a structure of ALSMEX_TABLINE and pass it to function module.

[Codes sample for 'ALSM_EXCEL_TO_INTERNAL_TABLE'|https://www.sdn.sap.com/irj/scn/wiki?path=%3fpath=/display/abap/upload%252bexcel%252bdocument%252binto%252binternal%252btable]

Regards,

Gurpreet

Former Member
0 Kudos
39

HI,

Check this code..

DATA l_count TYPE sy-tabix.

   CONSTANTS: lc_begin_col TYPE i VALUE '1',
              lc_begin_row TYPE i VALUE '2',
              lc_end_col   TYPE i VALUE '2',
              lc_end_row   TYPE i VALUE '3000'.

* Begin of CALK912848 - Carlos Werberich - 16Sep08
  CLEAR p_i_excel_data. REFRESH p_i_excel_data.
* End   of CALK912848 - Carlos Werberich - 16Sep08

* Function module to read excel file and convert it into internal table
   CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
     EXPORTING
       filename                = p_p_file
       i_begin_col             = lc_begin_col
       i_begin_row             = lc_begin_row
       i_end_col               = lc_end_col
       i_end_row               = lc_end_row
     TABLES
       intern                  = i_data
     EXCEPTIONS
       inconsistent_parameters = 1
       upload_ole              = 2
       OTHERS                  = 3.
* Error in file upload
   IF sy-subrc NE 0 .
     MESSAGE text-006 TYPE 'E'.
     EXIT.
   ENDIF.
   IF i_data[] IS INITIAL .
     MESSAGE text-007 TYPE 'E'.
     EXIT.
   ELSE.
     SORT i_data BY row col .
* Loop to fill data in Internal Table
     LOOP AT i_data .
       MOVE i_data-col TO l_count .
       ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
       MOVE i_data-value TO <fs_source> .
       AT END OF row .
* Append data into internal table
         APPEND p_i_excel_data.
         CLEAR p_i_excel_data.
       ENDAT .
     ENDLOOP .
   ENDIF .

shadow
Participant
0 Kudos
39

Hi Reddy,

Check this one may be help full to you .................

*START OF SELECTION

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = p_infile

i_begin_col = '1'

i_begin_row = '2' "Do not require headings

i_end_col = '14'

i_end_row = '31'

tables

intern = itab

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

With Regard's

Shaik.

Former Member
0 Kudos
39

Hi,

Try this function module.

'TEXT_CONVERT_XLS_TO_SAP':- Retrive data in fast.

DATA: IT_RAW TYPE TRUXS_T_TEXT_DATA.


SELECTION-SCREEN BEGIN OF BLOCK BLK_01 WITH FRAME TITLE TEXT-001.
PARAMETER: P_FNAME        LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK_01.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
  EXPORTING

    I_TAB_RAW_DATA             = IT_RAW
    I_FILENAME                 = P_FNAME
  TABLES
    I_TAB_CONVERTED_DATA       = T_UPLOAD[].

.

Former Member
0 Kudos
39

Hi,

Check this FM 'SAP_CONVERT_TO_XLS_FORMAT'

Regards,

Jyothi CH.