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

Uploading data to sap

Hi Experts,

I have an Excel file.

In that there are two tabs(As we can see down of excell sheet..like sheet1 and sheet2 etc..) with Header input, Line item input

Here Header detials taken from one Table, and Line item fields from another Table.

In The firest sheet if have header

and in second sheet ( Output File sample) : header output, Line item out put

I have to write an Uploading program, i need to upload the flat file based on some Field validation rules.

Is it possible to upload the tab specified flat file ?

How we can differentiate the Header input and Line item Input here ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2006 at 11:15 AM

    hi

    good

    no with header you can'table to upload the program, save the data in the text file using tab delimited format than you upload that data from the text file , i ll work fine.

    thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Thanks for ur replies.My question is in a single Excel file if header data is in one sheet(sheet1) and item data is in another sheet(sheet2) then how can we distinguish and how can we upload that data into SAP trhu an ABAP pgm..

      If any body has such example pls..let me know.

  • Posted on Sep 26, 2006 at 11:01 AM

    hi,

    chk this sample, put the data into an excel file.then download.

    suppose data base name is

    db_name_age

    fields inside it are name and age.

    **************************************

    sample excel sheet.

    coloumn 1 is name and column 2 is age

    name age

    A 8

    C 13

    D 55

    ************************************

    DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.

    data : record like db_name_age occurs 0 with header line.

    DATA : v_start_col TYPE i VALUE '1', "starting col

    v_start_row TYPE i VALUE '1', " starting row

    v_end_col TYPE i VALUE '2', " total columns

    v_end_row TYPE i VALUE '10'. "total no of record

    FORM f_upload .

    CLEAR : int_excel, int_excel[].

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    filename = wf_filename

    i_begin_col = v_start_col

    i_begin_row = v_start_row

    i_end_col = v_end_col

    i_end_row = v_end_row

    TABLES

    intern = int_excel

    EXCEPTIONS

    inconsistent_parameters = 1

    upload_ole = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    *Message is 'Unable to upload data from ' wf_filename.

    MESSAGE e169(zm050) WITH wf_filename.

    ELSE.

    SORT int_excel BY row col.

    REFRESH : record.

    CLEAR : record.

    LOOP AT int_excel.

    CASE int_excel-col. "go thru each column.

    WHEN 1.

    record-name = int_excel-value.

    WHEN 2.

    record-age = int_excel-value.

    ENDCASE.

    AT END OF row.

    APPEND record.

    CLEAR record.

    ENDAT.

    ENDLOOP.

    *inserting into table

    modfiy db_name_age from table record.

    ENDIF.

    if this helped pld rewrd points,

    rgrds

    anver

    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.