Skip to Content
0
Former Member
Jul 14, 2015 at 02:18 PM

Transaction service for persistent class: No COMMIT performed

120 Views

Hi there,

I have a Z table and a corresponding persistence class.

When I try to create a table record, it doesn't create the table entry.

This is a small test report:

REPORT ztest.

DATA:
r_transaction_mgr TYPE REF TO if_os_transaction_manager,
r_transaction TYPE REF TO if_os_transaction,
r_if_request_agent TYPE REF TO zca_if_requests,
r_if_request TYPE REF TO zcl_if_requests.

START-OF-SELECTION.

r_transaction_mgr = cl_os_system=>get_transaction_manager( ).
r_transaction = r_transaction_mgr->create_transaction( ).

TRY.
r_transaction->start( ).

r_if_request_agent = zca_if_requests=>agent.

* Create persistent object for ZFI_REQUESTS
r_if_request =
r_if_request_agent->create_persistent(
i_module_name = 'FI/CO'
i_interface_name = 'ORDER_INVOICES'
i_udate = sy-datum
i_utime = sy-uzeit
).

r_if_request->set_processed( 1 ).
r_if_request->set_not_processed( 1 ).

r_transaction->end( ).

CATCH cx_os_error.

r_transaction->undo( ).

ENDTRY.

It only works if I do a COMMIT WORK instead of r_transaction->end( ).

What can be the reason for that?


I've also tried to put

LOAD-OF-PROGRAM.
* set the transaction mode
cl_os_system=>init_and_set_modes(
i_external_commit = oscon_false
i_update_mode = oscon_dmode_direct
).

But then I get a short-dump (exception CX_OS_SYSTEM, ID SYSTEM_NOT_INITIAL).

Best regards,

Thorsten.