Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_COPAACTUALS_POSTCOSTDATA

Former Member
0 Likes
604

I used the test funciton module of " BAPI_COPAACTUALS_POSTCOSTDATA" to post a line item to CO-PA, I got no message in the return table, however, I also cannot find the line item from KE24. How do I know my posting is successful or not? Will there be any message if it is posted successfully?

Thanks in advance,

Vicki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
521

Hi,

Code your program like this and you will get know if your program is successfull:

CALL FUNCTION 'BAPI_COPAACTUALS_POSTCOSTDATA'
EXPORTING
operatingconcern = p_oc 
testrun = p_test 
TABLES
inputdata = it_ipdata 
fieldlist = it_flist 
return = it_ret. 

READ TABLE it_ret WITH KEY type = 'E'. 

IF sy-subrc NE 0. IF sy-subrc NE 0.
READ TABLE it_ret WITH KEY type = 'A'. 
ENDIF.

IF sy-subrc = 0. 
* error. * Error.

WRITE : / 'Upload error...'. 

LOOP AT it_ret INTO ret.t.

WRITE : / ret-type , ret-id , ret-number, 
ret-message, ret-log_no, 
ret-message_v1, ret-message_v2,
ret-message_v3, ret-message_v4. 

ENDLOOP.
SKIP 1. 

ELSE.

IF p_test = ' '. 
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' 
EXPORTING
wait = 'X' 
* IMPORTING * 
* RETURN = 
.
WRITE : 'List of Records uploaded...'.
ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
522

Hi,

Code your program like this and you will get know if your program is successfull:

CALL FUNCTION 'BAPI_COPAACTUALS_POSTCOSTDATA'
EXPORTING
operatingconcern = p_oc 
testrun = p_test 
TABLES
inputdata = it_ipdata 
fieldlist = it_flist 
return = it_ret. 

READ TABLE it_ret WITH KEY type = 'E'. 

IF sy-subrc NE 0. IF sy-subrc NE 0.
READ TABLE it_ret WITH KEY type = 'A'. 
ENDIF.

IF sy-subrc = 0. 
* error. * Error.

WRITE : / 'Upload error...'. 

LOOP AT it_ret INTO ret.t.

WRITE : / ret-type , ret-id , ret-number, 
ret-message, ret-log_no, 
ret-message_v1, ret-message_v2,
ret-message_v3, ret-message_v4. 

ENDLOOP.
SKIP 1. 

ELSE.

IF p_test = ' '. 
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' 
EXPORTING
wait = 'X' 
* IMPORTING * 
* RETURN = 
.
WRITE : 'List of Records uploaded...'.
ENDIF.

Read only

0 Likes
521

The test funciton module will not do the COMMIT, therefore no line item is really posted even afrer succesful test. Thanks for the reminder.