2013 Jun 06 6:34 AM
Sir/mam,
I am getting a short dump error after executing this bdc session program
Runtime error: raise exception
short text: exception condition"upload_ole" raised.
The following program is given below:
report ZBDC_SESSION3
no standard page heading line-size 255.
*include bdcrecx1.
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MATNR,
MBRSH TYPE MBRSH,
MTART TYPE MTART,
MAKTX TYPE MAKTX,
MEINS TYPE MEINS,
END OF TY_MARA.
DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE,
WA_EXCEL TYPE ALSMEX_TABLINE.
DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
start-of-selection.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'C:\Documents and Settings\Administrator\Desktop\BDC_SESSION3.XLS'
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 5
I_END_ROW = 3
TABLES
INTERN = IT_EXCEL
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*perform open_group.
LOOP AT IT_EXCEL INTO WA_EXCEL.
CASE WA_EXCEL-COL.
WHEN '0001'.
WA_MARA-MATNR = WA_EXCEL-VALUE.
WHEN '0002'.
WA_MARA-MBRSH = WA_EXCEL-VALUE.
WHEN '0003'.
WA_MARA-MTART = WA_EXCEL-VALUE.
WHEN '0004'.
WA_MARA-MAKTX = WA_EXCEL-VALUE.
WHEN '0005'.
WA_MARA-MEINS = WA_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_MARA TO IT_MARA.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'ZKUMAR'
* HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
* RECORD = FILLER1
PROG = SY-CPROG
* DCPFM = '%'
* DATFM = '%'
* IMPORTING
* QID =
* EXCEPTIONS
* CLIENT_INVALID = 1
* DESTINATION_INVALID = 2
* GROUP_INVALID = 3
* GROUP_IS_LOCKED = 4
* HOLDDATE_INVALID = 5
* INTERNAL_ERROR = 6
* QUEUE_ERROR = 7
* RUNNING = 8
* SYSTEM_LOCK_ERROR = 9
* USER_INVALID = 10
* OTHERS = 11
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
LOOP AT IT_MARA INTO WA_MARA.
CLEAR BDCDATA.
REFRESH BDCDATA.
performbdc_dynpro using 'SAPLMGMM' '0060'.
performbdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
performbdc_field using 'BDC_OKCODE'
'/00'.
performbdc_field using 'RMMG1-MATNR'
WA_MARA-MATNR.
"'MIRINDA'.
performbdc_field using 'RMMG1-MBRSH'
WA_MARA-MBRSH.
"'F'.
performbdc_field using 'RMMG1-MTART'
WA_MARA-MTART.
"'FGTR'.
performbdc_dynpro using 'SAPLMGMM' '0070'.
performbdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
performbdc_field using 'BDC_OKCODE'
'=ENTR'.
performbdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
performbdc_dynpro using 'SAPLMGMM' '4004'.
performbdc_field using 'BDC_OKCODE'
'=BU'.
performbdc_field using 'MAKT-MAKTX'
WA_MARA-MAKTX.
"' COLD DRINK'.
performbdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
performbdc_field using 'MARA-MEINS'
WA_MARA-MEINS.
"'L'.
performbdc_field using 'MARA-MTPOS_MARA'
'NORM'.
*perform bdc_transaction using 'MM01'.
*perform close_group.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'MM01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = BDCDATA
* EXCEPTIONS
* INTERNAL_ERROR = 1
* NOT_OPEN = 2
* QUEUE_ERROR = 3
* TCODE_INVALID = 4
* PRINTING_INVALID = 5
* POSTING_INVALID = 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.
CALL FUNCTION 'BDC_CLOSE_GROUP'
* EXCEPTIONS
* NOT_OPEN = 1
* QUEUE_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
* IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
* ENDIF.
someone help me for this bdc session program
Message was edited by: Matthew Billingham - removed virulent formatting
2013 Jun 06 7:16 AM
Hi Kaustav,
Function module ALSM_EXCEL_TO_INTERNAL TABLE uses OLE functionality for creating the spred sheet. I am afraid that ole functionality can not be run in background mode very similar to gui_upload or gui_download.
You may have to look for other alternatives to get the data into internal table from the file.
Hope this helps,
~Athreya
2013 Jun 06 7:15 AM
It was problem with file.
-> While uploading the file it needs to closed.
-> Check the mentioned path once.
-> In file having more than 65535 entries.
Below errors will come above cases only.
Runtime error: raise exception
short text: exception condition"upload_ole" raised.
Pass the file path like this.
data: filename type RLGRAP-FILENAME,
w_path type string.
w_path = 'C:\Documents and Settings\Administrator\Desktop\\BDC_SESSION3.XLS'.
filename = w_path.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = filename
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 5
I_END_ROW = 3
TABLES
INTERN = IT_EXCEL
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
2013 Jun 06 7:31 AM
i have entered only 5 entries and i closed the the excel sheet also but the same error is showing
2013 Jun 06 7:34 AM
this bdc session name is not showing in the bdc log session overview by enter sm35 tcode.how can i see this session log??
2013 Jun 06 7:16 AM
Hi Kaustav,
Function module ALSM_EXCEL_TO_INTERNAL TABLE uses OLE functionality for creating the spred sheet. I am afraid that ole functionality can not be run in background mode very similar to gui_upload or gui_download.
You may have to look for other alternatives to get the data into internal table from the file.
Hope this helps,
~Athreya
2013 Jun 06 7:33 AM
2013 Jun 06 7:46 AM
You FM TEXT_CONVERT_XLS_TO_SAP instead of ALSM_EXCEL_TO_INTERNAL_TABLE.
It is simpler to use and accepts both XL & notepad as medium of inputs.
use where used list for how to use this FM or check below link
2013 Jun 06 7:56 AM
now the dump error is solved but when i use the bdc session overview and i enter sm35t code and enter the session name and the error is still showing
2013 Jun 06 9:03 AM
Can u paste screen shot of error or give some details what error it is showing
2013 Jun 06 6:39 PM
i am getting a runtime error after executing this bdc seesion program
exception condition "upload_ole" raised
the following program code is given below:----->
report ZBDC_SESSION3
no standard page heading line-size 255.
*include bdcrecx1.
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MATNR,
MBRSH TYPE MBRSH,
MTART TYPE MTART,
MAKTX TYPE MAKTX,
MEINS TYPE MEINS,
END OF TY_MARA.
DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE,
WA_EXCEL TYPE ALSMEX_TABLINE.
DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
start-of-selection.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'C:\Documents and Settings\Administrator\Desktop\BDC_SESSION3.XLS'
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 5
I_END_ROW = 3
TABLES
INTERN = IT_EXCEL
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*perform open_group.LOOP AT IT_EXCEL INTO WA_EXCEL.CASE WA_EXCEL-COL.WHEN '0001'. WA_MARA-MATNR = WA_EXCEL-VALUE.WHEN '0002'. WA_MARA-MBRSH = WA_EXCEL-VALUE.WHEN '0003'. WA_MARA-MTART = WA_EXCEL-VALUE.WHEN '0004'. WA_MARA-MAKTX = WA_EXCEL-VALUE.WHEN '0005'. WA_MARA-MEINS = WA_EXCEL-VALUE. AT END OF ROW. APPEND WA_MARA TO IT_MARA.
CALL FUNCTION 'BDC_OPEN_GROUP'EXPORTING CLIENT = SY-MANDT* DEST = FILLER8 GROUP = 'ZKUMAR'* HOLDDATE = FILLER8 KEEP = 'X' USER = SY-UNAME* RECORD = FILLER1 PROG = SY-CPROG* DCPFM = '%'* DATFM = '%'* IMPORTING* QID =* EXCEPTIONS* CLIENT_INVALID = 1* DESTINATION_INVALID = 2* GROUP_INVALID = 3* GROUP_IS_LOCKED = 4* HOLDDATE_INVALID = 5* INTERNAL_ERROR = 6* QUEUE_ERROR = 7* RUNNING = 8* SYSTEM_LOCK_ERROR = 9* USER_INVALID = 10* OTHERS = 11 .IF SY-SUBRC <> 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
LOOP AT IT_MARA INTO WA_MARA. CLEAR BDCDATA. REFRESH BDCDATA. performbdc_dynpro using 'SAPLMGMM' '0060'.performbdc_field using 'BDC_CURSOR''RMMG1-MTART'.performbdc_field using 'BDC_OKCODE''/00'.performbdc_field using 'RMMG1-MATNR'WA_MARA-MATNR."'MIRINDA'.performbdc_field using 'RMMG1-MBRSH'WA_MARA-MBRSH."'F'.performbdc_field using 'RMMG1-MTART'WA_MARA-MTART."'FGTR'.performbdc_dynpro using 'SAPLMGMM' '0070'.performbdc_field using 'BDC_CURSOR''MSICHTAUSW-DYTXT(01)'.performbdc_field using 'BDC_OKCODE' '=ENTR'.performbdc_field using 'MSICHTAUSW-KZSEL(01)' 'X'.performbdc_dynpro using 'SAPLMGMM' '4004'.performbdc_field using 'BDC_OKCODE' '=BU'.performbdc_field using 'MAKT-MAKTX'WA_MARA-MAKTX."' COLD DRINK'.performbdc_field using 'BDC_CURSOR''MARA-MEINS'.performbdc_field using 'MARA-MEINS'WA_MARA-MEINS."'L'.performbdc_field using 'MARA-MTPOS_MARA' 'NORM'.*perform bdc_transaction using 'MM01'. *perform close_group. CALL FUNCTION 'BDC_INSERT' EXPORTING TCODE = 'MM01'* POST_LOCAL = NOVBLOCAL* PRINTING = NOPRINT* SIMUBATCH = ' '* CTUPARAMS = ' ' TABLES DYNPROTAB = BDCDATA* EXCEPTIONS* INTERNAL_ERROR = 1* NOT_OPEN = 2* QUEUE_ERROR = 3* TCODE_INVALID = 4* PRINTING_INVALID = 5* POSTING_INVALID = 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.
CALL FUNCTION 'BDC_CLOSE_GROUP'* EXCEPTIONS* NOT_OPEN = 1* QUEUE_ERROR = 2* OTHERS = 3 .IF SY-SUBRC <> 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*----------------------------------------------------------------------** Start new screen **----------------------------------------------------------------------*FORM BDC_DYNPRO USING PROGRAM DYNPRO. CLEAR BDCDATA.BDCDATA-PROGRAM = PROGRAM.BDCDATA-DYNPRO = DYNPRO. BDCDATA-DYNBEGIN = 'X'. APPEND BDCDATA.
*----------------------------------------------------------------------** Insert field **----------------------------------------------------------------------*FORM BDC_FIELD USING FNAM FVAL.* IF FVAL <> NODATA. CLEAR BDCDATA. BDCDATA-FNAM = FNAM. BDCDATA-FVAL = FVAL. APPEND BDCDATA.* ENDIF.
2013 Jun 06 7:53 AM
Hi Kaustav,
Use this FM to Upload File into Internal table "UPLOAD_FILES" .
Regard's
Smruti