1 FUNCTION ZFM_AUFNR_TECO_E.
2 *"----------------------------------------------------------------------
3 *"*"本地接口:
4 *" IMPORTING
5 *" REFERENCE(AUFNR) TYPE AFKO-AUFNR
6 *" REFERENCE(FLAG) TYPE CHAR1
7 *" EXPORTING
8 *" REFERENCE(SUBRC) TYPE SYST-SUBRC
9 *" TABLES
10 *"
11 *"
12 *" 对工单进行技术性完成的处理
13 *"----------------------------------------------------------------------
14
15
16
17 DATA BDCDATA_TAB TYPE TABLE OF BDCDATA.
18 ****该表用于存放BDC操作记录
19 DATA OPT TYPE CTU_PARAMS.
20
21 * DATA: X_OPTIONS TYPE CTU_PARAMS..
22
23 CLEAR OPT.
24 OPT-DISMODE = 'E'.
25 OPT-UPDMODE = 'S'.
26 OPT-CATTMODE = ' '.
27 OPT-DEFSIZE = ' '.
28 OPT-RACOMMIT = ' '.
29 IF FLAG = 'X'.
30 OPT-NOBINPT = 'X'.
31 ELSE.
32 OPT-NOBINPT = ''.
33 ENDIF.
34 OPT-NOBIEND = ' '.
35
36 ****用于操作方法记录
37 DATA:OKCODE TYPE C LENGTH 5.
38 ****可以用于存放操作记录的按钮名称
39 DATA :
40 TRANSACTION TYPE C LENGTH 5,
41 DYNPRO TYPE C LENGTH 4,
42 ITAB_MESSAGE TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
43 OPT-DISMODE = 'N'.
44 TRANSACTION = 'CO02'.
45 **** program 事务码 dynpro 屏幕名称 dynbegin 等于X就可以
46 **** fnam 字段名称 fval字段值
47
48 IF FLAG = 'X'.
49 BDCDATA_TAB = VALUE #(
50 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0110' DYNBEGIN = 'X' )
51 ( FNAM = 'BDC_CURSOR' FVAL = 'CAUFVD-AUFNR' )
52 ( FNAM = 'BDC_OKCODE' FVAL = '/00' )
53 ( FNAM = 'CAUFVD-AUFNR' FVAL = AUFNR )
54 ( FNAM = 'R62CLORD-FLG_OVIEW' FVAL = 'X' )
55 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0115' DYNBEGIN = 'X')
56 ( FNAM = 'BDC_OKCODE' FVAL = '=TABS' )
57 ( PROGRAM = 'SAPLSPO1' DYNPRO = '0400' DYNBEGIN = 'X')
58 ( FNAM = 'BDC_OKCODE' FVAL = '=YES' )
59 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0115' DYNBEGIN = 'X')
60 ( FNAM = 'BDC_OKCODE' FVAL = '=BU' )
61 ).
62
63 ELSE.
64 BDCDATA_TAB = VALUE #(
65 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0110' DYNBEGIN = 'X' )
66 ( FNAM = 'BDC_CURSOR' FVAL = 'CAUFVD-AUFNR' )
67 ( FNAM = 'BDC_OKCODE' FVAL = '/00' )
68 ( FNAM = 'CAUFVD-AUFNR' FVAL = AUFNR )
69 ( FNAM = 'R62CLORD-FLG_OVIEW' FVAL = 'X' )
70 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0115' DYNBEGIN = 'X')
71 ( FNAM = 'BDC_OKCODE' FVAL = '=TABS' )
72 * ( PROGRAM = 'SAPLSPO1' DYNPRO = '0400' DYNBEGIN = 'X')
73 * ( FNAM = 'BDC_OKCODE' FVAL = '=YES' )
74 ( PROGRAM = 'SAPLCOKO1' DYNPRO = '0115' DYNBEGIN = 'X')
75 ( FNAM = 'BDC_OKCODE' FVAL = '=BU' )
76 ).
77
78 ENDIF.
79
80 CALL TRANSACTION TRANSACTION USING BDCDATA_TAB OPTIONS FROM OPT
81 MESSAGES INTO MESSTAB..
82 LOOP AT ITAB_MESSAGE.
83 IF ITAB_MESSAGE-MSGTYP = 'E' .
84 MESSAGE 'WRONG_EXEC' TYPE 'E' RAISING WRONG_EXEC.
85 EXIT.
86 ENDIF.
87 ENDLOOP.
99 ENDFUNCTION.
需要注意的是BDC在录屏的时候,有些情境会出现弹出选择框,让你选择是和否。此时这里勾选,并且OPT-NOBINPT = 'X'这个值设置为X。