Update
This commit is contained in:
@@ -482,6 +482,7 @@ CLASS lhc_root IMPLEMENTATION.
|
|||||||
|
|
||||||
"When parent instances are marked for deletion, child instances with the shared key should be marked as well.
|
"When parent instances are marked for deletion, child instances with the shared key should be marked as well.
|
||||||
LOOP AT lcl_buffer=>child_buffer ASSIGNING FIELD-SYMBOL(<del_ch>) WHERE instance-key_field = <delete>-key_field.
|
LOOP AT lcl_buffer=>child_buffer ASSIGNING FIELD-SYMBOL(<del_ch>) WHERE instance-key_field = <delete>-key_field.
|
||||||
|
<del_ch>-changed = abap_false.
|
||||||
<del_ch>-deleted = abap_true.
|
<del_ch>-deleted = abap_true.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
@@ -561,6 +562,9 @@ CLASS lhc_root IMPLEMENTATION.
|
|||||||
"- If it is true: Sequentially processing the instances in the %target table
|
"- If it is true: Sequentially processing the instances in the %target table
|
||||||
IF line_exists( lcl_buffer=>root_buffer[ instance-key_field = <cba>-key_field deleted = abap_false ] ).
|
IF line_exists( lcl_buffer=>root_buffer[ instance-key_field = <cba>-key_field deleted = abap_false ] ).
|
||||||
|
|
||||||
|
"If it exists, removing instance that is marked for deletion from the child transactional buffer since it gets replaced by a new one.
|
||||||
|
DELETE lcl_buffer=>child_buffer WHERE instance-key_field = <cba>-key_field AND deleted = abap_true.
|
||||||
|
|
||||||
LOOP AT <cba>-%target ASSIGNING FIELD-SYMBOL(<ch>).
|
LOOP AT <cba>-%target ASSIGNING FIELD-SYMBOL(<ch>).
|
||||||
|
|
||||||
"Adding instance to child buffer if it does not exist there and considering %control values
|
"Adding instance to child buffer if it does not exist there and considering %control values
|
||||||
@@ -865,16 +869,14 @@ CLASS lsc_zdemo_abap_rap_ro_u IMPLEMENTATION.
|
|||||||
"Deleting entries from database table
|
"Deleting entries from database table
|
||||||
DELETE zdemo_abap_rapt2 FROM TABLE @( CORRESPONDING #( child_keys ) ).
|
DELETE zdemo_abap_rapt2 FROM TABLE @( CORRESPONDING #( child_keys ) ).
|
||||||
"Deleting instances from child buffer
|
"Deleting instances from child buffer
|
||||||
"LOOP AT lcl_buffer=>child_buffer ASSIGNING FIELD-SYMBOL(<del_ch>).
|
DELETE lcl_buffer=>child_buffer WHERE instance-key_field = <del>-instance-key_field AND deleted = abap_true.
|
||||||
DELETE lcl_buffer=>child_buffer WHERE instance-key_field = <del>-instance-key_field AND deleted = abap_true.
|
|
||||||
"ENDLOOP.
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
"Processing the saving of create-by-association operations.
|
"Processing the saving of create-by-association operations.
|
||||||
DATA cba_tab TYPE TABLE OF zdemo_abap_rap_ch_u.
|
DATA cba_tab TYPE TABLE OF zdemo_abap_rap_ch_u.
|
||||||
|
|
||||||
IF line_exists( lcl_buffer=>child_buffer[ changed = abap_true ] ).
|
IF line_exists( lcl_buffer=>child_buffer[ changed = abap_true ] ).
|
||||||
LOOP AT lcl_buffer=>child_buffer ASSIGNING FIELD-SYMBOL(<cba>) WHERE changed = abap_true.
|
LOOP AT lcl_buffer=>child_buffer ASSIGNING FIELD-SYMBOL(<cba>) WHERE changed = abap_true AND deleted = abap_false.
|
||||||
APPEND CORRESPONDING #( <cba>-instance ) TO cba_tab.
|
APPEND CORRESPONDING #( <cba>-instance ) TO cba_tab.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
MODIFY zdemo_abap_rapt2 FROM TABLE @( CORRESPONDING #( cba_tab ) ).
|
MODIFY zdemo_abap_rapt2 FROM TABLE @( CORRESPONDING #( cba_tab ) ).
|
||||||
|
|||||||
Reference in New Issue
Block a user