DATA:lt_a1 TYPE TABLE OF bapi_act_mnt_system_status,
lw_a1 TYPE bapi_act_mnt_system_status.
DATA:bapireturn1 LIKE bapireturn1.
DATA:bapi_status_result LIKE TABLE OF bapi_status_result.
DATA gw_ztif_log TYPE ztif_log.
TYPES :BEGIN OF lv_afvc,
aufpl TYPE afvc-aufpl,
aplzl TYPE afvc-aplzl,
vornr TYPE afvc-vornr,
ltxa1 TYPE afvc-ltxa1,
END OF lv_afvc.
DATA : lt_afvc TYPE TABLE OF lv_afvc,
lw_afvc TYPE lv_afvc.
DATA:lv_edit(1) TYPE c.
TYPES:BEGIN OF ls_return,
aufpl TYPE afko-aufpl,
vornr TYPE afvc-vornr,
ot_tab LIKE bapiret2,
* INCLUDE TYPE zsps014.
END OF ls_return.
DATA: input TYPE string.
DATA:lt_return TYPE TABLE OF ls_return,
lw_return TYPE ls_return.
DATA:ot_afvc TYPE TABLE OF afvc,
ow_afvc TYPE afvc.
DATA:ls_damo TYPE afko-aufpl .
CALL METHOD /ui2/cl_json=>serialize
EXPORTING
data = gt_data
RECEIVING
r_json = input.
CLEAR gw_ztif_log.
gw_ztif_log-guid = cl_system_uuid=>create_uuid_x16_static( ). "获取16位流水码
gw_ztif_log-zinput = input.
gw_ztif_log-zzifnum = 'ZPSIF014'.
gw_ztif_log-zin_datum = sy-datum. "传入 日期 时间
gw_ztif_log-zin_uzeit = sy-uzeit.
gw_ztif_log-uname = sy-uname.
MODIFY ztif_log FROM gw_ztif_log.
CLEAR gt_data1[].
APPEND LINES OF gt_data TO gt_data1.
SORT gt_data1 BY zzscdd zzhxm.
DELETE ADJACENT DUPLICATES FROM gt_data1.
DATA:lv_ltxa1 TYPE afvc-ltxa1.
DELETE gt_data WHERE zzscdd IS INITIAL AND zzhxm IS INITIAL .
LOOP AT gt_data1 ASSIGNING <fs>.
IF <fs>-zzfglx = '1' OR <fs>-zzhsbs = '3' .
CLEAR :lv_aufpl,lv_aplzl,lv_aufnr ,lv_vornr.
SELECT SINGLE aufpl aplzl FROM afvu INTO (lv_aufpl,lv_aplzl) WHERE zzscdd = <fs>-zzscdd AND zzhxm = <fs>-zzhxm. "
IF lv_aufpl IS NOT INITIAL AND lv_aplzl IS NOT INITIAL.
SELECT SINGLE aufnr FROM afko INTO lv_aufnr WHERE aufpl = lv_aufpl. " 取得网络号
SELECT aufpl aplzl vornr ltxa1 FROM afvc INTO TABLE lt_afvc WHERE aufpl = lv_aufpl AND aplzl = lv_aplzl
ORDER BY vornr DESCENDING."取得作业号
CLEAR :lv_vornr ,lv_ltxa1.
READ TABLE lt_afvc INTO lw_afvc INDEX 1.
IF sy-subrc = 0.
lv_vornr = lw_afvc-vornr.
lv_ltxa1 = lw_afvc-ltxa1.
CLEAR lw_afvc.
ENDIF.
lw_a1-activity = lv_vornr.
lw_a1-set_system_status = 'DLFL'.
APPEND lw_a1 TO lt_a1.
CLEAR :bapireturn1,bapi_status_result[].
CALL FUNCTION 'BAPI_PS_INITIALIZATION'. " 初始化
SET UPDATE TASK LOCAL." 按本地进程一个个提交
CALL FUNCTION 'BAPI_BUS2002_SET_STATUS' " 更改状态
EXPORTING
number = lv_aufnr
* undo_system_status = '标记'
* UNDO_USER_STATUS =
* set_system_status = '标记'
* SET_USER_STATUS =
IMPORTING
return = bapireturn1
TABLES
i_activity_system_status = lt_a1
* I_ACTIVITY_USER_STATUS =
e_result = bapi_status_result.
CLEAR ztwldd.
CALL FUNCTION 'BAPI_PS_PRECOMMIT' " 写入前校验
TABLES
et_return = ztwldd.
CLEAR lv_edit.
LOOP AT ztwldd INTO zwwldd .
IF zwwldd-type = 'E' OR zwwldd-type = 'A' .
lv_edit = 'X'.
lw_return-aufpl = lv_network.
lw_retu
SAP-HANA/S4 ABAP / CJ20,CJ20N BAPI 创建网络,创建作业,创建作业(BOM)项
最新推荐文章于 2023-12-25 13:51:56 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)