When you use bapi to update the data of sap standard table, when you use
BAPI_TRANSACTION_COMMIT
function and set wait = ‘X’, but some times it doesn't work.
MAYBE LIKE THIS
LOOP.
CALL function 'BAPI_XXXXX'
CALL function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
endloop.
The reason is there are many functions called in update task in the bapi.
when the commit command is executed,the functions registered in update task
begin to execute.
You can get the data from vbdata vbmod table and execute them before commit command. when all functions where executed you can delete the data from vbmod
and vbkey table.
2018年6月13日星期三
abap GET VBKEY of CALL FUNCTION IN UPDATE TASK
When we call a function in update task, it stores the data in vbmod, vbhrd and vbdata table.
How to get the vbkey of the current transaction.
DATA:TH_OPCODE(1) TYPE X. "#EC *
CONSTANTS: START_VB LIKE TH_OPCODE VALUE 1,"#EC *
GET_VB_KEY LIKE TH_OPCODE VALUE 2.
TYPES: begin of %_vbkey,
head(2),
vbkey type vbdata-vbkey,
end of %_vbkey.
DATA: l_enqkey type eqeusrvb,
l_vbkey type %_vbkey,
l_enqdone type c length 1.
DATA: lt_psguid_ins TYPE TABLE OF psguid WITH HEADER LINE.
DATA: ls_psguid_ins LIKE psguid.
DATA: lt_psguid_upd TYPE TABLE OF psguid WITH HEADER LINE.
DATA: ls_psguid_upd LIKE psguid.
CALL FUNCTION 'PS_GUID_POST' in update task
TABLES
PSGUID_INS = lt_psguid_ins
PSGUID_UPD = lt_psguid_upd.
CALL 'ThVBCall' id 'OPCODE' field get_vb_key
id 'VBKEY' field l_vbkey-vbkey "#EC *
id 'ENQKEY' field l_enqkey
id 'ENQDONE' field l_enqdone.
ThvbCALL will retrieve vbkey value and stored it in variant get_vb_key.
You can use vbkey to get data from vbdata vbmod vbhrd table.
How to get the vbkey of the current transaction.
DATA:TH_OPCODE(1) TYPE X. "#EC *
CONSTANTS: START_VB LIKE TH_OPCODE VALUE 1,"#EC *
GET_VB_KEY LIKE TH_OPCODE VALUE 2.
TYPES: begin of %_vbkey,
head(2),
vbkey type vbdata-vbkey,
end of %_vbkey.
DATA: l_enqkey type eqeusrvb,
l_vbkey type %_vbkey,
l_enqdone type c length 1.
DATA: lt_psguid_ins TYPE TABLE OF psguid WITH HEADER LINE.
DATA: ls_psguid_ins LIKE psguid.
DATA: lt_psguid_upd TYPE TABLE OF psguid WITH HEADER LINE.
DATA: ls_psguid_upd LIKE psguid.
CALL FUNCTION 'PS_GUID_POST' in update task
TABLES
PSGUID_INS = lt_psguid_ins
PSGUID_UPD = lt_psguid_upd.
CALL 'ThVBCall' id 'OPCODE' field get_vb_key
id 'VBKEY' field l_vbkey-vbkey "#EC *
id 'ENQKEY' field l_enqkey
id 'ENQDONE' field l_enqdone.
ThvbCALL will retrieve vbkey value and stored it in variant get_vb_key.
You can use vbkey to get data from vbdata vbmod vbhrd table.
订阅:
博文 (Atom)
Customer Characteristic
Characteristic Descriptions are stored in the table - CABNT - Language - SPRAS - Characteristic description - ATBEZ Characteristic Values ...
-
REPORT ZBPADD2 . DATA : L_PARTN_CAT TYPE BAPIBUS1006_HEAD - PARTN_CAT , LS_CENTRAL TYPE BAPIBUS1006_CENTRAL , ...
-
HEADER: ADD Customer Fields to structure of IMKPF and BAPI_TE_XMKPF. Items: ADD Customer Fields to structure of IMSEG and BAPI_TE_XMSEG....
-
FUNCTION:SD_SALESDOCUMENT_CREATE Append fiels to Structure below. BAPE_VBAP BAPE_VBAPX VBAPKOZ VBAPKOZX No need to append fields to Struc...