月度归档:2014年12月

关于程序中使用BAPI_ACC_DOCUMENT_POST做会计凭证不触发BTE

使用事务码做凭证时都会走BTE的逻辑,但使用BAPI_ACC_DOCUMENT_POST做凭证时,发现并不会走原先的BTE,处理办法:

需另写逻辑,使用PROCESS BTE事件:RWBAPI01,函数:SAMPLE_INTERFACE_RWBAPI01。

相关Note:487722 – Using EXTENSION1 for accounting BAPIs

注意:调用bapi时必须给参数EXTENSION1赋值

 

ALV GRID的单选RadioButton

关于SAP PS模块的一些BAPI

Method ProjectDefinitionPI:
BAPI Method
BAPI_BUS2001_CREATE ProjectDefinitionPI.CreateSingle
BAPI_BUS2001_CHANGE ProjectDefinitionPI.Change
BAPI_BUS2001_DELETE ProjectDefinitionPI.Delete
BAPI_BUS2001_SET_STATUS ProjectDefinitionPI.SetStatus

Method WBSPI:
BAPI Method
BAPI_BUS2054_CREATE_MULTI WBSPI.CreateMultiple
BAPI_BUS2054_CHANGE_MULTI WBSPI.ChangeMultiple
BAPI_BUS2054_DELETE_MULTI WBSPI.DeleteMultiple
BAPI_BUS2001_SET_STATUS WBSPI.SetStatus

Method NetworkPI
BAPI Method
BAPI_BUS2002_CREATE NetworkPI.CreateFromData
BAPI_BUS2002_CHANGE NetworkPI.Change
BAPI_BUS2002_DELETE NetworkPI.Delete
BAPI_BUS2002_ACT_CREATE_MULTI NetworkPI.ActCreateMultiple
BAPI_BUS2002_ACT_CHANGE_MULTI NetworkPI.ActChangeMultiple
BAPI_BUS2002_ACT_DELETE_MULTI NetworkPI.ActDeleteMultiple
BAPI_BUS2002_ACTELEM_CREATE_M NetworkPI.ActElemCreateMultiple
BAPI_BUS2002_ACTELEM_CHANGE_M NetworkPI.ActElemChangeMultiple
BAPI_BUS2002_ACTELEM_DELETE_M NetworkPI.ActElemDeleteMultiple
BAPI_BUS2002_SET_STATUS NetworkPI.SetStatus

One or more of the above individual BAPIs can be called within a LUW.

You finish the current LUW by calling the BAPIs “BAPI_PS_PRECOMMIT ” and “BAPI_TRANSACTION_COMMIT”, in that order.

关于SAP的号码范围的那些事儿 (SAP number range)

1.Number Range的通用Tcode:SNRO
2.Number Range的通用读取函数:NUMBER_GET_NEXT
3.如有跳号现象,可以禁用对象的Buffer试试
4.几个关于Number Range的函数组:
SNR0  Online maint. of number ranges & groups
SNR1  Interface for number ranges and groups
SNR2  Maintenance of number range objects
SNR3  Number range checks, assignment & info.
SNR4  Number ranges utility
5.使用自定义的number range objects
1).Create number range object using OYSN (或者SNRO).
2).Then call the following function modules.
FORM. get_next_id CHANGING p_discrep.
DATA: last_id LIKE zrecaudit-discrep,
quant   LIKE inri-quantity,    “dummy
code    LIKE inri-returncode. “returncode
CALL FUNCTION ‘NUMBER_RANGE_ENQUEUE’
EXPORTING
object           = ‘ZRECAUDIT’
EXCEPTIONS
foreign_lock     = 1
object_not_found = 2
system_failure   = 3
OTHERS           = 4.
IF sy-subrc = 0.
CALL FUNCTION ‘NUMBER_GET_NEXT’
EXPORTING
nr_range_nr             = ’01’
object                  = ‘ZRECAUDIT’
IMPORTING
number                  = last_id
quantity                = quant
returncode              = code
EXCEPTIONS
interval_not_found      = 1
number_range_not_intern = 2
object_not_found        = 3
quantity_is_0           = 4
quantity_is_not_1       = 5
interval_overflow       = 6
buffer_overflow         = 7
OTHERS                  = 8.
CALL FUNCTION ‘NUMBER_RANGE_DEQUEUE’
EXPORTING
object           = ‘ZRECAUDIT’
EXCEPTIONS
object_not_found = 1
OTHERS           = 2.
ENDIF.
ENDFORM.                    ” get_next_id
 
6.常用维护特定Number Range的Tcode:
5NZI Number range maintenance: RP_IRCERT
Number range maintenance: RP_IRCERT
ABNV Number range maint: FIAA-BELNR
Number range maint: FIAA-BELNR
AO11 Assign number range
分配编号范围
AS08 Number Ranges:Asset Number
号码范围:资产号码
BDCP Number range maintenance: ALE_CP
编号范围维护: ALE_CP
BG00 Number Range Maintenance: BGMK_NR
编码范围维护:BGMK_NR
BMVN Number Range Maintenance: DI_JOBID
编号范围维护: DI_JOBID
BUCF BP Cust: Number Ranges
BP 消费者: 编号范围
CFNA Maintain PRT number range: FHM_CRFH
维护PRT编号范围: FHM_CRFH
CMTCUS22 Maintain number range for CM product
维护 CM 产品的号码范围
CMTCUS32 Maintain number range for CM folder
维护 CM 文件夹的号码范围
CMTCUS42 Maintain number ranges for Baseline
维护起点的号码范围
FBN1 Accounting Document Number Ranges
科目凭证号码范围
FNS1 Collateral number range
附属编号区间
FOV0 Rental agreement number range
租用协议编号范围
FOW0 Real Estate application number range
不动产应用的数据范围
IN20 Object link number ranges
对象连接号码范围
IP22 Maintain number range: OBJK_NR
维护编号范围:OBJK_NR
KEN2 Maint. number ranges: CO-PA planning
维护号吗范围: CO-PA计划
OGS9 Generate ADP number ranges
生成 ADP 编号范围
OHX3 Maintain number ranges for 3PR
维护 3PR 的编号范围
OIL5 Equipment number ranges
设备编号范围
OION Order number ranges
订单编号范围
OMH6 Number Ranges for Purch. Documents
采购凭证的号码范围
QCCN QM standard number ranges
质量管理标准码范围
QS29 Maintain characteristic number range
维护特性编号范围
QS39 Maintain method number range
编号范围维护方式
VB(1 Rebate number ranges
回扣号范围
VN07 Maintain number range for shipments
维护装运的编号范围
WC64 Catalog code number ranges
类别代码编号范围
WTNR w/tax certificate number range
w/tax certificate number range

根据条件类型取得相应KONP条件表记录数据

显示ABAP开发记录

该report能够显示对于某一developer,在某一时间段之内的开发记录:
输入developer name及想要查询开发记录的时间段:
 
执行后能看到所有在该时间段内修改过的ABAP class, report以及function module名称。
 
双击某行能自动打开ABAP editor查看code:
 

代码如下:

按月统计tcode和report使用次数的工具

执行report,输入要查询的日期和user,

工具会按照使用次数从高到低列出输入日期所在的月份内所有该user 曾经使用过的tcode 和report list:

 

代码如下:

 REPORT zusertcode.

PARAMETER: month TYPE dats DEFAULT sy-datum OBLIGATORY,

user type usr02-bname OBLIGATORY DEFAULT sy-uname.

TYPES: BEGIN OF zusertcode,

operation type char30,

type type char10,

count TYPE swncshcnt,

END OF zusertcode.

TYPES: tt_zusertcode TYPE STANDARD TABLE OF zusertcode WITH KEY operation type.

DATA: lt_usertcode TYPE swnc_t_aggusertcode,

wa_usertcode TYPE swncaggusertcode,

wa TYPE zusertcode,

t_ut TYPE tt_zusertcode,

ls_result TYPE zusertcode,

lt_result TYPE tt_zusertcode.

CONSTANTS: cv_tcode TYPE char30 VALUE ‘Tcode’,

cv_report TYPE char30 VALUE ‘Report’,

cv_count TYPE char5 value ‘Count’.

START-OF-SELECTION.

* Set date to the first day of the month

“month+6(2) = ’01’.

CALL FUNCTION ‘SWNC_COLLECTOR_GET_AGGREGATES’

EXPORTING

component = ‘TOTAL’

periodtype = ‘M’

periodstrt = month

TABLES

usertcode = lt_usertcode

EXCEPTIONS

no_data_found = 1

OTHERS = 2.

DELETE lt_usertcode WHERE tasktype <> ’01’.

LOOP AT lt_usertcode ASSIGNING FIELD-SYMBOL(<user>) WHERE account = user.

CLEAR: ls_result.

ls_result-operation = <user>-entry_id.

ls_result-type = <user>-entry_id+72.

ls_result-count = <user>-count.

COLLECT ls_result INTO lt_result.

ENDLOOP.

SORT lt_result BY count DESCENDING.

WRITE: 10 cv_tcode, 20 cv_report, 60 cv_count COLOR COL_NEGATIVE.

LOOP AT lt_result ASSIGNING FIELD-SYMBOL(<result>).

IF <result>-type = ‘T’.

WRITE: / <result>-operation COLOR COL_TOTAL UNDER cv_tcode,

<result>-count COLOR COL_POSITIVE UNDER cv_count.

ELSE.

WRITE: / <result>-operation COLOR COL_GROUP UNDER cv_report,

<result>-count COLOR COL_POSITIVE UNDER cv_count.

ENDIF.

ENDLOOP.