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

UPLOAD DATA FROM EXCEL FILE

Former Member
0 Likes
1,822

hi guru,

I want to upload data from excel file for mm02.. first of all help on the matter of how to upload data from excel...

i hv used the FM ALSM_EXCEL_TO_INTERNAL_TABLE.. but its not working it uploading garbage value ... so tell me how to used it...

help me on this matter.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
771

HI,

Check this link

[KCD_EXCEL_OLE_TO_INT_CONVERT|http://docs.google.com/Doc?docid=0AZqwnQpzX9wBZGZ2MmhtZ3NfMTFjZzRqZmRw&hl=en]

[ALSM_EXCEL_TO_INTERNAL_TABLE|]

6 REPLIES 6
Read only

Former Member
0 Likes
772

HI,

Check this link

[KCD_EXCEL_OLE_TO_INT_CONVERT|http://docs.google.com/Doc?docid=0AZqwnQpzX9wBZGZ2MmhtZ3NfMTFjZzRqZmRw&hl=en]

[ALSM_EXCEL_TO_INTERNAL_TABLE|]

Read only

sridhar_meesala
Active Contributor
0 Likes
771

Hi,

Refer to the [link|;

Thanks,

Sri.

Read only

Former Member
0 Likes
771

Dear Manish,

You can save your excel file as TAB Delimited text file and the use FM : WS_UPLOAD

This is the simplest and best way to upload material master.

Regds,

Anil

Read only

Former Member
0 Likes
771

Hi,

This is how it is used

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = p_infile

i_begin_col = c_begin_col

i_begin_row = c_begin_row

i_end_col = c_end_col

i_end_row = c_end_row

TABLES

intern = ig_file1

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Enter Valid File'(002).

ENDIF.

Regards

Milan

Read only

former_member194416
Contributor
0 Likes
771

Check below example.

parameters :  p_file  LIKE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  PERFORM get_file_name.
  PERFORM get_file_to_excel.
*&---------------------------------------------------------------------*
*&      Form  get_file_name
*&---------------------------------------------------------------------*
FORM get_file_name.
  DATA: lv_name LIKE sy-repid.
  lv_name = sy-repid..
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
            program_name  = lv_name
            dynpro_number = syst-dynnr
            static        = 'X'
       CHANGING
            file_name     = p_file.



ENDFORM. " get_file_name
*&---------------------------------------------------------------------*
*&      Form  get_file_to_excel
*&---------------------------------------------------------------------*
FORM get_file_to_excel.
  DATA: idata LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.

  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       EXPORTING
            filename                = p_file
            i_begin_col             = '1'
            i_begin_row             = '2'  "Do not require headings
            i_end_col               = '2'
            i_end_row               = '60000'
       TABLES
            intern                  = idata
       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.
    STOP.
  ENDIF.


* Get first row retrieved
  READ TABLE idata INDEX 1.

* Set first row retrieved to current row
  DATA: gd_currentrow TYPE i.
  gd_currentrow = idata-row.

  LOOP AT idata.
*   Reset values for next row
    IF idata-row NE gd_currentrow.
      APPEND f.  CLEAR f.
      gd_currentrow = idata-row.
    ENDIF.

    CASE idata-col.
      WHEN '0001'.
        f-belnr   = idata-value.
    ENDCASE.
  ENDLOOP.
  APPEND f.  CLEAR f.

Read only

Former Member
0 Likes
771

HI,

Use FM TEXT_CONVERT_XLS_TO_SAP. this would be suitable for all case.

regards,

venkatesh