‎2007 Jun 27 5:09 PM
Hi experts, i'm trying to create BDC session and i'm getting this error can anyone help please its urgent? I've written the code and when i wan to run the programme it gives me the error below. Please help
BDC_OPEN_GROUP, create session .TEST. not allowed, as last session is still active
Thank you in advance
Tatenda I H Chaibva
‎2007 Jun 27 5:10 PM
Are you closing the session in the end by using BDC_CLOSE_GROUP?
Regards,
Amit
Reward all helpful replies.
‎2007 Jun 27 5:20 PM
This is the program, i tried to keep it simple as i am still learning!
*Upload of Vendors into system
Report ZVEN_UPD
no standard page heading line-size 255.
parameters: pfile type rlgrap-filename.
data: pfile1 type string.
parameters title like LFA1-ANRED.
TYPES: begin of t_datatab ,
vendor_name(35),
search_term(10),
vendor_addrs(35),
box_num(10),
city(35),
vat_num(20),
bank_branch(15),
acc_number(18),
contact_1name(35),
tel_num(16),
end of t_datatab.
data: begin of t_datatabfinal occurs 0,
vendor_name(35),
search_term(10),
vendor_addrs(35),
box_num(10),
city(35),
vat_num(20),
bank_branch(15),
acc_number(18),
contact_1name(35),
tel_num(16),
end of t_datatabfinal.
DATA: it_datatab TYPE STANDARD TABLE OF t_datatab,
wa_datatab TYPE t_datatab.
DATA: wa_record TYPE t_datatab,
it_record TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0.
*DATA: it_raw TYPE truxs_t_text_data.
DATA: itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA: gd_currentrow TYPE i.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PFILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'PFILE'
IMPORTING
file_name = pfile.
data: itab like ALSMEX_TABLINE occurs 0 with header line.
*pfile1 = pfile.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = pfile
I_BEGIN_COL = '1'
I_BEGIN_ROW = '2' "Column header not required
I_END_COL = '10'
I_END_ROW = '5'
TABLES
INTERN = itab
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.
ENDIF.
Sort table by rows and colums
SORT itab BY row col.
Get first row retrieved
READ TABLE itab INDEX 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
LOOP AT itab.
Reset values for next row
IF itab-row NE gd_currentrow.
APPEND wa_datatab TO it_record.
CLEAR wa_datatab.
gd_currentrow = itab-row.
ENDIF.
CASE itab-col.
WHEN '0001'.
wa_datatab-vendor_name = itab-value.
WHEN '0002'.
wa_datatab-search_term = itab-value.
WHEN '0003'.
wa_datatab-city = itab-value.
WHEN '0004'.
wa_datatab-box_num = itab-value.
WHEN '0005'.
wa_datatab-vendor_addrs = itab-value.
WHEN '0006'.
wa_datatab-vat_num = itab-value.
WHEN '0007'.
wa_datatab-bank_branch = itab-value.
WHEN '0008'.
wa_datatab-acc_number = itab-value.
WHEN '0009'.
wa_datatab-contact_1name = itab-value.
WHEN '0010'.
wa_datatab-tel_num = itab-value.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
APPEND wa_datatab TO it_record.
LOOP AT it_record INTO t_datatabfinal.
APPEND t_datatabfinal.
ENDLOOP.
perform open_group.
include bdcrecx1.
start-of-selection.
refresh bdcdata.
clear bdcdata.
loop at t_datatabfinal.
perform open_group.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-BUKRS'
'2000'.
perform bdc_field using 'RF02K-EKORG'
'1000'.
perform bdc_field using 'RF02K-KTOKK'
'LC01'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-ANRED'
title.
'Company'.
perform bdc_field using 'LFA1-NAME1'
t_datatabfinal-vendor_name.
'Africaonline'.
perform bdc_field using 'LFA1-SORTL'
t_datatabfinal-search_term.
'AOL'.
perform bdc_field using 'LFA1-STRAS'
t_datatabfinal-vendor_addrs.
'2nd Fl Goldbrigde south Eastgate'.
perform bdc_field using 'LFA1-PFACH'
t_datatabfinal-box_num.
'A1571'.
perform bdc_field using 'LFA1-ORT01'
t_datatabfinal-city.
'Harare'.
perform bdc_field using 'LFA1-PSTLZ'
'263'.
perform bdc_field using 'LFA1-LAND1'
'ZW'.
perform bdc_field using 'LFA1-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-STCEG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-KUNNR'
''.
perform bdc_field using 'LFA1-STCEG'
t_datatabfinal-vat_num.
'10001771'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKL(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'LFBK-BANKS(01)'
'zw'.
perform bdc_field using 'LFBK-BANKL(01)'
t_datatabfinal-bank_branch.
perform bdc_field using 'LFBK-BANKN(01)'
t_datatabfinal-acc_number.
'0100205020700'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0380'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-TELF1(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'KNVK-NAMEV(01)'
t_datatabfinal-contact_1name.
'Sydney'.
perform bdc_field using 'KNVK-NAME1(01)'
t_datatabfinal-contact_1name.
'Sydney'.
perform bdc_field using 'KNVK-TELF1(01)'
t_datatabfinal-tel_num.
'250890-8'.
perform bdc_dynpro using 'SAPMF02K' '0380'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZUAWA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
'160000'.
perform bdc_field using 'LFB1-ZUAWA'
'001'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-REPRF'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-ZTERM'
'0001'.
perform bdc_field using 'LFB1-REPRF'
'X'.
perform bdc_field using 'LFB1-ZWELS'
'ce'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-BUSAB'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-BUSAB'
''.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WEBRE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
'zwd'.
perform bdc_field using 'LFM1-ZTERM'
''.
perform bdc_field using 'LFM1-WEBRE'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_transaction using 'XK01'.
perform close_group.
‎2007 Jun 27 5:24 PM
You code is still not enought to get the problem since subroutines are missing.
Refer this code and find the difference between the two.
http://www.sap-img.com/abap/bdc-program-for-purchase-info-records.htm
Regards,
Amit
Reward all helpful replies.
‎2007 Jun 27 5:30 PM
I've awarded you points, I didn't change anything in the subroutines, i just copied from a working one and then edited the respective fields, into the recording i had made!
‎2007 Jun 27 5:48 PM
‎2007 Jun 27 5:56 PM
Hi
try to give someother name for session name. Dont use Test. Its not advisible to use. I think there is same session name is in active stage. Thats y u got this error. U can process that session and then try to create the same session by running session method.
reward me if its helpful.
Regards
Ravi