测试ABAP 分配WBS元素结算规则
Posted SAP剑客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了测试ABAP 分配WBS元素结算规则相关的知识,希望对你有一定的参考价值。
ABAP 分配WBS元素结算规则
DATA : LT_COBRB LIKE TABLE OF COBRB WITH HEADER LINE.
DATA : LV_OBJNR LIKE PRPS-OBJNR.
DATA : LV_TYPE TYPE CHAR01,
LV_MSG TYPE CHAR255.
PARAMETERS : P_PSPNR TYPE PS_POSNR OBLIGATORY.
PARAMETERS : P_ANLN1 TYPE ANLN1 OBLIGATORY.
START-OF-SELECTION.
*** 获取对象号
SELECT SINGLE OBJNR
FROM PRPS
INTO LV_OBJNR
WHERE PSPNR = P_PSPNR.
*** 检查结算规则是否存在
SELECT *
FROM COBRB
INTO CORRESPONDING FIELDS OF TABLE LT_COBRB
WHERE OBJNR = LV_OBJNR.
IF LT_COBRB[] IS NOT INITIAL.
CALL FUNCTION 'K_SRULE_SAVE_UTASK'
TABLES
* T_COBRA_INSERT =
* T_COBRA_UPDATE =
* T_COBRA_DELETE =
* T_COBRB_INSERT =
* T_COBRB_UPDATE =
T_COBRB_DELETE = LT_COBRB[]
EXCEPTIONS
SRULE_UTASK_ERROR = 1.
IF SY-SUBRC = 0 .
COMMIT WORK.WAIT UP TO 1 SECONDS.
ELSE.
LV_TYPE = 'E'.
LV_MSG = '结算规则存在且删除失败'.
EXIT.
ENDIF.
ENDIF.
CLEAR:LT_COBRB[].
*** 结算类型:FUL 完全结算
CALL FUNCTION 'CONVERSION_EXIT_PERBZ_INPUT'
EXPORTING
INPUT = 'FUL'
IMPORTING
OUTPUT = LT_COBRB-PERBZ.
*** 科目分配种类:FXA 固定资产
CALL FUNCTION 'CONVERSION_EXIT_OBART_INPUT'
EXPORTING
INPUT = 'FXA '
IMPORTING
OUTPUT = LT_COBRB-KONTY
EXCEPTIONS
NOT_FOUND = 1.
LT_COBRB-ANLN1 = P_ANLN1.
LT_COBRB-ANLN2 = '0000'.
LT_COBRB-OBJNR = LV_OBJNR.
LT_COBRB-LFDNR = '001'.
LT_COBRB-KOKRS = 'CN30'.
LT_COBRB-PROZS = '100.00'.
LT_COBRB-BUKRS = 'CN30'.
APPEND LT_COBRB.
CALL FUNCTION 'K_SRULE_SAVE_UTASK'
TABLES
* T_COBRA_INSERT =
* T_COBRA_UPDATE =
* T_COBRA_DELETE =
T_COBRB_INSERT = LT_COBRB[]
* T_COBRB_UPDATE =
* T_COBRB_DELETE =
EXCEPTIONS
SRULE_UTASK_ERROR = 1.
IF SY-SUBRC = 0 .
LV_TYPE = 'E'.
LV_MSG = '结算规则维护成功'.
COMMIT WORK.
ELSE.
LV_TYPE = 'E'.
LV_MSG = '结算规则维护失败'.
EXIT.
ENDIF.
END-OF-SELECTION.
WRITE : LV_TYPE,LV_MSG.
以上是关于测试ABAP 分配WBS元素结算规则的主要内容,如果未能解决你的问题,请参考以下文章