Skip to Content
author's profile photo Former Member
Former Member

very arguent plz...bdc..

friends..i want to upload data from excel sheet where internally i need to convert into .txt file and use for uploading of data..i am really confused can any one help me plz...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 04, 2007 at 07:32 AM

    Hi,

    Use FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the data from excel sheet

    Regards,

    PRashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:38 AM

    Hi,

    by using this function module directly upload the data from excel sheet to internal table

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    filename = 'C:\New Folder\FILE.XLS

    i_begin_col = 1

    i_begin_row = 1

    i_end_col = 10

    i_end_row = 100

    tables

    intern = ITAB

    • 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.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:43 AM

    so better convert the excel file into text file as save excel file as text file with tab delimited and this text file you can pass it to bdc.

    plz reward points if helps.

    regards,

    rahul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:45 AM

    hai shashi u r clearly mentioning the column size and column length if i want to do dynamically what i have to do ? i dont know some times data will be in huge some times less..we cant gve client to do all these things..ok..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:48 AM

    Hi

    directly you can convert and upload the file

    open that excel sheet and save that as >TEXT(TABDELIMITED) then it will save as text file and as a tab delimited you can directly use that file

    or if you want to use directly as excel sheet then refer this program

    in this EXCEL TO INTERNAL TABLE AND THEN TO PLLICATION server

    &----


    *& Report ZSD_EXCEL_INT_APP

    *&

    &----


    *&

    *&

    &----


    REPORT ZSD_EXCEL_INT_APP.

    parameter: file_nm type localfile.

    types : begin of it_tab1,

    f1(20),

    f2(40),

    f3(20),

    end of it_tab1.

    data : it_tab type table of ALSMEX_TABLINE with header line,

    file type rlgrap-filename.

    data : it_tab2 type it_tab1 occurs 1,

    wa_tab2 type it_tab1,

    w_message(100) TYPE c.

    at selection-screen on value-request for file_nm.

    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

    EXPORTING

    • PROGRAM_NAME = SYST-REPID

    • DYNPRO_NUMBER = SYST-DYNNR

    • FIELD_NAME = ' '

    STATIC = 'X'

    • MASK = ' '

    CHANGING

    file_name = file_nm

    EXCEPTIONS

    MASK_TOO_LONG = 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.

    start-of-selection.

    refresh it_tab2[].clear wa_tab2.

    file = file_nm.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    filename = file

    i_begin_col = '1'

    i_begin_row = '1'

    i_end_col = '10'

    i_end_row = '35'

    tables

    intern = it_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.

    ENDIF.

    loop at it_tab.

    case it_tab-col.

    when '002'.

    wa_tab2-f1 = it_tab-value.

    when '004'.

    wa_tab2-f2 = it_tab-value.

    when '008'.

    wa_tab2-f3 = it_tab-value.

    endcase.

    at end of row.

    append wa_tab2 to it_tab2.

    clear wa_tab2.

    endat.

    endloop.

    data : p_file TYPE rlgrap-filename value 'TEST3.txt'.

    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    *--- Display error messages if any.

    IF sy-subrc NE 0.

    MESSAGE e001(zsd_mes).

    EXIT.

    ELSE.

    *---Data is downloaded to the application server file path

    LOOP AT it_tab2 INTO wa_tab2.

    TRANSFER wa_tab2 TO p_file.

    ENDLOOP.

    ENDIF.

    *--Close the Application server file (Mandatory).

    CLOSE DATASET p_file.

    loop at it_tab2 into wa_tab2.

    write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.