Created
August 18, 2012 02:15
-
-
Save jasper07/3383938 to your computer and use it in GitHub Desktop.
abap_gw_contacts_update_entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
METHOD contacts_update_entity. | |
DATA: ls_contact TYPE zcl_ztest1_mpc=>ts_contac. | |
DATA: lv_set_exp TYPE string. | |
*--- get existing value | |
me->contacts_get_entity( | |
EXPORTING | |
iv_entity_name = iv_entity_name | |
iv_entity_set_name = iv_entity_set_name | |
iv_source_name = iv_source_name | |
it_key_tab = it_key_tab | |
it_navigation_path = it_navigation_path | |
IMPORTING | |
er_entity = er_entity ). | |
*--- get new values | |
io_data_provider->read_entry_data( IMPORTING es_data = ls_contact ). | |
*--- overwrite updatable fields | |
MOVE: ls_contact-firstname TO er_entity-firstname, | |
ls_contact-lastname TO er_entity-lastname, | |
ls_contact-status TO er_entity-status, | |
ls_contact-phone_home TO er_entity-phone_home, | |
ls_contact-phone_office TO er_entity-phone_office, | |
ls_contact-phone_mobile TO er_entity-phone_mobile, | |
ls_contact-email TO er_entity-email. | |
GET TIME STAMP FIELD er_entity-updated. | |
*--- update contact | |
TRY. | |
UPDATE zat_contacts | |
SET firstname = er_entity-firstname | |
lastname = er_entity-lastname | |
status = er_entity-status | |
phone_home = er_entity-phone_home | |
phone_office = er_entity-phone_office | |
phone_mobile = er_entity-phone_mobile | |
email = er_entity-email | |
updated = er_entity-updated | |
WHERE handle = er_entity-handle. | |
CATCH cx_sy_dynamic_osql_error. | |
MESSAGE `Error in update!` TYPE 'I'. | |
ENDTRY. | |
COMMIT WORK. | |
ENDMETHOD. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment