Hi,
It seems you are trying to put commit work statement inside Update task. System throws a dump when you put commit work statement inside update function module.
Remove the statement
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN = return
.
WRITE: /'BAPI cal worked'.
You can separately add the FI document after the material document is created. By calling :
1) BAPI CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST' in background task in the exit.
2) Or create a wrapper FM . Call that FM in starting new task. Use while and wait statement to check whether document exists in the database (MKPF). If yes, call the BAPI 'BAPI_ACC_GL_POSTING_POST'. Disadvantage of this process is that , it opens a new session. If number of open session is more than 6-7( maintained in profile parameter) update fails.
Regards,
DPM