Quantcast
Channel: SCN: Message List - BOPF Application Framework
Viewing all articles
Browse latest Browse all 726

Re: Delete Root

$
0
0

Hello Ronaldo,

 

in order to delete node instances you must use the corresponding core service "modify" instead of invoking an internal action. Please check the example below.

 

Best regards

Tilmann

 

 

Example:

 

Attention! This example deletes ALL instances of a BO - this is not would you like to do on the TOR object I guess

 

" get the service manager of the InvoiceBO
DATA lo_customer_invoice TYPE REF TO/bobf/if_tra_service_manager.
lo_customer_invoice = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( iv_bo_key=zif_ci_00_customer_invoice_c=>sc_bo_key ).

 

" query all existing invoices

DATA ls_root_key TYPE /bobf/s_frw_key.
DATA lt_root_key TYPE /bobf/t_frw_key.
lo_customer_invoice->query(
  EXPORTING iv_query_key = zif_ci_00_customer_invoice_c=>sc_query-root-select_all
  IMPORTING et_key = lt_root_key).

 

"delete all invoices
DATA ls_modification TYPE /bobf/s_frw_modification.
DATA lt_modification TYPE /bobf/t_frw_modification.
LOOP AT lt_root_key INTO ls_root_key.
  ls_modification-node = zif_ci_00_customer_invoice_c=>sc_node-root.
  ls_modification-key = ls_root_key-key.
  ls_modification-change_mode = /bobf/if_frw_c=>sc_modify_delete.
  APPENDls_modification TO lt_modification.
ENDLOOP.

 

"execute modification
lo_customer_invoice->modify( it_modification = lt_modification ).

 

"save the transaction
DATA lo_transaction_manager TYPE REF TO /bobf/if_tra_transaction_mgr.
lo_transaction_manager = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager().
lo_transaction_manager->save().

 

 


Viewing all articles
Browse latest Browse all 726


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>