Hi,
via the AET tool in the Web UI, I created a table extension for the BTOrderAdminH which refers to a database table. In the Web UI, this enhancement directly works perfectly. The database table ZORDERADM_H is getting populated via the screen.
Now for my business requirement, I want to populate this table without being in the screen. So, for testing purposes, I created this program:
REPORT ztest. DATA: lr_core TYPE REF TO cl_crm_bol_core, lr_bol TYPE REF TO cl_crm_bol_entity, lr_bth TYPE REF TO cl_crm_bol_entity. lr_col TYPE REF TO if_bol_entity_col, lr_template TYPE REF TO cl_crm_bol_entity_template. DATA: ls_attribs TYPE zext_bol_attr. lr_core = cl_crm_bol_core=>get_instance( ). lr_core->start_up( 'BT' ). lr_bol = lr_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = '<relevant GUID from CRMD_ORDERADM_H>' ). lr_bol = lr_bol->get_related_entity( 'BTOrderHeader' ). lr_bth = lr_bol. "Copy the header lr_col = lr_bol->get_related_entities( iv_relation_name = 'ZEXT_BOL_RELAT000000' ). * Collection is still empty, so we create a new one lr_template = lr_bth->get_related_entity_template( 'ZEXT_BOL_RELAT000000' ). lr_bol = lr_template->create_entity( ). * Populate the same way standard generated SAP code fills the table ls_attribs-object_id = ls_attribs-parent_id = '<relevant GUID from CRMD_ORDERADM_H>' . ls_attribs-zzvar = 1234. CALL FUNCTION 'CRM_GUID_CREATE' IMPORTING ev_guid = ls_attribs-record_id. lr_bol->set_properties( ls_attribs ). lr_col->add( lr_bol ). lr_core->modify( ).
But this just doesn't work. Populating a AET extention object via the BOL framework is not possible? Or am I missing something in here?
Kind regards,
Sander