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

Import Excel File to Z Table

Dear all Abaper,

I'm beginer for abap about six month since my office implement sap. I've make abap program to get data from

any table of sap like vbak,vbap,ekko, ekpo etc to z table.

Now i want to get data from excel or text file to append in ztable. I've learn about LSMW but not yet found

how to import to z table. LSMW have standart template import to standart sap table.

Could abap guru help me to solve this problem?

Regards

Wili

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2010 at 05:05 AM

    Wili,

    search sdn.

    Thanks

    Bala Duvvuri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2010 at 05:09 AM

    Use this Function module TEXT_CONVERT_XLS_TO_SAP to upload data into SAP from Excel file

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Pavan,

      I've tried and success. Use this link as guide. http://wiki.sdn.sap.com/wiki/display/ABAP/ProgtouploadfromXLtoDDIC+Table

      this my abap program that i trial in IDES:

      &----


      REPORT ZWIL_IMPORT_EXCEL_TO_ZTABLE.

      TYPE-POOLS TRUXS.

      tables zwilharga.

      PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT

      'D:\SAPBELAJAR\coba1.xls'.

      DATA : IT_RAW TYPE truxs_t_text_data,IT_ITAB TYPE TABLE OF zwilharga.

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

      CALL FUNCTION 'F4_FILENAME'

      EXPORTING

      PROGRAM_NAME = SYST-CPROG

      DYNPRO_NUMBER = SYST-DYNNR

      FIELD_NAME = 'P_FILE'

      IMPORTING

      FILE_NAME = P_FILE.

      start-of-selection.

      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

      EXPORTING

      • I_FIELD_SEPERATOR =

      I_LINE_HEADER = 'X'

      I_TAB_RAW_DATA = IT_RAW

      I_FILENAME = P_FILE

      TABLES

      I_TAB_CONVERTED_DATA = it_itab[]

      EXCEPTIONS

      CONVERSION_FAILED = 1

      OTHERS = 2.

      break-point.

      IF SY-SUBRC <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      end-of-selection.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2010 at 05:14 AM

    hello sir use function module ALSM_EXCEL_TO_INTERNAL_TABLE

    
     CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                = FILE_PATH ( location of the file lets say 'c:\my_file.xls').
          I_BEGIN_COL             = '1'  coloum postion of your exel file from where data strats
          I_BEGIN_ROW             = '3'  row postion of your exel file from where data strats
          I_END_COL               = '3'   coloum postion of your exel file from where data ends
          I_END_ROW               = '256' row postion of your exel file from where data ends
        TABLES
          INTERN                  = IT_FILE ( internal table)
        EXCEPTIONS
          INCONSISTENT_PARAMETERS = 1
          UPLOAD_OLE              = 2
          OTHERS                  = 3.
      IF SY-SUBRC NE SPACE.
    
    
    
    

    regards

    chitta ranjan mahato

    Edited by: chitto123 on Oct 15, 2010 7:15 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Chitta,

      I've tried using abap program like this:

      REPORT ZWIL_IMPORT_EXCEL_TO_ZTABLE2.

      TYPE-POOLS TRUXS.

      tables zwilharga2.

      PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT

      'D:\SAPBELAJAR\coba1.xls'.

      DATA : IT_RAW TYPE truxs_t_text_data,wa type zwilharga2,IT_ITAB TYPE TABLE OF zwilharga2.

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

      CALL FUNCTION 'F4_FILENAME'

      EXPORTING

      PROGRAM_NAME = SYST-CPROG

      DYNPRO_NUMBER = SYST-DYNNR

      FIELD_NAME = 'P_FILE'

      IMPORTING

      FILE_NAME = P_FILE.

      start-of-selection.

      break-point.

      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

      EXPORTING

      FILENAME = P_FILE

      I_BEGIN_COL = 1

      I_BEGIN_ROW = 2

      I_END_COL = 6

      I_END_ROW = 25

      TABLES

      INTERN = it_itab

      EXCEPTIONS

      INCONSISTENT_PARAMETERS = 1

      UPLOAD_OLE = 2

      OTHERS = 3.

      • CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

      • EXPORTING

      • I_FIELD_SEPERATOR =

    • I_LINE_HEADER = 'X'

    • I_TAB_RAW_DATA = IT_RAW

    • I_FILENAME = P_FILE

    • TABLES

    • I_TAB_CONVERTED_DATA = it_itab[]

    • EXCEPTIONS

    • CONVERSION_FAILED = 1

    • OTHERS = 2.

    • break-point.

      IF SY-SUBRC <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      end-of-selection.

      Display error "Illegal type when transferring an internal table to a FORM"

      Thanx

      Wili

  • author's profile photo Former Member
    Former Member
    Posted on Oct 15, 2010 at 07:02 AM

    Use Function module

    F4_filename to accept file name...

    then use FM WS_upload...

    to upload data from txt file to Internal table

    and then update Z table from u r Internal Table...

    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.