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

Function Module required

Former Member
0 Likes
987

I am uploading excel sheet into ABAP. I was using gui_upload function module. Problem is the excel sheet is having fields which are getting different number of columns for different excel sheets. So, i am unable to use gui_upload function module. Is there any other function module which can be used to achieve this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
952

Hi,

try using ALSM_EXCEL_TO_INTERNAL_TABLE function module.

if it helps u pl. award appropriate points.

8 REPLIES 8
Read only

Former Member
0 Likes
952

aslm_excel_to_internal_table

Read only

Former Member
0 Likes
953

Hi,

try using ALSM_EXCEL_TO_INTERNAL_TABLE function module.

if it helps u pl. award appropriate points.

Read only

Former Member
0 Likes
952

please reward for helpful answers

Read only

Former Member
0 Likes
952
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_inp " file name i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 65536
TABLES
intern = l_t_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.

don't forget to delete first record as it will have header (fiueld names)

Read only

Former Member
0 Likes
952

Please Close the thread if your Porblem solves...

reward for helpful answers...

regards

vijay

Read only

Former Member
0 Likes
952

are you facing any problem with the Function module...

if so please let me know....

regards

vijay

Read only

Former Member
0 Likes
952

I hope both the FMs are same...

please unassign the Points which you gave it to me....

this looks very odd...

Read only

aaruljothi
Participant
0 Likes
952

Hi try this,

REPORT zexcelup

LINE-SIZE 1023

LINE-COUNT 250.

TABLES: alsmex_tabline.

DATA: BEGIN OF iexcel OCCURS 0.

INCLUDE STRUCTURE alsmex_tabline.

DATA: END OF iexcel.

  • No of columns

DATA: BEGIN OF data_tab OCCURS 0,

value_0001(25),

value_0002(25),

value_0003(25),

value_0004(25),

value_0005(25),

value_0006(25),

value_0007(25),

value_0008(25),

value_0009(25),

value_0010(25),

value_0011(25),

value_0012(25),

value_0013(25),

value_0014(25),

value_0015(25),

value_0016(25),

value_0017(25),

value_0018(25),

value_0019(25),

value_0020(25),

value_0021(25),

value_0022(25),

value_0023(25),

value_0024(25),

value_0025(25),

value_0026(25),

value_0027(25),

value_0028(25),

value_0029(25),

value_0030(25),

value_0031(25),

value_0032(25),

value_0033(25),

value_0034(25),

value_0035(25),

value_0036(25),

value_0037(25),

value_0038(25),

value_0039(25),

value_0040(25),

value_0041(25),

value_0042(25),

value_0043(25),

value_0044(25),

value_0045(25),

value_0046(25),

value_0047(25),

value_0048(25),

value_0049(25),

value_0050(25),

value_0051(25).

DATA: END OF data_tab.

DATA: tind(4) TYPE n.

DATA: zwfeld(19).

FIELD-SYMBOLS: <fs1>.

PARAMETERS: filename LIKE rlgrap-filename MEMORY ID m01,

noheader AS CHECKBOX.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = filename

i_begin_col = 1

i_begin_row = 1

i_end_col = 100

i_end_row = 30000

TABLES

intern = iexcel

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc <> 0.

WRITE: / 'EXCEL UPLOAD FAILED ', filename, sy-subrc.

ELSE.

SORT iexcel BY row col.

LOOP AT iexcel.

IF noheader = 'X'

AND iexcel-row = 1.

CONTINUE.

ENDIF.

tind = iexcel-col.

CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.

ASSIGN (zwfeld) TO <fs1>.

<fs1> = iexcel-value.

AT END OF row.

APPEND data_tab.

CLEAR data_tab.

ENDAT.

ENDLOOP.

ENDIF.