cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error when using Background Processing Framework in SAP RAP

JiriNovak2
Discoverer
0 Likes
708

Hello,

i want ta execute some logic through Background Processing Framework in SAP RAP event or action. It is on public cloud. My code:

 

DATA lo_project TYPE REF TO z_test_bgpf.

DATA lo_process TYPE REF TO if_bgmc_process_single_op.

DATA lx_bgmc TYPE REF TO cx_bgmc.

 

TRY.

lo_project = NEW #( iv_batchKey = is_project-batchKey ).

 

lo_process = cl_bgmc_process_factory=>get_default( )->create( ).

 

* lo_process->set_name( 'bgPF Demo' )->set_operation( lo_project ).

lo_process->set_operation_tx_uncontrolled( lo_project ).

lo_process->save_for_execution( ).

 

CATCH cx_bgmc INTO lx_bgmc.

ENDTRY.

 

I receiving ABAP dump on this line: lo_process->save_for_execution( ).

 

Short Text Statement "CALL " is not allowed with this status.
Runtime Error BEHAVIOR_ILLEGAL_STMT_IN_CALL

how can i solve this? 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

MioYasutake
SAP Champion
SAP Champion

@JiriNovak2 

When you are working with RAP, the set_operation method should be used instead of the set_operation_tx_uncontrolled method. Additionally, make sure to trigger BGPF in the save_modified method.

https://help.sap.com/docs/abap-cloud/abap-concepts/scenario-transcational-controlled

 

JiriNovak2
Discoverer
0 Likes
Trigger BGPF in save_modified solved my problem. Thanks