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

help me with this error

Former Member
0 Likes
285

hi to all experts,

im getting this error when i use session method

error is bdc_insert session can't be opened

HERE IS MY CODE

report ZMAT_UPLOAD

no standard page heading line-size 255.

****************************************************

types declaration********************************

***************************************************

TYPES : BEGIN OF TY_MAT,

MATNR(18),

MBRSH(1),

MTART(4),

MAKTX(40),

MEINS(3),

END OF TY_MAT.

DATA: IT_MAT TYPE TABLE OF TY_MAT,

WA_MAT LIKE LINE OF IT_MAT.

include bdcrecx1.

************************************************************

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\FF.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = ''

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = 'DAT'

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TR2UE

  • REPLACEMENT = ','

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_MAT

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17

.

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 IT_MAT INTO WA_MAT.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MTART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

WA_MAT-MATNR.

perform bdc_field using 'RMMG1-MBRSH'

WA_MAT-MBRSH .

perform bdc_field using 'RMMG1-MTART'

WA_MAT-MTART .

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'MAKT-MAKTX'

WA_MAT-MAKTX .

perform bdc_field using 'BDC_CURSOR'

'MARA-MEINS'.

perform bdc_field using 'MARA-MEINS'

WA_MAT-MEINS .

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

perform bdc_transaction using 'MM01'.

perform close_group.

ENDLOOP.

1 REPLY 1
Read only

Former Member
0 Likes
237

look at the Statement before ending loop;

perform close_group.

you shouldn't end-up your session till the last record data,

check the same by replacing the above function after ENDLOOP statement

and grant me the points accordingly