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

Regarding uploading excel file into internal table having two rows

Former Member
0 Likes
777

Hi ,

I have a problem of uploading data which conatins two rows in excel.First row contains say ten fields and second row conatns three fields . example matnr ersda maktl mtart in first row and second row contains fields of diffrent type

example spras langu region .How to upload from excel to internal table . I need to pass again to BAPI .

subbara.

Hi ,

I have a problem of uploading data which conatins two rows in excel.First row contains say ten fields and second row conatns three fields . example matnr ersda maktl mtart in first row and second row contains fields of diffrent type

example spras langu region .How to upload from excel to internal table . I need to pass again to BAPI .

subbara.

6 REPLIES 6
Read only

Former Member
0 Likes
742

hello,

the file upload usually needs a fixed structure defined for the upload file.

Two things that you can do -

1> convert the two rows into one with 13 fields and upload it and use in the BAPI using further data mapping or logic to move the fields.

2> Define a genereic structure of length equal to the length of the 10 fields. Read the file and depending on the line(odd for 10 fields and even for 3 fields) move it in a structure as defined for the 10 fields and 3 fields. Then you can transfer the data to the BAPI.

regards,

swanand

Read only

Former Member
0 Likes
742

Hi Sada,

Appreciated for your answer, can you please send some sample code

Regards

subbara

Read only

0 Likes
742

Hi,

Try Below code.

DATA: it_data1 TYPE kcde_intern WITH HEADER LINE,

wa_data1 LIKE LINE OF it_data1.

TYPES : BEGIN OF ty_data ,

zbukr TYPE payr-zbukr ,

hbkid TYPE payr-hbkid ,

hktid TYPE payr-hktid ,

rzawe TYPE payr-rzawe ,

chect TYPE payr-chect ,

laufd TYPE reguh-laufd ,

laufi TYPE reguh-laufi ,

lifnr TYPE reguh-lifnr ,

vblnr TYPE reguh-vblnr ,

rwbtr TYPE reguh-rwbtr ,

END OF ty_data .

DATA it_tab type ty_data OCCURS 0 WITH HEADER LINE.

PARAMETER : pr_file TYPE rlgrap-filename .

start-of-selection.

CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'

EXPORTING

filename = pr_file

i_begin_col = '1'

i_begin_row = '4'

i_end_col = '11'

i_end_row = '60000'

TABLES

intern = it_data1

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

*******Now IT_DATA1 contains all the data of excelsheet, manipulate it as per your requirement.

LOOP AT it_data1.

MOVE it_data1-col TO ld_index.

ASSIGN COMPONENT ld_index OF STRUCTURE

it_tab TO <fs>.

MOVE : it_data1-value TO <fs>.

  • MOVE it_data1-value TO p_table.

AT END OF row.

APPEND it_tab.

CLEAR it_tab.

ENDAT.

ENDLOOP.

Here data will come in it_data as per my requirement.

You can do manipulation as per your requirement.

Read only

0 Likes
742

Hi Oman,

Appreciated for your help, i want this program to be run in Background . can i run this program run in background.

Regards

subba

Read only

0 Likes
742

Hi ,

I have resolved my self as i did using FTP and read dataset.

Now my program is working fine in background.

Regards

subba

Read only

Former Member
0 Likes
742

Hi ,

I could able to resolve this issue on myself.

Thanks for the help.

Regards

subbara