🚀 优质资源分享 🚀
学习路线指引(点击解锁) | 知识定位 | 人群定位 |
---|---|---|
🧡 Python实战微信订餐小程序 🧡 | 进阶级 | 本课程是python flask+微信小程序的完美结合,从项目搭建到腾讯云部署上线,打造一个全栈订餐系统。 |
💛Python量化交易实战💛 | 入门级 | 手把手带你打造一个易扩展、更安全、效率更高的量化交易系统 |
一、复制标准项目模板实现项目立项
因为CJ20N录屏存在困难,所以想通过BDC实现复制项目模板创建项目立项行不通,因此需要通过BAPI解决。
因为项目立项包含:项目定义、WBS、网络、作业,因此需要分别调用四个BAPI实现该功能
二、CJ01 项目定义与WBS
输入项目定义编号和参数文件
传入必输字段,点击WBS元素总览
输入WBS层级,点击保存即可
创建项目BAPI
"-----------------------------@斌将军-----------------------------
DATA:gs\_proj\_bus2001\_new TYPE bapi\_bus2001\_new,
gt\_bapiret2 TYPE TABLE OF bapiret2,
gs\_bapiret2 TYPE bapiret2.
gs\_proj\_bus2001\_new-project\_definition = 'NPD-2022037'."is\_proj-pspid. "项目编号
gs\_proj\_bus2001\_new-description = '测试'."is\_proj-post1. "PS: 短描述 (第一行文本)
gs\_proj\_bus2001\_new-responsible\_no = '80000667'."lv\_vernr. "项目经理编号
gs\_proj\_bus2001\_new-applicant\_no = '81000003'."lv\_vernr. "申请部门编号
gs\_proj\_bus2001\_new-start = '20220225'."is\_proj-plfaz. "开始日期
gs\_proj\_bus2001\_new-finish = '20220428'."is\_proj-plsez. "完成日期
gs\_proj\_bus2001\_new-company\_code = '2000'."is\_proj-vbukr. "项目的公司代码
gs\_proj\_bus2001\_new-profit\_ctr = ''."is\_proj-prctr. "利润中心
gs\_proj\_bus2001\_new-project\_profile = 'APS0001'."is\_proj-profl. "项目参数文件
gs\_proj\_bus2001\_new-plant = '2000'."is\_proj-werks. "工厂
*IF is\_proj-func\_area IS NOT INITIAL.
* gs\_proj\_bus2001\_new-func\_area = is\_proj-func\_area. "功能控制范围
*ENDIF.
CALL FUNCTION 'BAPI\_PS\_INITIALIZATION'.
CALL FUNCTION 'BAPI\_BUS2001\_CREATE'
EXPORTING
i\_project\_definition = gs\_proj\_bus2001\_new
TABLES
et\_return = gt\_bapiret2.
LOOP AT gt\_bapiret2 INTO gs\_bapiret2 WHERE type CA 'AEX'.
ENDLOOP.
IF sy-subrc EQ 0.
CALL FUNCTION 'PS\_FLAG\_INIT\_GLOBAL\_FLAGS'.
CALL FUNCTION 'PS\_FLAG\_SET\_GLOBAL\_FLAGS'
EXPORTING
i\_precommit\_ok = 'Y'.
ENDIF.
CHECK sy-subrc NE 0.
CALL FUNCTION 'BAPI\_PS\_PRECOMMIT'
TABLES
et\_return = gt\_bapiret2.
LOOP AT gt\_bapiret2 INTO gs\_bapiret2 WHERE type CA 'AEX'.
ENDLOOP.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI\_TRANSACTION\_ROLLBACK'
IMPORTING
return = gs\_bapiret2.
CALL FUNCTION 'PS\_FLAG\_INIT\_GLOBAL\_FLAGS'.
CALL FUNCTION 'PS\_FLAG\_SET\_GLOBAL\_FLAGS'
EXPORTING
i\_precommit\_ok = 'Y'.
ELSE.
CALL FUNCTION 'BAPI\_TRANSACTION\_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = gs\_bapiret2.
* 项目定义创建成功
ENDIF.
"-----------------------------@斌将军-----------------------------
创建WBS的BAPI
"-----------------------------@斌将军-----------------------------
DATA:lv\_pspid TYPE bapi\_bus2001\_new-project\_definition,
gt\_wbs\_bus2054\_new TYPE TABLE OF bapi\_bus2054\_new,
gs\_wbs\_bus2054\_new TYPE bapi\_bus2054\_new,
gt\_bapiret2 TYPE TABLE OF bapiret2,
gs\_bapiret2 TYPE bapiret2.
CLEAR:gs\_wbs\_bus2054\_new.
gs\_wbs\_bus2054\_new-wbs\_element = 'NPD-2022038'."gs\_wbs-posid. "工作分解结构元素 (WBS 元素)
gs\_wbs\_bus2054\_new-description = '第一层'."gs\_wbs-post1. "PS: 短描述 (第一行文本)
gs\_wbs\_bus2054\_new-responsible\_no = '80000667'."lv\_vernr. "项目经理编号
*gs\_wbs\_bus2054\_new-profit\_ctr = ''."gs\_wbs-prctr. "利润中心
gs\_wbs\_bus2054\_new-proj\_type = '11'."gs\_wbs-prart. "项目类型
gs\_wbs\_bus2054\_new-wbs\_account\_assignment\_element = 'X'."gs\_wbs-belkz. "标志:科目分配元素
*gs\_wbs\_bus2054\_new-wbs\_billing\_element = ''."gs\_wbs-fakkz. "标识符: 开票元素
gs\_wbs\_bus2054\_new-wbs\_left = ''."gs\_wbs-left\_posid."左侧WBS
gs\_wbs\_bus2054\_new-wbs\_up = ''."gs\_wbs-up\_posid. "上级WBS
*gs\_wbs\_bus2054\_new-user\_field\_char20\_1 = ''."gs\_wbs-usr00. "业务类别
*gs\_wbs\_bus2054\_new-user\_field\_char20\_2 = ''."gs\_wbs-usr01. "CRM 商机编码
*gs\_wbs\_bus2054\_new-user\_field\_char10\_1 = ''."'X'. "产品
*gs\_wbs\_bus2054\_new-statistical = ''."gs\_wbs-xstat. "统计
*gs\_wbs\_bus2054\_new-wbs\_cctr\_posted\_actual = ''."gs\_wbs-kostl. "CCtr 过账
APPEND gs\_wbs\_bus2054\_new TO gt\_wbs\_bus2054\_new.
CLEAR:gs\_wbs\_bus2054\_new.
gs\_wbs\_bus2054\_new-wbs\_element = 'NPD-2022038.001'."gs\_wbs-posid. "工作分解结构元素 (WBS 元素)
gs\_wbs\_bus2054\_new-description = '第二层'."gs\_wbs-post1. "PS: 短描述 (第一行文本)
gs\_wbs\_bus2054\_new-responsible\_no = '80000667'."lv\_vernr. "项目经理编号
*gs\_wbs\_bus2054\_new-profit\_ctr = ''."gs\_wbs-prctr. "利润中心
gs\_wbs\_bus2054\_new-proj\_type = '11'."gs\_wbs-prart. "项目类型
gs\_wbs\_bus2054\_new-wbs\_account\_assignment\_element = 'X'."gs\_wbs-belkz. "标志:科目分配元素
*gs\_wbs\_bus2054\_new-wbs\_billing\_element = ''."gs\_wbs-fakkz. "标识符: 开票元素
gs\_wbs\_bus2054\_new-wbs\_left = ''."gs\_wbs-left\_posid."左侧WBS
gs\_wbs\_bus2054\_new-wbs\_up = 'NPD-2022038'."gs\_wbs-up\_posid. "上级WBS
*gs\_wbs\_bus2054\_new-user\_field\_char20\_1 = ''."gs\_wbs-usr00. "业务类别
*gs\_wbs\_bus2054\_new-user\_field\_char20\_2 = ''."gs\_wbs-usr01. "CRM 商机编码
*gs\_wbs\_bus2054\_new-user\_field\_char10\_1 = ''."'X'. "产品
*gs\_wbs\_bus2054\_new-statistical = ''."gs\_wbs-xstat. "统计
*gs\_wbs\_bus2054\_new-wbs\_cctr\_posted\_actual = ''."gs\_wbs-kostl. "CCtr 过账
APPEND gs\_wbs\_bus2054\_new TO gt\_wbs\_bus2054\_new.
CLEAR:gs\_wbs\_bus2054\_new.
gs\_wbs\_bus2054\_new-wbs\_element = 'NPD-2022038.002'."gs\_wbs-posid. "工作分解结构元素 (WBS 元素)
gs\_wbs\_bus2054\_new-description = '第三层'."gs\_wbs-post1. "PS: 短描述 (第一行文本)
gs\_wbs\_bus2054\_new-responsible\_no = '80000667'."lv\_vernr. "项目经理编号
*gs\_wbs\_bus2054\_