PROGRAM zcm_dynpro_tabstrip_local. TABLES: rmmw1, "物料管理维护:初始化参数(零售) rmmg1, "物料主数据维护:初始参数-原材料 rw04a. "存储结构 * Itab for BDC DATA: i_bdcdata LIKE STANDARD TABLE OF bdcdata INITIAL SIZE 0 WITH HEADER LINE. CONTROLS mytabstrip TYPE TABSTRIP. DATA: ok_code TYPE sy-ucomm, save_ok TYPE sy-ucomm. DATA: p_file1(100) TYPE c, p_file2(100) TYPE c, p_file3(100) TYPE c, p_file4(100) TYPE c. CONSTANTS: c_begin_row TYPE i VALUE 1, "Beginning row of excel file c_begin_col TYPE i VALUE 1, "Beginning column of excel file c_end_row TYPE i VALUE 1000, "Ending row of excel file c_end_col TYPE i VALUE 10. "Ending column of excel file CONSTANTS: c_meinh LIKE smeinh-meinh VALUE 'EA', "帐面库存单位的可替换计量单位 c_meins LIKE eina-meins VALUE 'EA', "帐面库存单位的可替换计量单位 c_numtp LIKE smeinh-numtp VALUE 'UC', "国际商品编码的类别 (EAN) c_tragr LIKE mara-tragr VALUE '0001', "运输组 c_wladg LIKE maw1-wladg VALUE '0001', "装载组 c_mtpos LIKE mara-mtpos_mara VALUE 'NORM', "普通项目类别组 c_iprkz LIKE mara-iprkz VALUE 'D'. "货架到期日期期间标识 DATA: BEGIN OF i_basic OCCURS 0, matnr LIKE rmmw1-matnr, "商品编码 mtart LIKE rmmw1-mtart, "商品类型 matkl LIKE rmmw1-matkl, "商品类目 attyp LIKE rmmw1-attyp, "商品类别 maktx LIKE makt-maktx, "商品描述 spart LIKE mara-spart, "生产线 taklv LIKE mara-taklv, "税收分类 wbkla LIKE maw1-wbkla, "评估类 END OF i_basic. DATA: BEGIN OF i_purch OCCURS 0, matnr LIKE rmmw1-matnr, "商品编码 ekorg LIKE rmmw1-ekorg, "采购组织 lifnr LIKE rmmw1-lifnr, "供应商 ekgrp LIKE eine-ekgrp, "采购组 netpr LIKE eine-netpr, "净价 END OF i_purch. DATA: BEGIN OF i_sales_up OCCURS 0, matnr LIKE rmmw1-matnr, "商品编码 ktgrm LIKE mvke-ktgrm, "科目设置组 vkorg LIKE tvta-vkorg, "销售机构 END OF i_sales_up. DATA: BEGIN OF i_sales OCCURS 0, matnr LIKE rmmw1-matnr, "商品编码 ktgrm LIKE mvke-ktgrm, "科目设置组 vkorg LIKE tvta-vkorg, "销售机构 vtweg LIKE tvta-vtweg, "分销渠道 END OF i_sales. DATA: BEGIN OF i_sites OCCURS 0, matnr LIKE rmmw1-matnr, "商品编码 END OF i_sites. DATA: BEGIN OF i_tvtw OCCURS 0, vtweg LIKE tvtw-vtweg, "分销渠道 END OF i_tvtw. DATA: BEGIN OF i_tvta OCCURS 0, vkorg LIKE tvta-vkorg, "销售机构 vtweg LIKE tvta-vtweg, "分销渠道 END OF i_tvta. DATA: BEGIN OF i_mara OCCURS 0, matnr LIKE mara-matnr, "商品编码 spart LIKE mara-spart, "科目设置组 END OF i_mara. DATA: BEGIN OF i_t001a OCCURS 0, werks LIKE t001w-werks, "门店 END OF i_t001a. DATA: BEGIN OF i_t001z OCCURS 0, werks LIKE t001w-werks, "分销中心 END OF i_t001z. RANGES: r_matnr FOR rmmw1-matnr, r_vkorg FOR rmmw1-vkorg, r_vzwrk FOR rmmw1-vzwrk, r_fiwrk FOR rmmw1-fiwrk. mytabstrip-activetab = 'PUSH1'. CALL SCREEN 100. *---------------------------------------------------------------------* * MODULE status_0100 OUTPUT *---------------------------------------------------------------------* * *---------------------------------------------------------------------* MODULE status_0100 OUTPUT. SET PF-STATUS 'SCREEN_100'. SET TITLEBAR '100'. ENDMODULE. "status_0100 OUTPUT *---------------------------------------------------------------------* * MODULE cancel INPUT *---------------------------------------------------------------------* * *---------------------------------------------------------------------* MODULE cancel INPUT. LEAVE PROGRAM. ENDMODULE. "cancel INPUT *---------------------------------------------------------------------* * MODULE user_command INPUT *---------------------------------------------------------------------* * *---------------------------------------------------------------------* MODULE user_command INPUT. save_ok = ok_code. CLEAR ok_code. CASE save_ok. WHEN 'SEE1'. PERFORM select_file CHANGING p_file1. WHEN 'SEE2'. PERFORM select_file CHANGING p_file2. WHEN 'SEE3'. PERFORM select_file CHANGING p_file3. WHEN 'SEE4'. PERFORM select_file CHANGING p_file4. WHEN 'EXE1'. PERFORM bdc_basic. WHEN 'EXE2'. PERFORM bdc_purch. WHEN 'EXE3'. PERFORM bdc_sales. WHEN 'EXE4'. PERFORM bdc_sites. ENDCASE. ENDMODULE. "user_command INPUT *&---------------------------------------------------------------------* *& Form select_file *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * <--L_FILE text *----------------------------------------------------------------------* FORM select_file CHANGING l_file. DATA: l_len TYPE i, l_rc TYPE i, " Anzahl gefundener Dateinamen l_filetab TYPE filetable. " Tabelle mit Dateinamen * Upload des Files CLEAR l_filetab[]. CALL METHOD cl_gui_frontend_services=>file_open_dialog EXPORTING default_filename = '*.xls' default_extension = 'xls' * file_filter = '*.xls' "#EC NOTEXT * initial_directory = 'C:\TEMP' "#EC NOTEXT * multiselection = abap_false window_title = 'Select File' CHANGING file_table = l_filetab rc = l_rc EXCEPTIONS file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3 OTHERS = 4. IF sy-subrc = 0. LOOP AT l_filetab INTO l_file. ENDLOOP. l_len = strlen( l_file ). IF l_len > 66. MESSAGE i398(00) WITH text-005. CLEAR l_file. ENDIF. ENDIF. ENDFORM. " select_file *&---------------------------------------------------------------------* *& Form bdc_basic *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_basic. IF NOT p_file1 IS INITIAL. PERFORM upload_data TABLES i_basic USING p_file1. PERFORM bdc_create. PERFORM basic_fill_bdc. PERFORM bdc_close. PERFORM submit_session. ENDIF. ENDFORM. " bdc_basic *&---------------------------------------------------------------------* *& Form bdc_purch *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_purch. IF NOT p_file2 IS INITIAL. PERFORM upload_data TABLES i_purch USING p_file2. PERFORM bdc_create. PERFORM purch_fill_bdc. PERFORM bdc_close. PERFORM submit_session. ENDIF. ENDFORM. " bdc_purch *&---------------------------------------------------------------------* *& Form bdc_sales *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_sales. IF p_file3 IS INITIAL. IF rmmw1-matnr IS INITIAL. IF rmmg1-matnr IS INITIAL. MESSAGE i398(00) WITH text-007. EXIT. ELSE. r_matnr-sign = 'I'. r_matnr-option = 'EQ'. r_matnr-low = rmmg1-matnr. r_matnr-high = ''. APPEND r_matnr. ENDIF. ELSE. IF rmmg1-matnr IS INITIAL. r_matnr-sign = 'I'. r_matnr-option = 'EQ'. r_matnr-low = rmmw1-matnr. r_matnr-high = ''. APPEND r_matnr. ELSE. IF rmmw1-matnr > rmmg1-matnr. MESSAGE i398(00) WITH text-008. EXIT. ELSE. r_matnr-sign = 'I'. r_matnr-option = 'BT'. r_matnr-low = rmmw1-matnr. r_matnr-high = rmmg1-matnr. APPEND r_matnr. ENDIF. ENDIF. ENDIF. IF rmmw1-vkorg IS INITIAL. IF rmmg1-vkorg IS INITIAL. ELSE. r_vkorg-sign = 'I'. r_vkorg-option = 'EQ'. r_vkorg-low = rmmg1-vkorg. r_vkorg-high = ''. APPEND r_vkorg. ENDIF. ELSE. IF rmmg1-vkorg IS INITIAL. r_vkorg-sign = 'I'. r_vkorg-option = 'EQ'. r_vkorg-low = rmmw1-vkorg. r_vkorg-high = ''. APPEND r_vkorg. ELSE. IF rmmw1-vkorg > rmmg1-vkorg. MESSAGE i398(00) WITH text-008. EXIT. ELSE. r_vkorg-sign = 'I'. r_vkorg-option = 'BT'. r_vkorg-low = rmmw1-vkorg. r_vkorg-high = rmmg1-vkorg. APPEND r_vkorg. ENDIF. ENDIF. ENDIF. SELECT matnr spart FROM mara INTO TABLE i_mara WHERE matnr IN r_matnr. IF sy-subrc <> 0. MESSAGE i398(00) WITH text-009. EXIT. ENDIF. SELECT vkorg vtweg FROM tvta INTO TABLE i_tvta WHERE vkorg IN r_vkorg. IF sy-subrc <> 0. MESSAGE i398(00) WITH text-010. EXIT. ELSE. DELETE ADJACENT DUPLICATES FROM i_tvta. ENDIF. LOOP AT i_mara. LOOP AT i_tvta. i_sales-matnr = i_mara-matnr. i_sales-ktgrm = i_mara-spart. i_sales-vkorg = i_tvta-vkorg. i_sales-vtweg = i_tvta-vtweg. APPEND i_sales. ENDLOOP. ENDLOOP. PERFORM bdc_create. PERFORM sales_fill_bdc. PERFORM bdc_close. PERFORM submit_session. ELSE. PERFORM upload_data TABLES i_sales_up USING p_file3. SELECT vtweg FROM tvtw INTO TABLE i_tvtw. LOOP AT i_sales_up. LOOP AT i_tvtw. i_sales-matnr = i_sales_up-matnr. i_sales-ktgrm = i_sales_up-ktgrm. i_sales-vkorg = i_sales_up-vkorg. i_sales-vtweg = i_tvtw-vtweg. APPEND i_sales. ENDLOOP. ENDLOOP. PERFORM bdc_create. PERFORM sales_fill_bdc. PERFORM bdc_close. PERFORM submit_session. ENDIF. ENDFORM. " bdc_sales *&---------------------------------------------------------------------* *& Form bdc_sites *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_sites. IF NOT p_file4 IS INITIAL. IF rmmw1-vzwrk IS INITIAL. IF rw04a-vzwrk IS INITIAL. ELSE. r_vzwrk-sign = 'I'. r_vzwrk-option = 'EQ'. r_vzwrk-low = rw04a-vzwrk. r_vzwrk-high = ''. APPEND r_vzwrk. ENDIF. ELSE. IF rw04a-vzwrk IS INITIAL. r_vzwrk-sign = 'I'. r_vzwrk-option = 'EQ'. r_vzwrk-low = rmmw1-vzwrk. r_vzwrk-high = ''. APPEND r_vzwrk. ELSE. IF rmmw1-vzwrk > rw04a-vzwrk. MESSAGE i398(00) WITH text-008. EXIT. ELSE. r_vzwrk-sign = 'I'. r_vzwrk-option = 'BT'. r_vzwrk-low = rmmw1-vzwrk. r_vzwrk-high = rw04a-vzwrk. APPEND r_vzwrk. ENDIF. ENDIF. ENDIF. IF rmmw1-fiwrk IS INITIAL. IF rw04a-fiwrk IS INITIAL. ELSE. r_fiwrk-sign = 'I'. r_fiwrk-option = 'EQ'. r_fiwrk-low = rw04a-fiwrk. r_fiwrk-high = ''. APPEND r_fiwrk. ENDIF. ELSE. IF rw04a-fiwrk IS INITIAL. r_fiwrk-sign = 'I'. r_fiwrk-option = 'EQ'. r_fiwrk-low = rmmw1-fiwrk. r_fiwrk-high = ''. APPEND r_fiwrk. ELSE. IF rmmw1-fiwrk > rw04a-fiwrk. MESSAGE i398(00) WITH text-008. EXIT. ELSE. r_fiwrk-sign = 'I'. r_fiwrk-option = 'BT'. r_fiwrk-low = rmmw1-fiwrk. r_fiwrk-high = rw04a-fiwrk. APPEND r_fiwrk. ENDIF. ENDIF. ENDIF. SELECT werks FROM t001w INTO TABLE i_t001z WHERE werks IN r_vzwrk. * AND vlfkz = 'B'. SELECT werks FROM t001w INTO TABLE i_t001a WHERE werks IN r_fiwrk. * AND vlfkz = 'A'. PERFORM upload_data TABLES i_sites USING p_file4. PERFORM bdc_create. PERFORM sites_fill_bdc. PERFORM bdc_close. PERFORM submit_session. ENDIF. ENDFORM. " bdc_sites *&---------------------------------------------------------------------* *& Form upload_data *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_FILE text *----------------------------------------------------------------------* FORM upload_data TABLES i_table USING p_file. DATA: BEGIN OF i_excel OCCURS 0. INCLUDE STRUCTURE alsmex_tabline. DATA: END OF i_excel. DATA: l_answer(1) TYPE c. DATA: l_column TYPE i. FIELD-SYMBOLS: . DATA: l_pathname LIKE rlgrap-filename. MOVE p_file TO l_pathname. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = l_pathname i_begin_col = c_begin_col i_begin_row = c_begin_row i_end_col = c_end_col i_end_row = c_end_row TABLES intern = i_excel * 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. ELSE. IF i_excel[] IS INITIAL. CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE' EXPORTING * DEFAULTOPTION = 'Y' diagnosetext1 = 'diagnosetext1' * DIAGNOSETEXT2 = ' ' * DIAGNOSETEXT3 = ' ' textline1 = 'textline1' * TEXTLINE2 = ' ' titel = 'Confirm' * START_COLUMN = 25 * START_ROW = 6 * CANCEL_DISPLAY = 'X' IMPORTING answer = l_answer. ELSE. SORT i_excel BY row col. LOOP AT i_excel. MOVE i_excel-col TO l_column. ASSIGN COMPONENT l_column OF STRUCTURE i_table TO . MOVE i_excel-value TO . AT END OF row. APPEND i_table. CLEAR i_table. ENDAT. ENDLOOP. ENDIF. ENDIF. ENDFORM. " load_data *&---------------------------------------------------------------------* *& Form bdc_create *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_create. DATA: l_repid LIKE apqi-groupid. l_repid = sy-repid. CALL FUNCTION 'BDC_OPEN_GROUP' EXPORTING client = sy-mandt group = l_repid keep = 'X' user = sy-uname 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 i398(00) WITH 'BDC_OPEN_GROUP ERROR'. ENDIF. ENDFORM. " bdc_create *&---------------------------------------------------------------------* *& Form basic_fill_bdc *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM basic_fill_bdc. LOOP AT i_basic. * Screen 1 PERFORM bdc_dynpro USING 'SAPLMGMW' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(01)'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'RMMW1-MATNR' i_basic-matnr. PERFORM bdc_field USING 'RMMW1-MTART' i_basic-mtart. PERFORM bdc_field USING 'RMMW1-MATKL' i_basic-matkl. PERFORM bdc_field USING 'RMMW1-ATTYP' i_basic-attyp. PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)' 'X'. * Screen 2 PERFORM bdc_dynpro USING 'SAPLMGMW' '4008'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'MAKT-MAKTX' i_basic-maktx. PERFORM bdc_field USING 'SMEINH-MEINH(01)' c_meinh. PERFORM bdc_field USING 'SMEINH-NUMTP(01)' c_numtp. PERFORM bdc_field USING 'MARA-SPART' i_basic-spart. PERFORM bdc_field USING 'MARA-TAKLV' i_basic-taklv. PERFORM bdc_field USING 'MAW1-WBKLA' i_basic-wbkla. PERFORM bdc_field USING 'MARA-TRAGR' c_tragr. PERFORM bdc_field USING 'MAW1-WLADG' c_wladg. PERFORM bdc_field USING 'MARA-MTPOS_MARA' c_mtpos. PERFORM bdc_field USING 'MARA-DATAB' sy-datum. PERFORM bdc_field USING 'MARA-IPRKZ' c_iprkz. * Screen 3 PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'. PERFORM bdc_field USING 'BDC_OKCODE' '=YES'. * BDC_Insert PERFORM bdc_insert USING 'MM41'. ENDLOOP. ENDFORM. " basic_fill_bdc *&---------------------------------------------------------------------* *& Form purch_fill_bdc *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM purch_fill_bdc. LOOP AT i_purch. * Screen 1 PERFORM bdc_dynpro USING 'SAPLMGMW' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(03)'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'RMMW1-MATNR' i_purch-matnr. PERFORM bdc_field USING 'RMMW1-EKORG' i_purch-ekorg. PERFORM bdc_field USING 'RMMW1-LIFNR' i_purch-lifnr. PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(03)' 'X'. * Screen 2 PERFORM bdc_dynpro USING 'SAPLMGMW' '4000'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. * PERFORM bdc_field USING 'MAKT-MAKTX' * '摩托罗拉 Α10'. PERFORM bdc_field USING 'EINA-MEINS' c_meins. PERFORM bdc_field USING 'EINE-EKGRP' i_purch-ekgrp. * PERFORM bdc_field USING 'BDC_CURSOR' * 'EINE-WAERS'. PERFORM bdc_field USING 'EINE-NETPR' i_purch-netpr. * PERFORM bdc_field USING 'EINE-WAERS' * 'RMB'. * PERFORM bdc_field USING 'EINE-PEINH' * '1'. * PERFORM bdc_field USING 'EINE-BPRME' * 'EA'. * Sreen 3 PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'. PERFORM bdc_field USING 'BDC_OKCODE' '=YES'. * BDC_Insert PERFORM bdc_insert USING 'MM42'. ENDLOOP. ENDFORM. " purch_fill_bdc *&---------------------------------------------------------------------* *& Form sales_fill_bdc *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM sales_fill_bdc. LOOP AT i_sales. * Screen 1 PERFORM bdc_dynpro USING 'SAPLMGMW' '0100'. PERFORM bdc_field USING 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(04)'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'RMMW1-MATNR' i_sales-matnr. PERFORM bdc_field USING 'RMMW1-VKORG' i_sales-vkorg. PERFORM bdc_field USING 'RMMW1-VTWEG' i_sales-vtweg. * PERFORM bdc_field USING 'RMMW1-FIWRK' * ''. PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)' 'X'. PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(04)' 'X'. * Screen 2 PERFORM bdc_dynpro USING 'SAPLMGMW' '4000'. PERFORM bdc_field USING 'BDC_OKCODE' '=LIST'. PERFORM bdc_field USING 'MAKT-MAKTX' '摩托罗拉 Α10'. PERFORM bdc_field USING 'MWLI-LSTFL' '02'. * PERFORM bdc_field USING 'MWLI-LDVFL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-LDBFL' * '31.12.9999'. * PERFORM bdc_field USING 'MWLI-VDVFL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-VDBFL' * '31.12.9999'. PERFORM bdc_field USING 'MWLI-LSTVZ' '02'. * PERFORM bdc_field USING 'MWLI-LDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-LDBZL' * '31.12.9999'. * PERFORM bdc_field USING 'MWLI-VDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-VDBZL' * '31.12.9999'. PERFORM bdc_field USING 'BDC_CURSOR' 'RMMWZ-LILI'. PERFORM bdc_field USING 'RMMWZ-MPFLB' 'X'. PERFORM bdc_field USING 'RMMWZ-NLIPR' 'X'. PERFORM bdc_field USING 'RMMWZ-LILI' ''. PERFORM bdc_dynpro USING 'SAPLWSO1' '0118'. PERFORM bdc_field USING 'BDC_CURSOR' '*WINT_CARRH-ASORT'. PERFORM bdc_field USING 'BDC_OKCODE' '=UEBN'. PERFORM bdc_field USING 'SEITE1' '1'. PERFORM bdc_field USING 'SEITE2' '4'. * Screen 3 PERFORM bdc_dynpro USING 'SAPLMGMW' '4000'. PERFORM bdc_field USING 'BDC_OKCODE' '/00'. PERFORM bdc_field USING 'BDC_CURSOR' 'MAKT-MAKTX'. * PERFORM bdc_field USING 'MAKT-MAKTX' * '摩托罗拉 Α10'. PERFORM bdc_field USING 'MWLI-LSTFL' '02'. * PERFORM bdc_field USING 'MWLI-LDVFL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-LDBFL' * '31.12.9999'. * PERFORM bdc_field USING 'MWLI-VDVFL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-VDBFL' * '31.12.9999'. PERFORM bdc_field USING 'MWLI-LSTVZ' '02'. * PERFORM bdc_field USING 'MWLI-LDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-LDBZL' * '31.12.9999'. * PERFORM bdc_field USING 'MWLI-VDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MWLI-VDBZL' * '31.12.9999'. * Screen 4 PERFORM bdc_dynpro USING 'SAPLMGMW' '4030'. PERFORM bdc_field USING 'BDC_OKCODE' '=PB29'. PERFORM bdc_field USING 'BDC_CURSOR' 'MAKT-MAKTX'. * PERFORM bdc_field USING 'MAKT-MAKTX' * '摩托罗拉 Α10'. * PERFORM bdc_field USING 'MVKE-VDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MVKE-VDBZL' * '31.12.9999'. PERFORM bdc_field USING 'MVKE-MTPOS' 'NORM'. PERFORM bdc_field USING 'MVKE-SKTOF' 'X'. * PERFORM bdc_field USING 'CALP-VKKAB' * '30.12.2004'. * PERFORM bdc_field USING 'CALP-VKKBI' * '31.12.9999'. * Screen 5 PERFORM bdc_dynpro USING 'SAPLMGMW' '3000'. PERFORM bdc_field USING 'BDC_OKCODE' '=BABA'. * PERFORM bdc_field USING 'MAKT-MAKTX' * '摩托罗拉 Α10'. PERFORM bdc_field USING 'BDC_CURSOR' 'MVKE-KTGRM'. PERFORM bdc_field USING 'MVKE-VERSG' '1'. PERFORM bdc_field USING 'MVKE-KTGRM' i_sales-ktgrm. PERFORM bdc_field USING 'MVKE-MTPOS' 'NORM'. PERFORM bdc_field USING 'MARA-MTPOS_MARA' 'NORM'. * Screen 6 PERFORM bdc_dynpro USING 'SAPLMGMW' '4030'. PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. PERFORM bdc_field USING 'BDC_CURSOR' 'MAKT-MAKTX'. * PERFORM bdc_field USING 'MAKT-MAKTX' * '摩托罗拉 Α10'. * PERFORM bdc_field USING 'MVKE-VDVZL' * '30.12.2004'. * PERFORM bdc_field USING 'MVKE-VDBZL' * '31.12.9999'. PERFORM bdc_field USING 'MVKE-MTPOS' 'NORM'. PERFORM bdc_field USING 'MVKE-SKTOF' 'X'. * PERFORM bdc_field USING 'CALP-VKKAB' * '30.12.2004'. * PERFORM bdc_field USING 'CALP-VKKBI' * '31.12.9999'. * BDC_Insert PERFORM bdc_insert USING 'MM42'. ENDLOOP. ENDFORM. " sales_fill_bdc *&---------------------------------------------------------------------* *& Form sites_fill_bdc *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM sites_fill_bdc. ENDFORM. " sites_fill_bdc *&---------------------------------------------------------------------* *& Form bdc_insert *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0277 text *----------------------------------------------------------------------* FORM bdc_insert USING p_tcode TYPE tcode. CALL FUNCTION 'BDC_INSERT' EXPORTING tcode = p_tcode TABLES dynprotab = i_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. PERFORM bdc_close. MESSAGE i398(00) WITH 'BDC_INSERT ERROR'. ENDIF. REFRESH i_bdcdata. ENDFORM. " bdc_insert *&---------------------------------------------------------------------* *& Form bdc_close *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM bdc_close. CALL FUNCTION 'BDC_CLOSE_GROUP' EXCEPTIONS not_open = 1 queue_error = 2 OTHERS = 3. IF sy-subrc <> 0. MESSAGE i398(00) WITH 'BDC_CLOSE_GROUP ERROR'. ENDIF. ENDFORM. " bdc_close *&---------------------------------------------------------------------* *& Form submit_session *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM submit_session. DATA: l_repid LIKE d0100-mapn. l_repid = sy-repid. SUBMIT rsbdcsub WITH mappe = l_repid WITH von = sy-datum WITH bis = sy-datum WITH z_verarb = 'X' WITH fehler = ' ' AND RETURN EXPORTING LIST TO MEMORY. ENDFORM. " submit_session *&---------------------------------------------------------------------* *& Form bdc_dynpro *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0531 text * -->P_0532 text *----------------------------------------------------------------------* FORM bdc_dynpro USING p_program TYPE bdc_prog p_dynpro TYPE bdc_dynr. CLEAR: i_bdcdata. i_bdcdata-program = p_program. i_bdcdata-dynpro = p_dynpro. i_bdcdata-dynbegin = 'X'. APPEND i_bdcdata. ENDFORM. " bdc_dynpro *&---------------------------------------------------------------------* *& Form bdc_field *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0536 text * -->P_FVAL text *----------------------------------------------------------------------* *FORM bdc_field USING p_fnam TYPE fnam_____4 * p_fval TYPE bdc_fval. FORM bdc_field USING p_fnam p_fval. CLEAR: i_bdcdata. i_bdcdata-fnam = p_fnam. i_bdcdata-fval = p_fval. APPEND i_bdcdata. ENDFORM. " bdc_field
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
CALL SUBSCREEN: SUB1 INCLUDING SY-REPID '0110',
SUB2 INCLUDING SY-REPID '0120',
SUB3 INCLUDING SY-REPID '0130',
SUB4 INCLUDING SY-REPID '0140'.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
CALL SUBSCREEN: SUB1,
SUB2,
SUB3,
SUB4.
MODULE USER_COMMAND.