Modify operation Code

 CLASS ycl_modify_practice DEFINITION

PUBLIC

FINAL

CREATE PUBLIC .


PUBLIC SECTION.

INTERFACES if_oo_adt_classrun .

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.




CLASS ycl_modify_practice IMPLEMENTATION.

METHOD if_oo_adt_classrun~main.

*MODIFY ENTITY, ENTITIES, field_spec

*1->... { FROM fields_tab }

* CREATE, CREATE BY, UP☺DATE, DELETE, EXECUTE

* For DELETE, EXECUTE we can use this option only

* The %control structure must be filled explicitly in the internal table fields_tab for CREATE, CREATE BY and UPDATE

* DATA : lt_book TYPE TABLE FOR CREATE yi_travel_tech_m\_Booking.

* MODIFY ENTITY yi_travel_tech_m

* CREATE FROM VALUE #(

* ( %cid = 'cid1'

* %data-BeginDate = '20240225'

* %control-BeginDate = if_abap_behv=>mk-on

*

* ) )

* CREATE BY \_Booking

* FROM VALUE #( ( %cid_ref = 'cid1'

* %target = VALUE #( ( %cid = 'cid11'

* %data-bookingdate = '20240216'

* %control-Bookingdate = if_abap_behv=>mk-on ) )

*

*

*

* ) )

* FAILED FINAL(it_failed)

* MAPPED FINAL(it_mapped)

* REPORTED FINAL(it_result).


* IF it_failed IS NOT INITIAL.

* out->write( it_failed ).

* ELSE.

* COMMIT ENTITIES.

* ENDIF.



* MODIFY ENTITY yi_booking_tech_m

* DELETE FROM VALUE #( ( %key-TravelId = '0000004187'

* %key-BookingId = '0010' ) )

* FAILED FINAL(it_failed1)

* MAPPED FINAL(it_mapped1)

* REPORTED FINAL(it_result1).

* .

* IF it_failed1 IS NOT INITIAL.

* out->write( it_failed1 ).

* ELSE.

* COMMIT ENTITIES.

* ENDIF.

*☺


*2-> | { AUTO FILL CID WITH fields_tab }

* MODIFY ENTITY yi_travel_tech_m

* CREATE AUTO FILL CID WITH VALUE #(

* ( %data-BeginDate = '20240229'

* %control-BeginDate = if_abap_behv=>mk-on

*

* ) )

* FAILED FINAL(it_failed)

* MAPPED FINAL(it_mapped)

* REPORTED FINAL(it_result).

*

* IF it_failed IS NOT INITIAL.

* out->write( it_failed ).

* ELSE.

** COMMIT ENTITIES.

* ENDIF.

*3-> | { [AUTO FILL CID] FIELDS ( comp1 comp2 ... ) WITH fields_tab }


* MODIFY ENTITIES OF yi_travel_tech_m

* ENTITY yi_travel_tech_m

* UPDATE FIELDS ( BeginDate )

* WITH VALUE #( ♥m

* DELETE FROM VALUE #( ( TravelId = '0000004188' ) ) .

* COMMIT ENTITIES.

*4-> | { [AUTO FILL CID] SET FIELDS WITH fields_tab } ...☺

MODIFY ENTITY yi_travel_tech_m

UPDATE SET FIELDS WITH VALUE #( ( %key-TravelId = '0000004190'

BeginDate = '20240325' ) ).


COMMIT ENTITIES.


ENDMETHOD.


ENDCLASS.

Comments

Popular posts from this blog

AMDP ( ABAP Managed Database Procedure ) Part - 1

Backup all ADT Objects & Other queries RAP Part 10.1

SAP CDS Introduction Part 2 - ABAP on HANA Course