Skip to Content
0
Former Member
Dec 09, 2008 at 03:53 PM

bapi creates invoices but doesnt save them

172 Views

Hi gurus ,

I am calling a bapi in tasks . The bapi is creating invoices but it is not saving them . I tried commit work and wait after the code and still it is not saving. If I call this bapi in another functin module and call this function module as tasks in the program , then it creates aswell as saves.. what could be the problem. here is my code :

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'

STARTING NEW TASK 'TASK1' "v_task

destination 'NONE'

PERFORMING set_function1_done ON END OF TASK

EXPORTING

headerdata = g_inv_header

  • IMPORTING

  • INVOICEDOCNUMBER = G_INVOICE

  • FISCALYEAR = G_FYEAR

TABLES

itemdata = g_inv_itemdata

accountingdata = g_inv_accdata

glaccountdata = g_inv_gldata

withtaxdata = g_inv_withtaxdata

return = g_inv_return.

wait until v_done = 'X'.

clear v_done.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

**********************************************

FORM set_function1_done USING taskname.

RECEIVE RESULTS FROM FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'

IMPORTING

invoicedocnumber = g_invoice

fiscalyear = g_fyear

TABLES

itemdata = g_inv_itemdata

accountingdata = g_inv_accdata

glaccountdata = g_inv_gldata

withtaxdata = g_inv_withtaxdata

return = g_inv_return.

v_done = 'X'.

ENDFORM.