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

uploding the data from two or more sheets

Dear friends

Hi all! My name is Ashish Nagar and iam new to this group joined few days back. First of happy new year. My problem is that i am unable to convert the data into flat file (or Sap understand able file) given in two excel sheet from the client it is only converting the active sheet data. I am using the function ALSM_EXCEL_TO_INTERNAL_TABLE to convert the data . I request you to please help me up.


(Ashish V Nagar)

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 Jan 09, 2005 at 10:13 PM

    You have to use the FM GUI_UPLOAD, then you will have the data from the excel file into a internal table in SAP, later you can do anything with that =)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2005 at 11:21 PM

    Hi Ashish

    You can use <b>OLE automation</b> within ABAP. However, you should know the data area to consider performance. The code below may need some rework since I did not try it on the system.

    DATA gs_excel TYPE ole2_object .
    DATA gs_wbooks TYPE ole2_object .
    DATA gs_wbook TYPE ole2_object .
    DATA gs_worksheet TYPE ole2_object .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
    *--Opening the existing document
    CALL METHOD OF gs_wbooks 'Open' = gs_wbook
         EXPORTING #1 = <file_path_var> .
    "* << ---- BEGIN OF BLOCK A
    *--Activating sheet #1
    GET PROPERTY OF gs_excel 'WorkSheets' = gs_worksheet
        EXPORTING #1 = <the_name_of_the_worksheet_1> .
    CALL METHOD OF gs_worksheet 'Activate' .
    *--Construct a loop according to your data area
    DO n TIMES .
    *--exit condition
      DO m TIMES .
    *--exit condition
        CALL METHOD OF gs_excel 'Cells' = gs_cell
             EXPORTING #1 = m
                       #2 = n .
        GET PROPERTY OF gs_cell 'Value' = <variable> .
    *--Assign the variable to the proper internal table field
      ENDDO .
    *--A possible append to the intenal tablehere.
    ENDDO .
    "* >> ---- END OF BLOCK A
    "*--And do the similar coding of "block A" for the second sheet."

    <i>And as a last thing, let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;

    - one 10 points (solved)

    - two 6 points (very helpful answer)

    - many 2 points (helpful answer)</i>

    Kind Regards...


    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.