Application Development 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: 

Error in BDC session Insert.....

Former Member
0 Kudos

Hi All,

Guys iam running BDC pgm for MEK1 create condition records transaction and i get an error while executing through BDC_INSERT. Its an internal error with text "Error in BDC session Insert..".The text file iam using contains 26 line items for the first contract created earlier and 30 line items for the second record. My concern is it only happens for this text file with multiple or more line items.

While debugging i have observed that after the session has been created the first bdc insert goes well for the first header record and then it fails for the second record with an internal error "Error in BDC session Insert..".

Does anyone have enountered such issue before or is it related to limited number of line items in MEK1 transaction.

Any help would be appreciated.

Thanks,

Avinash

3 REPLIES 3

Former Member
0 Kudos

report ZSESSION1

no standard page heading line-size 255.

*include bdcrecx1.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .

TYPES: BEGIN OF TYP_STU,

Z_STUDID TYPE ZSTUD1-Z_STUDID,

Z_STUDNAME TYPE ZSTUD1-Z_STUDNAME,

Z_STUDAGE TYPE ZSTUD1-Z_STUDAGE,

END OF TYP_STU.

DATA: IT_STU TYPE STANDARD TABLE OF TYP_STU,

GW_STU TYPE TYP_STU,

V_PATH TYPE STRING.

PARAMETERS SUREN TYPE IBIPPARMS-PATH OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR SUREN .

PERFORM GETFILE USING SUREN.

V_PATH = SUREN.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = V_PATH

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_STU

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.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'SESSION1'

  • 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.

ENDIF.

START-OF-SELECTION.

LOOP AT IT_STU INTO GW_STU.

REFRESH BDCDATA.

*perform open_group.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-TBMA_VAL'.

perform bdc_field using 'BDC_OKCODE'

'=EDIT'.

perform bdc_field using 'RSRD1-TBMA'

'X'.

perform bdc_field using 'RSRD1-TBMA_VAL'

'ZSTUD1'.

perform bdc_dynpro using 'SAPLSD41' '2200'.

perform bdc_field using 'BDC_CURSOR'

'DD02D-DDTEXT'.

perform bdc_field using 'BDC_OKCODE'

'=TDED'.

perform bdc_field using 'DD02D-DDTEXT'

'Stud details'.

perform bdc_dynpro using '/1BCDWB/DBZSTUD1' '0101'.

perform bdc_field using 'BDC_CURSOR'

'ZSTUD1-Z_STUDAGE'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_field using 'ZSTUD1-Z_STUDID'

GW_STU-Z_STUDID .

perform bdc_field using 'ZSTUD1-Z_STUDNAME'

GW_STU-Z_STUDNAME .

perform bdc_field using 'ZSTUD1-Z_STUDAGE'

GW_STU-Z_STUDAGE .

perform bdc_dynpro using '/1BCDWB/DBZSTUD1' '0101'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'ZSTUD1-Z_STUDID'.

perform bdc_dynpro using 'SAPLSD41' '2200'.

perform bdc_field using 'BDC_CURSOR'

'DD02D-DDTEXT'.

perform bdc_field using 'BDC_OKCODE'

'=WB_BACK'.

perform bdc_field using 'DD02D-DDTEXT'

'Stud details'.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-TBMA_VAL'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'RSRD1-TBMA'

'X'.

perform bdc_field using 'RSRD1-TBMA_VAL'

'ZSTUD1'.

*perform bdc_transaction using 'SE11'.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'SE11'

  • 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.

ENDIF.

ENDLOOP.

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.

ENDIF.

*ENDLOOP.

*perform close_group.

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0207 text

  • -->P_0208 text

----


*FORM bdc_dynpro USING VALUE(P_0207)

  • VALUE(P_0208).

*

*ENDFORM. " bdc_dynpro

*

FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM. "BDC_DYNPRO

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0212 text

  • -->P_0213 text

----


*FORM bdc_field USING VALUE(P_0212)

  • VALUE(P_0213).

*

*ENDFORM. " bdc_field

FORM BDC_FIELD USING FNAM FVAL.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDFORM .

FORM GETFILE USING SUREN.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = SUREN.

ENDFORM.

former_member404244
Active Contributor
0 Kudos

Hi,

are u refreshing the BDC DATA after one each record...

Loop at itab.

Perform bdc_insert.

refresh : bdcdata.

endloop.

Regards,

Nagaraj

0 Kudos

Hi Nagaraj,

Yes i have been performing refresh in the common include which iam using as well as in the program. But not able to figure out why BDC INSERT is failing for the second record as the first one goes through well.

Thanks

Avinash