标签:ade test code 解决 nim mini others theme 销售
调用bapi ‘BAPI_SALESORDER_CREATEFROMDAT2‘ 创建销售订单,发现生成的销售订单有incompletion log,是关于可配置物料的,如下
可配置物料的可以通过字段MARA-KZKFG判断,
经过某大师指点发现,造成此问题的根本原因是bapi BAPI_SALESORDER_CREATEFROMDAT2中行项目ORDER_ITEMS_IN-PO_ITM_NO和configuration的ORDER_CFGS_REF-POSEX为空,没有将行项目和configuration的数据关联起来。
解决方法有两种:
方法1,当ORDER_ITEMS_IN-PO_ITM_NO和ORDER_CFGS_REF-POSEX 为空时,给这两个字段赋一个相同的假的行项目值,让行项目和配置信息关联起来,但是这么做有个副作用就是这个假行项目值会被保存到vbap-posex中,所以还要再bapi BAPI_SALESORDER_CREATEFROMDAT2 之后用直接更新表的方法将vbap-posex恢复。
方法2,写一段bdc程序模拟以下前台动作,
选中行项目,点击configuration detail按钮
然后,直接返回保存,这样就不会有incompletion log了
BDC代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
REPORT z_va02test.
DATA:git_bdcdata TYPE TABLE OF bdcdata,
gwa_bdcdata LIKE LINE OF git_bdcdata,
git_messtab TYPE TABLE OF bdcmsgcoll,
gwa_messtab LIKE LINE OF git_messtab.
DATA: l_fnam TYPE bdcdata-fnam.
CLEAR: git_bdcdata.
PERFORM bdc_dynpro USING ‘SAPMV45A‘ ‘0102‘.
PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘/00‘.
PERFORM bdc_field USING ‘VBAK-VBELN‘ ‘0640000474‘.
PERFORM bdc_dynpro USING ‘SAPMV45A‘ ‘4001‘.
PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘POCO‘.
CONCATENATE ‘RV45A-VBAP_SELKZ(‘ ‘01‘ ‘)‘ INTO l_fnam.
PERFORM bdc_field USING l_fnam ‘X‘.
PERFORM bdc_dynpro USING ‘SAPLCEI0‘ ‘0109‘.
PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘BACK‘.
PERFORM bdc_dynpro USING ‘SAPMV45A‘ ‘4001‘.
PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘SICH‘.
CALL FUNCTION ‘CALL_TRANSACTION_FROM_TABLE_CO‘ STARTING NEW TASK ‘INCOMPLETE_LOG‘
EXPORTING
i_tcode = ‘VA02‘
i_mode = ‘N‘
i_update = ‘A‘
TABLES
t_bdcdata = git_bdcdata[]
t_bdcmessages = git_messtab[]
* T_PARAMETER_IDS = git_bdcdata[]
EXCEPTIONS
error_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1785 text
* -->P_1786 text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
DATA: lwa_bdcdata TYPE bdcdata.
CLEAR lwa_bdcdata.
lwa_bdcdata-program = program.
lwa_bdcdata-dynpro = dynpro.
lwa_bdcdata-dynbegin = ‘X‘.
APPEND lwa_bdcdata TO git_bdcdata.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1813 text
* -->P_1814 text
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: lwa_bdcdata TYPE bdcdata.
CLEAR lwa_bdcdata.
lwa_bdcdata-fnam = fnam.
lwa_bdcdata-fval = fval.
APPEND lwa_bdcdata TO git_bdcdata.
ENDFORM.
|
注意:上面代码中,用到了CALL_TRANSACTION_FROM_TABLE_CO 开了一个新的task来实现BDC,这么做的原因是在调用BAPI_SALESORDER_CREATEFROMDAT2创建销售订单后再用call transaction va02实现BDC会出现一个iactive的屏幕,如下,
这个屏幕和sm35中的录屏不一样,导致bdc失败,所以开了新task执行bdc,这样就能成功,原因还没研究清楚。。。。
1
|
CALL FUNCTION ‘CALL_TRANSACTION_FROM_TABLE_CO‘ STARTING NEW TASK ‘INCOMPLETE_LOG‘
|
以上。
◆◆0如何消除销售订单中配置(Configuration)相关的Incompletion log
标签:ade test code 解决 nim mini others theme 销售
原文地址:https://www.cnblogs.com/lvdong18847870057/p/12534958.html