Vous êtes sur la page 1sur 17

*Code listing for: ZFIBDCFB01 *Description: BDC FOR T-CODE FB01 (Posting Document.

)-------------------------------------------------------------------------------

REPORT zfibdcfb01 NO STANDARD PAGE HEADING LINE-SIZE 255. *----------------------------------------------------------------------* * TYPES * *----------------------------------------------------------------------* TYPES : BEGIN OF ty_file, counter1(10) TYPE c, bldat(10) TYPE c, budat(10) TYPE c, blart TYPE bkpf-blart, bukrs TYPE bkpf-bukrs, waers TYPE bkpf-waers, monat(2) TYPE c, xblnr TYPE bkpf-xblnr, bktxt TYPE bkpf-bktxt, xmwst TYPE bkpf-xmwst, counter2(10) TYPE c, newbs TYPE rf05a-newbs, newko TYPE rf05a-newko, newum TYPE rf05a-newum, newbw TYPE rf05a-newbw, newbk TYPE rf05a-newbk, wrbtr(16) TYPE c, menge(17) TYPE c, meins TYPE bseg-meins, mwskz TYPE bseg-mwskz, gsber TYPE bseg-gsber, zterm TYPE bseg-zterm, zfbdt(10) TYPE c, valut(10) TYPE c, bzdat(10) TYPE c, zuonr TYPE bseg-zuonr, sgtxt TYPE bseg-sgtxt, prctr TYPE bseg-prctr, zzchan TYPE bseg-zzchan, kostl TYPE cobl-kostl, aufnr TYPE cobl-aufnr, ps_posid TYPE cobl-ps_posid, anln1 TYPE cobl-anln1, segment TYPE cobl-segment, pernr TYPE cobl-pernr, fkber TYPE cobl-fkber, rmvct TYPE rmvct, ZZVERTICAL TYPE COBL-ZZVERTICAL, ZZPARTNER TYPE COBL-ZZPARTNER, regul TYPE rf05a-regul, empfb TYPE bseg-empfb, xref1 TYPE bseg-xref1, xref2 TYPE bseg-xref2,

* *

xref3 TYPE bseg-xref3, vbund TYPE rassc, anred TYPE bsec-anred, name1 TYPE bsec-name1, name2 TYPE bsec-name2, stras TYPE bsec-stras, pfach TYPE bsec-pfach, pstl2 TYPE bsec-pstl2, ort01 TYPE bsec-ort01, pstlz TYPE bsec-pstlz, regio TYPE bsec-regio, land1 TYPE bsec-land1, banks TYPE bsec-banks, wt_withcd1 TYPE with_item-wt_withcd, wt_base1(20) TYPE c, wt_amount1(20) TYPE c, wt_withcd2 TYPE with_item-wt_withcd, wt_base2(20) TYPE c, wt_amount2(20) TYPE c, wt_withcd3 TYPE with_item-wt_withcd, wt_base3(20) TYPE c, wt_amount3(20) TYPE c, wt_withcd4 TYPE with_item-wt_withcd, wt_base4(20) TYPE c, wt_amount4(20) TYPE c, wt_withcd5 TYPE with_item-wt_withcd, wt_base5(20) TYPE c, wt_amount5(20) TYPE c, END OF ty_file. TYPES : BEGIN OF ty_bdc, counter2(10) TYPE c, newbs TYPE rf05a-newbs, newko TYPE rf05a-newko, newum TYPE rf05a-newum, newbw TYPE rf05a-newbw, *Included by Amar{ newbk TYPE rf05a-newbk, *End wrbtr(16) TYPE c, menge(17) TYPE c, meins TYPE bseg-meins, mwskz TYPE bseg-mwskz, gsber TYPE bseg-gsber, zterm TYPE bseg-zterm, zfbdt(10) TYPE c, valut(10) TYPE c, bzdat(10) TYPE c, zuonr TYPE bseg-zuonr, sgtxt TYPE bseg-sgtxt, prctr TYPE bseg-prctr, * zzchan TYPE bseg-zzchan, kostl TYPE cobl-kostl, aufnr TYPE cobl-aufnr, ps_posid TYPE cobl-ps_posid, anln1 TYPE cobl-anln1, segment TYPE cobl-segment, pernr TYPE cobl-pernr, fkber TYPE cobl-fkber, rmvct TYPE rmvct,

* *

ZZVERTICAL TYPE COBL-ZZVERTICAL, ZZPARTNER TYPE COBL-ZZPARTNER, regul TYPE rf05a-regul, empfb TYPE bseg-empfb, xref1 TYPE bseg-xref1, xref2 TYPE bseg-xref2, xref3 TYPE bseg-xref3, vbund TYPE rassc, anred TYPE bsec-anred, name1 TYPE bsec-name1, name2 TYPE bsec-name2, stras TYPE bsec-stras, pfach TYPE bsec-pfach, pstl2 TYPE bsec-pstl2, ort01 TYPE bsec-ort01, pstlz TYPE bsec-pstlz, regio TYPE bsec-regio, land1 TYPE bsec-land1, banks TYPE bsec-banks, wt_withcd1 TYPE with_item-wt_withcd, wt_base1(20) TYPE c, wt_amount1(20) TYPE c, wt_withcd2 TYPE with_item-wt_withcd, wt_base2(20) TYPE c, wt_amount2(20) TYPE c, wt_withcd3 TYPE with_item-wt_withcd, wt_base3(20) TYPE c, wt_amount3(20) TYPE c, wt_withcd4 TYPE with_item-wt_withcd, wt_base4(20) TYPE c, wt_amount4(20) TYPE c, wt_withcd5 TYPE with_item-wt_withcd, wt_base5(20) TYPE c, wt_amount5(20) TYPE c, END OF ty_bdc.

*----------------------------------------------------------------------* * DATA * *----------------------------------------------------------------------* DATA : it_bdc TYPE TABLE OF ty_bdc WITH HEADER LINE, it_file TYPE TABLE OF ty_file WITH HEADER LINE, g_flag TYPE char1, g_flag_1 TYPE char1, g_wrbtr(16) TYPE c, g_menge(17) TYPE c, * g_counter1(10) TYPE c, g_wt_subjct TYPE lfbw-wt_subjct, g_lifnr TYPE lfbw-lifnr, g_lifnr_1 TYPE p LENGTH 16, g_umsks TYPE t074u-umsks, wa_t074u TYPE t074u. CONSTANTS: c_31 c_21 c_29 c_39 c_25 c_35 c_01 c_11 TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE char3 char3 char3 char3 char3 char3 char3 char3 VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE '31', '21', '29', '39', '25', '35', '01', '11',

c_05 TYPE char3 VALUE '05', c_15 TYPE char3 VALUE '15', c_09 TYPE char3 VALUE '09', c_19 TYPE char3 VALUE '19', c_a TYPE char1 VALUE 'A', c_f TYPE char1 VALUE 'F', c_d TYPE char1 VALUE 'D', c_k TYPE char1 VALUE 'K', c_x TYPE char1 VALUE 'X', c_40 TYPE char3 VALUE '40', c_50 TYPE char3 VALUE '50', c_70 TYPE char3 VALUE '70'.

INCLUDE bdcrecx1. *----------------------------------------------------------------------* * SELECTION SCREEN * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000. PARAMETERS : p_fname TYPE string OBLIGATORY DEFAULT 'c:\TMP.TXT', p_ftype TYPE char10 OBLIGATORY DEFAULT 'ASC'. SELECTION-SCREEN COMMENT /1(60) text-001 MODIF ID txt. SELECTION-SCREEN COMMENT /1(60) text-003 MODIF ID pk. SELECTION-SCREEN END OF BLOCK b1.

*----------------------------------------------------------------------* * INITIALIZATION * *----------------------------------------------------------------------* INITIALIZATION. nodata = space. PERFORM f_authority_check. *----------------------------------------------------------------------* * AT SELECTION SCREEN * *----------------------------------------------------------------------* AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. IF screen-group1 = 'TXT' OR screen-group1 = 'PK'. screen-intensified = 1. MODIFY SCREEN. ENDIF. ENDLOOP. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname. CALL FUNCTION 'WS_FILENAME_GET' EXPORTING mask = ',*.*,*.*.'

IMPORTING filename = p_fname EXCEPTIONS inv_winsys = 1 no_batch = 2 selection_cancel = 3 selection_error = 4 OTHERS = 5. 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 * *----------------------------------------------------------------------* START-OF-SELECTION. CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename filetype has_field_separator HEADER_LENGTH = READ_BY_LINE = DAT_MODE = CODEPAGE = IGNORE_CERR = REPLACEMENT = CHECK_BOM = VIRUS_SCAN_PROFILE = NO_AUTH_CHECK = IMPORTING FILELENGTH = HEADER = TABLES data_tab EXCEPTIONS file_open_error file_read_error no_batch gui_refuse_filetransfer invalid_type no_authority unknown_error bad_data_format header_not_allowed separator_not_allowed header_too_long unknown_dp_error access_denied dp_out_of_memory disk_full dp_timeout OTHERS . IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty

= p_fname = p_ftype = 'X' 0 'X' ' ' ' ' ABAP_TRUE '#' ' ' ' '

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

= it_file[] = = = = = = = = = = = = = = = = = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. DELETE it_file INDEX 1. * break-point. LOOP AT it_file. MOVE-CORRESPONDING it_file TO it_bdc. APPEND it_bdc. ENDLOOP. DELETE it_file WHERE counter1 IS INITIAL. SORT it_file BY counter1. *Modified by Amar{on 12.04.2010 * SORT it_bdc BY counter2 newbs newko. SORT it_bdc BY counter2 newbk. *End of Modification} TYPES : BEGIN OF ty_blart, blart TYPE blart, END OF ty_blart, BEGIN OF ty_t003, blart TYPE blart, xgsub TYPE xgsub, xmges TYPE xmges, END OF ty_t003. DATA : it_blart TYPE STANDARD TABLE OF ty_blart, it_t003 TYPE STANDARD TABLE OF ty_t003, l_flag_blart TYPE char1, wa_t003 TYPE ty_t003, wa_blart TYPE ty_blart. LOOP AT it_file. wa_blart-blart = it_file-blart. APPEND wa_blart TO it_blart. CLEAR wa_blart. ENDLOOP. SORT it_blart BY blart. DELETE ADJACENT DUPLICATES FROM it_blart COMPARING blart. SELECT blart xgsub xmges FROM t003 INTO TABLE it_t003 FOR ALL ENTRIES IN it_blart WHERE blart = it_blart-blart. *include bdcrecx1. *start-of-selection. PERFORM open_group. LOOP AT it_file. CLEAR l_flag_blart. READ TABLE it_t003 INTO wa_t003 WITH KEY blart = it_file-blart.

IF sy-subrc = 0. IF wa_t003-xgsub = 'X' AND wa_t003-xmges = 'X'. l_flag_blart = 'X'. ENDIF. ENDIF. *INCLUDE bdcrecx1. *START-OF-SELECTION. *perform open_group. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field USING 'SAPMF05A' '0100'. USING 'BDC_CURSOR' 'RF05A-NEWUM'. USING 'BDC_OKCODE' '/00'. USING 'BKPF-BLDAT' it_file-bldat. USING 'BKPF-BLART' it_file-blart. USING 'BKPF-BUKRS' it_file-bukrs. USING 'BKPF-BUDAT' it_file-budat. USING 'BKPF-MONAT' it_file-monat. USING 'BKPF-WAERS' it_file-waers. USING 'BKPF-XBLNR' it_file-xblnr. USING 'BKPF-BKTXT' it_file-bktxt.

READ TABLE it_bdc WITH KEY counter2 = it_file-counter1 BINARY SEARCH. IF sy-subrc = 0. LOOP AT it_bdc FROM sy-tabix . IF it_bdc-counter2 NE it_file-counter1. EXIT. ENDIF. WRITE it_bdc-wrbtr TO g_wrbtr RIGHT-JUSTIFIED. WRITE it_bdc-menge TO g_menge RIGHT-JUSTIFIED. PERFORM bdc_field USING 'RF05A-NEWBS' it_bdc-newbs. PERFORM bdc_field USING 'RF05A-NEWKO' it_bdc-newko. PERFORM bdc_field USING 'RF05A-NEWUM' it_bdc-newum. PERFORM bdc_field USING 'RF05A-NEWBW' it_bdc-newbw. PERFORM bdc_field USING 'RF05A-NEWBK' it_bdc-newbk. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = it_bdc-newko IMPORTING output = it_bdc-newko. IF it_bdc-newbs = c_31 OR it_bdc-newbs = c_21 OR it_bdc-newbs = c_29 OR

it_bdc-newbs = c_39 OR it_bdc-newbs = c_25 OR it_bdc-newbs = c_35 OR it_bdc-newbs = c_0 1 OR it_bdc-newbs = c_11 OR it_bdc-newbs = c_05 OR it_bdc-newbs = c_15 OR it_bdc-newbs = c_0 9 OR it_bdc-newbs = c_19. IF it_bdc-newko CO ' 0123456789'. g_lifnr_1 = it_bdc-newko. ENDIF. IF g_lifnr_1 BETWEEN 6100000000 AND 6199999999. PERFORM bdc_dynpro USING 'SAPLFCPD' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'BSEC-STRAS'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'BSEC-ANRED' it_bdc-anred. PERFORM bdc_field USING 'BSEC-SPRAS' 'EN'. PERFORM bdc_field USING 'BSEC-NAME1' it_bdc-name1. PERFORM bdc_field USING 'BSEC-NAME2' it_bdc-name2. PERFORM bdc_field USING 'BSEC-STRAS' it_bdc-stras. PERFORM bdc_field USING 'BSEC-PFACH' it_bdc-pfach. PERFORM bdc_field USING 'BSEC-PSTL2' it_bdc-pstl2. PERFORM bdc_field USING 'BSEC-ORT01' it_bdc-ort01. PERFORM bdc_field USING 'BSEC-PSTLZ' it_bdc-pstlz. PERFORM bdc_field USING 'BSEC-REGIO' it_bdc-regio. PERFORM bdc_field USING 'BSEC-LAND1' it_bdc-land1. PERFORM bdc_field USING 'BSEC-BANKS' it_bdc-banks. ENDIF. IF it_bdc-newbs = c_31 OR it_bdc-newbs = c_21 OR it_bdc-newbs = c_25 O R it_bdc-newbs = c_35. PERFORM bdc_dynpro USING 'SAPMF05A' '0302'. PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-NEWBS'. PERFORM bdc_field USING 'BDC_OKCODE' '=ZK'. PERFORM bdc_field USING 'BSEG-WRBTR' g_wrbtr. IF g_flag_1 = ' '. PERFORM bdc_field USING 'BKPF-XMWST' it_file-xmwst. ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field USING 'BSEG-MWSKZ' it_bdc-mwskz. ENDIF. PERFORM bdc_field USING 'BSEG-GSBER'

PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field * * * * PERFORM bdc_field PERFORM bdc_field ENDIF.

it_bdc-gsber. USING 'BSEG-ZTERM' it_bdc-zterm. USING 'BSEG-ZFBDT' it_bdc-zfbdt. USING 'RF05A-REGUL' it_bdc-regul. USING 'BSEG-EMPFB' it_bdc-empfb. USING 'BSEG-ZUONR' it_bdc-zuonr. USING 'BSEG-SGTXT' it_bdc-sgtxt. USING 'BSEG-PRCTR' it_bdc-prctr. USING 'BSEG-ZZCHAN' it_bdc-zzchan.

IF it_bdc-newbs = c_39 OR it_bdc-newbs = c_29 OR it_bdc-newbs = c_09 OR it_bdc-newbs = c_19. * SELECT SINGLE umsks INTO g_umsks FROM t074u WHERE koart = C_K AND u mskz = it_bdc-newum. CALL FUNCTION 'FM_FMCJ_T074U_READ' EXPORTING i_koart = c_k i_umskz = it_bdc-newum IMPORTING e_f_t074u = wa_t074u EXCEPTIONS not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. IF wa_t074u-umsks <> c_a. PERFORM bdc_dynpro USING 'SAPMF05A' '0303'. ELSE. PERFORM bdc_dynpro USING 'SAPMF05A' '0304'. ENDIF. PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. '=ZK'. PERFORM bdc_field USING 'BSEG-WRBTR' g_wrbtr. IF g_flag_1 = ' '. PERFORM bdc_field USING 'BKPF-XMWST' it_file-xmwst. ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field USING 'BSEG-MWSKZ' it_bdc-mwskz. ENDIF. PERFORM bdc_field USING 'BSEG-GSBER'

PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field * * PERFORM bdc_field ENDIF.

it_bdc-gsber. USING 'BSEG-ZFBDT' it_bdc-zfbdt. USING 'BSEG-ZUONR' it_bdc-zuonr. USING 'BSEG-SGTXT' it_bdc-sgtxt. USING 'BSEG-PRCTR' it_bdc-prctr.

IF it_bdc-newbs = c_01 OR it_bdc-newbs = c_11 OR it_bdc-newbs = c_05 O R it_bdc-newbs = c_15. PERFORM bdc_dynpro USING 'SAPMF05A' '0301'. PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'BSEG-WRBTR' g_wrbtr. IF g_flag_1 = ' '. PERFORM bdc_field USING 'BKPF-XMWST' it_file-xmwst. ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field USING 'BSEG-MWSKZ' it_bdc-mwskz. ENDIF. PERFORM bdc_field USING 'BSEG-GSBER' it_bdc-gsber. PERFORM bdc_field USING 'BSEG-ZFBDT' it_bdc-zfbdt. PERFORM bdc_field USING 'BSEG-ZUONR' it_bdc-zuonr. PERFORM bdc_field USING 'BSEG-SGTXT' it_bdc-sgtxt. * PERFORM bdc_field USING 'BSEG-PRCTR' * it_bdc-prctr. ENDIF. * IF ( it_bdc-newbs = c_29 AND it_bdc-newum = c_a ) OR ( it_bdc-newbs = c_09 AND it_bdc-newum = c_d ) OR * ( it_bdc-newbs = c_09 AND it_bdc-newum = c_f ) OR ( it_bdc-newbs = c_09 AND it_bdc-newum = c_k ) OR * ( it_bdc-newbs = c_19 AND it_bdc-newum = c_d ) OR ( it_bdc-newbs = c_19 AND it_bdc-newum = c_f ) OR * ( it_bdc-newbs = c_19 AND it_bdc-newum = c_k ) OR it_bdc-newbs = c _39 OR it_bdc-newbs = c_31 OR * it_bdc-newbs = c_21 OR it_bdc-newbs = c_01 OR it_bdc-newbs = c_11. IF ( it_bdc-newbs = c_09 AND it_bdc-newum = c_d ) OR ( it_bdc-newbs = c_09 AND it_bdc-newum = c_f ) OR ( it_bdc-newbs = c_09 AND it_bdc-newum = c_k ) OR ( it_bdc-newbs = c_19 AND it_bdc-newum = c_d ) OR ( it_bdc-newbs = c_19 AND it_bdc-newum = c_f ) OR ( it_bdc-newbs = c_19 AND it_bdc-newum = c_k ) OR it_bdc-newbs = c_ 31 OR it_bdc-newbs = c_21 OR it_bdc-newbs = c_01 OR it_bdc-newbs = c_11. g_lifnr = it_bdc-newko.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = g_lifnr IMPORTING output = g_lifnr. IF it_bdc-newbs = c_39 OR it_bdc-newbs = c_31 OR it_bdc-newbs = c_21 OR it_bdc-newbs = c_29. SELECT SINGLE wt_subjct FROM lfbw INTO g_wt_subjct WHERE lifnr = g _lifnr AND bukrs = it_file-bukrs AND wt_subjct = c_x. ELSE. SELECT SINGLE wt_agent FROM knbw INTO g_wt_subjct WHERE kunnr = g_ lifnr AND bukrs = it_file-bukrs AND wt_agent = c_x. ENDIF. IF sy-subrc = 0. g_flag = c_x. PERFORM bdc_dynpro USING 'SAPLFWTD' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'WITH_DIALG-WT_AMOUNT(01)'. PERFORM bdc_field USING 'BDC_OKCODE' '=GO'. ELSE. g_flag = ' '. ENDIF. IF g_flag = c_x. PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field ENDIF. ENDIF. USING 'WITH_ITEM-WT_WITHCD(01)' it_bdc-wt_withcd1. USING 'WITH_DIALG-WT_BASE(01)' it_bdc-wt_base1. USING 'WITH_DIALG-WT_AMOUNT(01)' it_bdc-wt_amount1. USING 'WITH_ITEM-WT_WITHCD(02)' it_bdc-wt_withcd2. USING 'WITH_DIALG-WT_BASE(02)' it_bdc-wt_base2. USING 'WITH_DIALG-WT_AMOUNT(02)' it_bdc-wt_amount2. USING 'WITH_ITEM-WT_WITHCD(03)' it_bdc-wt_withcd3. USING 'WITH_DIALG-WT_BASE(03)' it_bdc-wt_base3. USING 'WITH_DIALG-WT_AMOUNT(03)' it_bdc-wt_amount3. USING 'WITH_ITEM-WT_WITHCD(04)' it_bdc-wt_withcd4. USING 'WITH_DIALG-WT_BASE(04)' it_bdc-wt_base4. USING 'WITH_DIALG-WT_AMOUNT(04)' it_bdc-wt_amount4. USING 'WITH_ITEM-WT_WITHCD(05)' it_bdc-wt_withcd5. USING 'WITH_DIALG-WT_BASE(05)' it_bdc-wt_base5. USING 'WITH_DIALG-WT_AMOUNT(05)' it_bdc-wt_amount5.

IF it_bdc-regul = c_x AND ( it_bdc-newbs <> c_39 AND it_bdc-newbs <> c _29 AND it_bdc-newbs <> c_09 AND it_bdc-newbs <> c_19 ). PERFORM bdc_dynpro USING 'SAPLFCPD' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'BSEC-STRAS'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'BSEC-ANRED' it_bdc-anred. PERFORM bdc_field USING 'BSEC-SPRAS' 'EN'. PERFORM bdc_field USING 'BSEC-NAME1' it_bdc-name1. PERFORM bdc_field USING 'BSEC-NAME2' it_bdc-name2. PERFORM bdc_field USING 'BSEC-STRAS' it_bdc-stras. PERFORM bdc_field USING 'BSEC-PFACH' it_bdc-pfach. PERFORM bdc_field USING 'BSEC-PSTL2' it_bdc-pstl2. PERFORM bdc_field USING 'BSEC-ORT01' it_bdc-ort01. PERFORM bdc_field USING 'BSEC-PSTLZ' it_bdc-pstlz. PERFORM bdc_field USING 'BSEC-REGIO' it_bdc-regio. PERFORM bdc_field USING 'BSEC-LAND1' it_bdc-land1. PERFORM bdc_field USING 'BSEC-BANKS' it_bdc-banks. ENDIF. * IF it_bdc-newbs = c_39 OR it_bdc-newbs = c_29 OR it_bdc-newbs = c_09 OR it_bdc-newbs = c_19. * IF g_umsks <> C_A. * PERFORM bdc_dynpro USING 'SAPMF05A' '0303'. * ELSE. * PERFORM bdc_dynpro USING 'SAPMF05A' '0304'. * ENDIF. * PERFORM bdc_field USING 'BDC_CURSOR' * 'BSEG-WRBTR'. * PERFORM bdc_field USING 'BDC_OKCODE' * '=ZK'. * PERFORM bdc_field USING 'BSEG-WRBTR' * g_wrbtr. * IF g_flag_1 = ' '. * PERFORM bdc_field USING 'BKPF-XMWST' * it_file-xmwst. * ENDIF. * IF g_flag_1 = C_X. * PERFORM bdc_field USING 'BSEG-MWSKZ' * it_bdc-mwskz. * ENDIF. * PERFORM bdc_field USING 'BSEG-GSBER' * it_bdc-gsber. * PERFORM bdc_field USING 'BSEG-ZFBDT' * it_bdc-zfbdt. * PERFORM bdc_field USING 'BSEG-ZUONR'

* * * * * *

PERFORM bdc_field PERFORM bdc_field ENDIF.

it_bdc-zuonr. USING 'BSEG-SGTXT' it_bdc-sgtxt. USING 'BSEG-PRCTR' it_bdc-prctr.

IF it_bdc-newbs = c_01 OR it_bdc-newbs = c_11 OR it_bdc-newbs = c_05 O R it_bdc-newbs = c_15. PERFORM bdc_dynpro USING 'SAPMF05A' '0301'. PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. PERFORM bdc_field USING 'BDC_OKCODE' '=ZK'. PERFORM bdc_field USING 'BSEG-WRBTR' g_wrbtr. IF g_flag_1 = ' '. PERFORM bdc_field USING 'BKPF-XMWST' it_file-xmwst. ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field USING 'BSEG-MWSKZ' it_bdc-mwskz. ENDIF. PERFORM bdc_field USING 'BSEG-GSBER' it_bdc-gsber. PERFORM bdc_field USING 'BSEG-ZFBDT' it_bdc-zfbdt. PERFORM bdc_field USING 'BSEG-ZUONR' it_bdc-zuonr. PERFORM bdc_field USING 'BSEG-SGTXT' it_bdc-sgtxt. * PERFORM bdc_field USING 'BSEG-PRCTR' * it_bdc-prctr. ENDIF. CLEAR g_umsks. IF it_bdc-newbs = c_01 OR it_bdc-newbs = c_11 OR it_bdc-newbs = c_05 O R it_bdc-newbs = c_15 OR it_bdc-newbs = c_09 OR it_bdc-newbs = c_19. PERFORM bdc_dynpro USING 'SAPMF05A' '0331'. ELSE. PERFORM bdc_dynpro USING 'SAPMF05A' '0332'. ENDIF. PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-NEWKO'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'BSEG-XREF1' it_bdc-xref1. PERFORM bdc_field USING 'BSEG-XREF2' it_bdc-xref2. PERFORM bdc_field USING 'BSEG-XREF3' it_bdc-xref3. IF l_flag_blart = 'X'. PERFORM bdc_field ENDIF. USING 'BSEG-VBUND' it_bdc-vbund.

ENDIF. *break-point. IF it_bdc-newbs = c_40 OR it_bdc-newbs = c_50. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field IF g_flag_1 = ' '. PERFORM bdc_field ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field ENDIF. PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field *-* * *-PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field * * PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field USING 'SAPMF05A' '0300'. USING 'BDC_CURSOR' 'BSEG-SGTXT'. USING 'BDC_OKCODE' '=ZK'. USING 'BSEG-WRBTR' g_wrbtr. USING 'BKPF-XMWST' it_file-xmwst. USING 'BSEG-MWSKZ' it_bdc-mwskz. USING 'BSEG-VALUT' it_bdc-valut. USING 'BSEG-ZUONR' it_bdc-zuonr. USING 'BSEG-SGTXT' it_bdc-sgtxt. USING 'BSEG-PRCTR' it_bdc-prctr. USING 'DKACB-FMORE' 'X'. USING 'SAPLKACB' '0002'. USING 'BDC_CURSOR' 'COBL-KOSTL'. USING 'BDC_OKCODE' '=ENTE'. USING 'COBL-PRCTR' it_bdc-prctr. USING 'COBL-KOSTL' it_bdc-kostl. USING 'COBL-ZZCHAN' it_bdc-zzchan. USING 'COBL-GSBER' it_bdc-gsber. USING 'COBL-AUFNR' it_bdc-aufnr. USING 'COBL-PS_POSID' it_bdc-ps_posid. USING 'COBL-ANLN1' it_bdc-anln1. USING 'COBL-SEGMENT' it_bdc-segment. USING 'COBL-PERNR' it_bdc-pernr. USING 'COBL-FKBER' it_bdc-fkber. USING 'COBL-RMVCT' it_bdc-rmvct.

* * * *

PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field IF l_flag_blart = 'X'. PERFORM bdc_field it_bdc-vbund. ENDIF. ENDIF. IF it_bdc-newbs = c_70. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field IF g_flag_1 = ' '. PERFORM bdc_field ENDIF. IF g_flag_1 = c_x. PERFORM bdc_field ENDIF. PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field

USING 'COBL-ZZVERTICAL' IT_BDC-ZZVERTICAL. USING 'COBL-ZZPARTNER' IT_BDC-ZZPARTNER. USING 'SAPMF05A' '0330'. USING 'BDC_CURSOR' 'BSEG-XREF3'. USING 'BDC_OKCODE' '/00'. USING 'BSEG-XREF1' it_bdc-xref1. USING 'BSEG-XREF2' it_bdc-xref2. USING 'BSEG-XREF3' it_bdc-xref3. USING 'BSEG-VBUND'

USING 'SAPMF05A' '0305'. USING 'BDC_CURSOR' 'BSEG-WRBTR'. USING 'BDC_OKCODE' '=ZK'. USING 'BSEG-WRBTR' g_wrbtr. USING 'BKPF-XMWST' it_file-xmwst. USING 'BSEG-MWSKZ' it_bdc-mwskz. USING 'BSEG-MENGE' g_menge. USING 'BSEG-MEINS' it_bdc-meins. USING 'BSEG-BZDAT' it_bdc-bzdat. USING 'BSEG-ZUONR' it_bdc-zuonr. USING 'BSEG-SGTXT' it_bdc-sgtxt. USING 'DKACB-FMORE' 'X'. USING 'SAPLKACB' '0002'. USING 'BDC_CURSOR' 'COBL-PARGB'. USING 'BDC_OKCODE' '=ENTE'. USING 'SAPMF05A' '0335'. USING 'BDC_CURSOR' 'RF05A-NEWKO'.

PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field IF l_flag_blart = 'X'. PERFORM bdc_field it_bdc-vbund. ENDIF. ENDIF. g_flag_1 = c_x. ENDLOOP. ENDIF. PERFORM bdc_field

USING 'BDC_OKCODE' '/00'. USING 'BSEG-XREF1' it_bdc-xref1. USING 'BSEG-XREF2' it_bdc-xref2. USING 'BSEG-XREF3' it_bdc-xref3. USING 'BSEG-VBUND'

USING 'BDC_OKCODE' '=BU'. PERFORM bdc_transaction USING 'FB01'. g_flag_1 = ' '. ENDLOOP. *perform bdc_transaction using 'F-43'. * *perform close_group. PERFORM close_group. CALL TRANSACTION 'SM35'. *&---------------------------------------------------------------------* *& Form F_AUTHORITY_CHECK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* *----------------------------------------------------------------------* FORM F_AUTHORITY_CHECK . CALL FUNCTION 'AUTHORITY_CHECK_TCODE' EXPORTING tcode = 'ZITC_FB01_UP' EXCEPTIONS ok = 1 not_ok = 2 . IF sy-subrc <> 1. MESSAGE e044(zfi). ENDIF. ENDFORM. " F_AUTHORITY_CHECK "#EC * "#EC *

*Text elements *---------------------------------------------------------* 002 Selection criteria * 003 * 004 SAPMF05A * E00 returncode * I01 Create group

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

I02 I03 I04 I05 I06 S01 S02 S03 S04 S05 S06 S07 S08 S09 S10 S11

BDC_OPEN_GROUP BDC_INSERT BDC_CLOSE_GROUP returncode: Fehlermappe wurde erzeugt Group name of session User name Keep Date Mode Update mode create session call transaction Error-session Nodata Log transactions

*Selection texts *---------------------------------------------------------* CTU call transaction * CTUMODE call transaction * E_GROUP * E_HDATE Current Date * E_KEEP Keep * E_USER User name * GROUP File name * HOLDDATE File Type * KEEP Group * NODATA Current Date * P_FNAME File name * P_FTYPE File Type *Messages *---------------------------------------------------------* * Message class: MS *613 Please enter a session name and user name * * Message class: ZFI *044 No Authorization to run this Report