ABAP KP26 批量更改作业类型/作业价格计划
Posted 狗尾巴草_lan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ABAP KP26 批量更改作业类型/作业价格计划相关的知识,希望对你有一定的参考价值。
ABAP KP26 批量更改作业类型/作业价格计划
实现方式是调用 BAPI_COSTACTPLN_POSTACTOUTPUT,
需留意参数PERVALUE-PRICE_FIX_PERXX,其中XX为修改的期间,同理PERVALUE-PRICE_VAR_PERXX。
以下是我的示例程序,请欣赏~
DATA: LS_HEADERINFO TYPE BAPIPLNHDR,
LT_INDEXSTRUCTURE TYPE STANDARD TABLE OF BAPIACPSTRU,
LS_INDEXSTRUCTURE TYPE BAPIACPSTRU,
LT_COOBJECT TYPE STANDARD TABLE OF BAPIACPOBJ,
LS_COOBJECT TYPE BAPIACPOBJ,
LT_PERVALUE TYPE STANDARD TABLE OF BAPIACPVAL,
LS_PERVALUE TYPE BAPIACPVAL,
LT_RETURN TYPE STANDARD TABLE OF BAPIRET2,
LS_RETURN TYPE BAPIRET2.
LS_HEADERINFO-CO_AREA = 'MITH'. "控制范围
LS_HEADERINFO-FISC_YEAR = 2021. "会计年度
LS_HEADERINFO-PERIOD_FROM = 4. "从期间
LS_HEADERINFO-PERIOD_TO = 4. "终止期
LS_HEADERINFO-VERSION = '0'. "版本
LS_HEADERINFO-PLAN_CURRTYPE = 'C'. "流通计划
LS_INDEXSTRUCTURE-OBJECT_INDEX = 0001.
LS_INDEXSTRUCTURE-VALUE_INDEX = 0001.
APPEND LS_INDEXSTRUCTURE TO LT_INDEXSTRUCTURE.
CLEAR LS_INDEXSTRUCTURE.
LS_COOBJECT-OBJECT_INDEX = 0001.
LS_COOBJECT-COSTCENTER = '0000100006'. "成本中心
LS_COOBJECT-ACTTYPE = 'A00001'. "活动类型
APPEND LS_COOBJECT TO LT_COOBJECT.
CLEAR LS_COOBJECT.
LS_PERVALUE-VALUE_INDEX = 0001.
LS_PERVALUE-PRICE_FIX_PER04 = 9999. "价格(固定的)
LS_PERVALUE-PRICE_VAR_PER04 = 9999. "可变价格
LS_PERVALUE-PRICE_UNIT_PER04 = 1. "价格单位
LS_PERVALUE-CURRENCY = 'CNY'. "货币码
APPEND LS_PERVALUE TO LT_PERVALUE.
CLEAR LS_PERVALUE.
CALL FUNCTION 'BAPI_COSTACTPLN_POSTACTOUTPUT'
EXPORTING
HEADERINFO = LS_HEADERINFO
* DELTA = ' '
* PRICE_QUANT_PLAN = 'B'
TABLES
INDEXSTRUCTURE = LT_INDEXSTRUCTURE
COOBJECT = LT_COOBJECT
PERVALUE = LT_PERVALUE
* TOTVALUE =
* CONTRL =
RETURN = LT_RETURN.
LOOP AT LT_RETURN INTO LS_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
以上是关于ABAP KP26 批量更改作业类型/作业价格计划的主要内容,如果未能解决你的问题,请参考以下文章