‎2007 Jan 05 11:14 PM
Hi,
just send me the code to upload data from XSL seet to internal table(BDC program).......i used alsm_excel_to_internal_table. but that program going to dump. i dont know why...........plz give me any suggestion plzzzzzzzzz
‎2007 Jan 05 11:18 PM
‎2007 Jan 05 11:20 PM
report ZTEST2.
data: file_path type string.
data: itab type standard table of t001.
start-of-selection.
file_path = 'C:\FILE.XLS'.
call method cl_gui_frontend_services=>gui_upload
exporting filename = file_Path
changing data_tab = itab.
- Guru
Reward points for helpful answers
‎2007 Jan 06 12:57 AM
Hi,
You can't use GUI_UPLOAD to upload data from a XLS file.
How much lines of data are you trying to upload ? Because ALSM_EXCEL_TO_INTERNAL_TABLE has a limit of 5000 rows of data. You better use the function module 'FAA_FILE_UPLOAD_EXCEL'. It also uses the formar FM but gives data in a proper format as compared to the former. But, it also has the same problem of 5000 rows of data. So, if you have data of more than 5000 rows then create a Zcopy of FM 'FAA_FILE_UPLOAD_EXCEL' and then change the value of ld_max_rows to whatever you want.
Reward points if the answer is helpful.
Regars,
Mukul
‎2007 Jan 06 4:51 AM
HI
This will b helpful to you to upload data from Excel file to Internal Table.
report ZMSFK02
no standard page heading line-size 255.
include bdcrecx1.
DATA : BEGIN OF ITAB OCCURS 0,
LIFNR(16),
BUKRS(4),
NAME1(35),
ORT01(35),
END OF ITAB.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ '
FILETYPE = 'ASC'
TABLES
DATA_TAB = ITAB.
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform open_group.
LOOP AT ITAB.
perform bdc_dynpro using 'SAPMF02K' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0110'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
ITAB-LIFNR. " '1481'.
perform bdc_field using 'RF02K-BUKRS'
ITAB-BUKRS " '1000'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-ANRED'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-ANRED'
'Mr.'.
perform bdc_field using 'LFA1-NAME1'
ITAB-NAME1 " 'PUSHPA K.S.'.
perform bdc_field using 'LFA1-NAME2'
'PS2'.
perform bdc_field using 'LFA1-ORT01'
ITAB-ORT01 " 'SR.ENGINEER'.
perform bdc_field using 'LFA1-PSTLZ'
'641020'.
perform bdc_field using 'LFA1-LAND1'
'IN'.
perform bdc_field using 'LFA1-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'FK02'.
ENDLOOP.
perform close_group.
Regards
Suvetha
‎2007 Jan 08 10:12 AM
Hi Suvetha,
FM UPLOAD is an obsolete statement. So, it is not a best practice to use it. Also, If you use it, you will get an error in Extended Program Check.
Regards,
Mukul