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

SRM function module to upload excel to internal table

Hi Experts,

I need to import an excel data into my internal table in SRM.

I was not able to find any FM for this purpose..!!

i tried to copy 'ALSM_EXCEL_TO_INTERNAL_TABLE' from ECC to SRM ..but in vain...

it throws many errors....

Please guide me through this,,,,,,,,,,,,,!!!!!!!!!!!!!!1

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2009 at 07:35 AM

    Hi Vidya,

    How did you achieve this?

    I have a similar type of requirement.

    BR,

    Sri

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sri,

      We finally went ahead with a tab delimited text file.

      If you still want an excel file then,

      You can enter the required data in the excel and then save the file as

      file name : abc.tab

      Save as type : Text (Tab delimited) (*.txt)

      By this your file gets saved as a tab file but still it appears as an excel for you to enter data......

      then you can use gui_upload ....as per your requirement.....

      Best Regards,

      Vidya

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2011 at 10:51 AM

    Hello Nagaraj,

    In SRM you can use .CSV files very easily but you need to convert excel file to .CSV format before using. You also need to change all the commas (,) to cemicallons (😉 before useing it.

    Please find the below code for ready reference.

    FORM upload_file USING fp_p_file TYPE localfile

    CHANGING fp_gt_main TYPE gs_main.

    • Declaration

    DATA: l_file_nam TYPE string,

    l_file_typ TYPE string,

    l_type TYPE string VALUE 'CSV'.

    • Checking path is not empty

    IF fp_p_file IS INITIAL.

    • If no file selected giving one error

    PERFORM check_file.

    ELSE.

    SPLIT fp_p_file AT gc_mark INTO: l_file_nam l_file_typ.

    TRANSLATE l_file_typ TO UPPER CASE.

    IF l_file_typ EQ l_type.

    • Uploading file data to a internal table

    CALL FUNCTION 'BBPU_UPLOAD_DATA_FILE'

    EXPORTING

    filename = fp_p_file

    TABLES

    transfer_tab = fp_gt_main

    EXCEPTIONS

    file_open_error = 1

    file_read_error = 2

    invalid_type = 3

    no_batch = 4

    unknown_error = 5

    action_cancelled = 6

    gui_refuse_filetransfer = 7

    no_authority = 8

    file_is_empty = 9

    OTHERS = 10.

    IF sy-subrc <> 0.

    LEAVE LIST-PROCESSING.

    ENDIF.

    ELSE.

    PERFORM error_msg.

    ENDIF.

    ENDIF.

    ENDFORM. " UPLOAD_FILE

    If you want exactly the same functinality like FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' then you can copy the standard one & create a z FM for your SRM system.

    Regards,

    Sujoy

    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.