Support read and update operation on CUSTOMER_H extension fields

简介: Created by Jerry Wang, last modified on Dec 24, 2015

import note 2183832, and then:


/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITY - no change

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITY - no change

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~PATCH_ENTITY:

keypoint

a. you have to manually insert entry to cl_crm_opportunity_impl=>gt_customer_h in your own code:

[外链图片转存失败(img-GDVe3wH4-1562295211610)(https://user-images.githubusercontent.com/5669954/27517921-cfa72664-59d4-11e7-96d9-cd61b0455c53.png)]


b. you have to manually insert entry to cl_crm_opportunity_impl=>gt_input_fields in your own code as well:


[外链图片转存失败(img-AyV3voPg-1562295211612)(https://user-images.githubusercontent.com/5669954/27517925-d40e3206-59d4-11e7-8da0-83153b9178e5.png)]


complete source code

 METHOD /iwbep/if_mgw_appl_srv_runtime~patch_entity.

   CALL METHOD super->/iwbep/if_mgw_appl_srv_runtime~patch_entity

     EXPORTING

       iv_entity_name          = iv_entity_name

       iv_entity_set_name      = iv_entity_set_name

       iv_source_name          = iv_source_name

       io_data_provider        = io_data_provider

       it_key_tab              = it_key_tab

       it_navigation_path      = it_navigation_path

       io_tech_request_context = io_tech_request_context

     IMPORTING

       er_entity               = er_entity.

   FIELD-SYMBOLS:  TYPE crmt_odata_oppt_header,

                   TYPE crmt_customer_h_com,

                        TYPE crmt_odata_oppt_header-ext_created_by,

                    LIKE LINE OF cl_crm_opportunity_impl=>gt_input_fields.

* Jerry: in CL_CRM_OPPORTUNITY_impl=>PATCH_OPPT_HEADER_ENTITY only extension field name

* like "fld00008c" is passed in, and it is impossible for us to determine which BO part this

* extension field comes from, eg from OPPORT_H or CUSTOMER_H?

* as a result, it is necessary for extension developer to specify mapping in this method

   DATA: ls_input TYPE crmt_input_field_names.

   CHECK iv_entity_name = 'Opportunity'.

   ASSIGN er_entity->* TO .

   CHECK sy-subrc = 0.

   ASSIGN COMPONENT 'EXT_CREATED_BY' OF STRUCTURE  TO .

   CHECK sy-subrc = 0.

   DATA: ls_customer_h LIKE LINE OF cl_crm_opportunity_impl=>gt_customer_h.

   ls_customer_h-fld00008c = .

   ls_customer_h-ref_guid = -guid.

   APPEND ls_customer_h TO cl_crm_opportunity_impl=>gt_customer_h.

   DATA: ls_customer_h_input LIKE LINE OF cl_crm_opportunity_impl=>gt_input_fields,

         ls_name LIKE LINE OF ls_customer_h_input-field_names.

   ls_customer_h_input-ref_guid = -guid.

   ls_customer_h_input-ref_kind = 'A'.

   ls_customer_h_input-objectname = 'CUSTOMER_H'.

   ls_name-fieldname = 'FLD00008C'.

   APPEND ls_name TO ls_customer_h_input-field_names.

   INSERT ls_customer_h_input INTO TABLE cl_crm_opportunity_impl=>gt_input_fields.

 ENDMETHOD.

相关文章
### Cause: java.sql.SQLException: Field ‘id‘ doesn‘t have a default value; Field ‘id‘ doesn‘t have
### Cause: java.sql.SQLException: Field ‘id‘ doesn‘t have a default value; Field ‘id‘ doesn‘t have
|
1月前
|
SQL Java 数据库连接
Cause: java.sql.SQLException: Field ‘id‘ doesn‘t have a default value; Field ‘id‘ doesn‘t have a de
Cause: java.sql.SQLException: Field ‘id‘ doesn‘t have a default value; Field ‘id‘ doesn‘t have a de
|
9月前
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘thinkphp.test‘ don‘t exsit
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘thinkphp.test‘ don‘t exsit
213 0
|
3月前
|
存储
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
164 2
|
8月前
simple-query
simple-query
56 0
|
关系型数据库 MySQL 数据库
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
187 0
How to find where settype DB table COMM_PRMAT is accessed without debugging
How to find where settype DB table COMM_PRMAT is accessed without debugging
How to find where settype DB table COMM_PRMAT is accessed without debugging
component set load logic - why coms_pcat_bob is accessed during product search
component set load logic - why coms_pcat_bob is accessed during product search
component set load logic - why coms_pcat_bob is accessed during product search
2015-03-19 header note update in my Appointment
Created by Wang, Jerry, last modified on Mar 23, 2015
117 0
2015-03-19 header note update in my Appointment