* _______ _______ _______ _______ _______ _______ ______ _______ _______ ______ _______ * | _ | _ | _ | | | _ | || _ | _ | _ | | _ | * | |_| | |_| | |_| | _ | | |_| | _ | |_| | |_| | | || | |_| | * | | | | |_| | | | | | | | | |_||_| | * | | _ || | ___| _| | |_| | | _ || __ | | * | _ | |_| | _ | | | |_| _ | | _ | |_| | | | | _ | * |__| |__|_______|__| |__|___| |_______|__| |__|______||__| |__|_______|___| |_|__| |__| * www.abapcadabra.com * *------------------------------------------------------------------------------------------- * program : ZABAPCADABRA_BDC_GROUPS * title : Example report - create BDC session for the Session overview * functional area : X-component * environment : 4.7 * program Function : This simple report creates a BDC session in a group, which * will be available in the SHDB Transaction recorder: Recording * overview * Documentation : Search for "BDC group" on AbapcadabrA.com * Previous version : This is the initial version * Developer name : Wim Maasdam * Development date : 26-02-2015 * Version : 0.1 *--------------------------------------------------------------------- REPORT ZABAPCADABRA_BDC_GROUPS. DATA: lt_bdcdata TYPE STANDARD TABLE OF bdcdata, lw_bdcdata TYPE bdcdata, lv_group TYPE APQI-GROUPID VALUE 'ABAPCADABRA'. * bdc_add 'X' 'PROGRAM_NAME' 'SCREEN NUMBER'. * bdc_add ' ' 'FIELDNAME' 'FIELDVALUE'. DEFINE bdc_add. CLEAR lw_bdcdata. lw_bdcdata-dynbegin = &1. IF &1 EQ 'X'. lw_bdcdata-PROGRAM = &2. lw_bdcdata-DYNPRO = &3. ELSE. lw_bdcdata-fnam = &2. lw_bdcdata-fval = &3. ENDIF. APPEND lw_bdcdata TO lt_bdcdata. END-OF-DEFINITION. * Compose an example BDC session - CLEAR: lt_bdcdata[]. bdc_add: 'X' 'SAPLWBABAP' '0100', ' ' 'RS38M-PROGRAMM' 'SHOWCOLO', ' ' 'BDC_OKCODE' '=SHOP'. AUTHORITY-CHECK OBJECT 'S_TCODE' ID 'TCD' FIELD 'SHDB'. if sy-subrc <> 0. message 'SHDB authorisation is required.' type 'E'. endif. CALL FUNCTION 'BDC_OPEN_GROUP' EXPORTING GROUP = lv_group "Session group name KEEP = ' ' "< Session data is stored even " after it was fully processed USER = SY-UNAME "This user will need to be "authorised for the actions RECORD = 'X' "< Set this indicator to make "the recording available in the "SHDB - Recording overview EXCEPTIONS OTHERS = 4. IF SY-SUBRC = 0. * Simulate a certain number of separate BDC sessions, * not necessarily for the same transaction: DO 10 TIMES. * Implement suitable error handling here CALL FUNCTION 'BDC_INSERT' EXPORTING TCODE = 'SE38' TABLES DYNPROTAB = lt_bdcdata EXCEPTIONS OTHERS = 4. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. ENDDO. CALL FUNCTION 'BDC_CLOSE_GROUP' EXCEPTIONS OTHERS = 0. ENDIF.