Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Uploading data to sap

Former Member
0 Likes
585

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 ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
540

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^

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 ?

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
540

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

Read only

0 Likes
540

refer same thread

Read only

Former Member
0 Likes
541

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^

Read only

0 Likes
540

Hi,

Thanks for ur replies.My question is in a <b>single Excel file</b> <b>if header data is in one sheet(sheet1) and item data is in another sheet(sheet2)</b> 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.