Abstract
While posting COPA document by BAPI "BAPI_COPAACTUALS_POSTCOSTDATA" , this BAPI
does not return successful records with generated copa document number.
But in case system need to capture generated copa doc number there is workaround with
implicit enhancement withing bapi as described in doc,
About the Domain
SAP ABAP/FICO module can use this document. This will help them to get generated COPA
document number which is posted by BAPI_COPAACTUALS_POSTCOSTDATA.
The step that needs to be followed is as below.
It's divided mainly into 2 section .
A. custom program
B. Enhancement
Create a Custom Program like ZCOPA_UPDATE .
Please follow steps given below for this program.
This indicator will make sure enhancement will be trigger only in case bapi will be called for custom program
gv_call_copa_bapi_indicator = 'Y' .
EXPORT gv_call_copa_bapi_indicator TO MEMORY ID 'ZCOPA_UPD_BAPI1'.
*To post Copa document
CALL FUNCTION 'BAPI_COPAACTUALS_POSTCOSTDATA'
EXPORTING
operatingconcern = ip_operatingconcern
testrun = ip_testrun
TABLES
inputdata = lt_bapi_copa_data
fieldlist = lt_bapi_copa_field
return = lt_return.
In case there is any record in return with message type E or A it means there is an error while generating copa doc , so do not import doc numner from ID 'ZCOPA_UPD_BAPI'
or have S,I,W message type.because doc number can be populated in error cases also as this enhancement from where exporting memory
ID 'ZCOPA_UPD_BAPI' is before actual posting , so always check return table (is initial or have S,I,W message type only)
IMPORT gv_memid_copadoc FROM MEMORY ID 'ZCOPA_UPD_BAPI' .
So gv_memid_copadoc will have copa document number which is generated.
Create a implicit enhancement like ZCOPA_ENH_UPDATE .
Please follow steps given below for this enhancement.
Which will be used during BAPI posting as this FM function to get next available document number for COPA posting , But actual posting will happen after this FM .
So at this stage we will be able to get COPA doc number which will be generated later on and confirm if there is no error in return table of BAPI .
As Actual copa posting perform is refreshing inputdata table , and not returning success message we need to use this way .
IMPORT gv_call_copa_bapi_indicator FROM MEMORY ID 'ZCOPA_UPD_BAPI1' .
if gv_call_copa_bapi_indicator EQ 'Y' .
then only create following steps
*As line item table type genric , so get doc no using field symbol
ASSIGN LINE_ITEM_TAB to <fs_copadoc>.
*As field symbol type any defined work area with belnr which contain copa doc no
MOVE-CORRESPONDING <fs_copadoc> to lw_line_item .
GV_MEMID_COPADOC = lw_line_item-belnr .
EXPORT GV_MEMID_COPADOC to memory id 'ZCOPA_UPD_BAPI'.
Copa document number will be retrieved successfully from BAPI.
This code could be used to get copa document number generated through BAPI psoting .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |