‎2008 Sep 02 7:17 AM
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
‎2008 Sep 02 8:49 AM
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.
‎2008 Sep 02 8:49 AM
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.
‎2008 Sep 03 10:05 AM
The test funciton module will not do the COMMIT, therefore no line item is really posted even afrer succesful test. Thanks for the reminder.