Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3146718
  • 博文数量: 238
  • 博客积分: 864
  • 博客等级: 军士长
  • 技术积分: 2940
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-08 23:01
个人简介

Mobile: 135 8576 5961 / WeChat: IM_WILLIAM_C / Mail: william.chen.cn@outlook.com /

文章分类

全部博文(238)

文章存档

2018年(2)

2016年(35)

2015年(47)

2014年(104)

2013年(38)

2012年(12)

分类: IT业界

2014-06-01 15:05:41

  • BAPI_ACC_DOCUMENT_REV_CHECK会计凭证冲销前检查

 

REPORT RODERICK.

 

TABLES: BKPF.

DATA P_BUKRS TYPE BUKRS VALUE '9900'.

DATA P_BELNR TYPE BSEG-BELNR VALUE '0100000335'.

DATA P_GJAHR TYPE BSEG-GJAHR VALUE '2011'.

DATA P_BUDAT TYPE BKPF-BUDAT VALUE '20110126'.

DATA:P_AWKEY TYPE AWKEY.

DATA P_SUBRC TYPE SY-SUBRC.

 

DATA: W_BELNR TYPE BELNR_D,

W_REVERSAL TYPE BAPIACREV,

WT_RETURN TYPE STANDARD TABLE OF BAPIRET2,

WA_RETURN TYPE BAPIRET2.

 

CLEAR P_SUBRC.

 

SELECT SINGLE * FROM BKPF

WHERE BUKRS EQ P_BUKRS AND BELNR EQ P_BELNR

AND GJAHR EQ P_GJAHR.

*

CHECK BKPF-BLART = 'SA'.

SY-UNAME = BKPF-USNAM.

* CONCATENATE W_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY.

W_REVERSAL-OBJ_TYPE = BKPF-AWTYP.

CONCATENATE P_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY_R.

W_REVERSAL-OBJ_KEY = W_REVERSAL-OBJ_KEY_R.

W_REVERSAL-OBJ_KEY = '$'.

 

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

OWN_LOGICAL_SYSTEM = W_REVERSAL-OBJ_SYS

EXCEPTIONS

OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1

OTHERS = 2.

 

W_REVERSAL-REASON_REV = '01'.

W_REVERSAL-PSTNG_DATE = P_BUDAT.

 

CALL FUNCTION 'BAPI_ACC_DOCUMENT_REV_CHECK'

EXPORTING

REVERSAL = W_REVERSAL

BUS_ACT = 'RFBU'

TABLES

RETURN = WT_RETURN.

 

BREAK-POINT.

 

LOOP AT WT_RETURN INTO WA_RETURN WHERE TYPE CA 'EA'.

P_SUBRC = 4.

EXIT.

ENDLOOP.

 

  • BAPI_ACC_DOCUMENT_REV_POST会计凭证冲销

REPORT RODERICK.

 

TABLES: BKPF.

DATA P_BUKRS TYPE BUKRS VALUE '9900'.

DATA P_BELNR TYPE BSEG-BELNR VALUE '0100000335'.

DATA P_GJAHR TYPE BSEG-GJAHR VALUE '2011'.

DATA P_BUDAT TYPE BKPF-BUDAT VALUE '20110126'.

DATA P_AWKEY TYPE AWKEY.

DATA P_SUBRC TYPE SY-SUBRC.

 

DATA: W_BELNR TYPE BELNR_D,

W_REVERSAL TYPE BAPIACREV,

WT_RETURN TYPE STANDARD TABLE OF BAPIRET2,

WA_RETURN TYPE BAPIRET2.

 

CLEAR P_SUBRC.

 

SELECT SINGLE * FROM BKPF

WHERE BUKRS EQ P_BUKRS AND BELNR EQ P_BELNR

AND GJAHR EQ P_GJAHR.

*

CHECK BKPF-BLART = 'SA'.

SY-UNAME = BKPF-USNAM.

* CONCATENATE W_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY.

W_REVERSAL-OBJ_TYPE = BKPF-AWTYP.

CONCATENATE P_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY_R.

W_REVERSAL-OBJ_KEY = W_REVERSAL-OBJ_KEY_R.

W_REVERSAL-OBJ_KEY = '$'.

 

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

OWN_LOGICAL_SYSTEM = W_REVERSAL-OBJ_SYS

EXCEPTIONS

OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1

OTHERS = 2.

 

W_REVERSAL-REASON_REV = '01'.

W_REVERSAL-PSTNG_DATE = P_BUDAT.

 

CALL FUNCTION 'BAPI_ACC_DOCUMENT_REV_POST'

EXPORTING
REVERSAL = W_REVERSAL BUS_ACT = 'RFBU'

IMPORTING

* OBJ_TYPE =

OBJ_KEY = P_AWKEY

* OBJ_SYS =

TABLES RETURN = WT_RETURN.

LOOP AT WT_RETURN INTO WA_RETURN WHERE TYPE CA EA.

P_SUBRC = 4.

EXIT.

ENDLOOP. 

阅读(8246) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~