I always felt like something is missing in all the FE Object Page apps when there is no avatar displayed in the header. I mean, just check the below image, and see how beautiful it looks with the avatar control on the object page.
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Customer FE Image'
define root view entity Z_I_CUSTOMER_FE_IMAGE
as select from /DMO/I_Customer as customer
{
key customer.CustomerID,
customer.FirstName,
customer.LastName,
customer.Title,
customer.Street,
customer.PostalCode,
customer.City,
customer.CountryCode,
customer.PhoneNumber,
customer.EMailAddress,
customer._Country
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Customer FE Image'
@UI.headerInfo:{
imageUrl: 'CustImageURL',
title:{ value: 'CustomerID'},
typeName: 'Customer Detail',
typeNamePlural: 'Customers',
description:{ value: 'FirstName' }
}
define root view entity z_c_customer_fe_image
as projection on Z_I_CUSTOMER_FE_IMAGE as customer
{
@UI.facet: [{
id: 'CustomerHeader',
purpose: #STANDARD ,
type: #IDENTIFICATION_REFERENCE,
label: 'General Information' } ]
@UI.selectionField: [{
position: 10
}]
@UI.lineItem: [{
position: 10
}]
@UI.identification:[{position: 10}]
key customer.CustomerID,
@UI.lineItem: [{
position: 20
}]
@UI.identification:[{position: 20}]
customer.FirstName,
@UI.lineItem: [{
position: 30
}]
@UI.identification:[{position: 30}]
customer.LastName,
@ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_VE_CUST_INITIAL'
virtual CustImageURL: abap.string( 256 ),
customer.CountryCode,
@UI.identification:[{position: 40}]
@UI.lineItem: [{
position: 40
}]
customer.PhoneNumber,
@UI.identification:[{position: 50}]
@UI.lineItem: [{
position: 50
}]
customer.EMailAddress,
customer._Country
}
CLASS zcl_ve_cust_initial DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_sadl_exit_calc_element_read.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_ve_cust_initial IMPLEMENTATION.
METHOD if_sadl_exit_calc_element_read~calculate.
DATA customers TYPE STANDARD TABLE OF z_c_customer_fe_image WITH DEFAULT KEY.
customers = CORRESPONDING #( it_original_data ).
LOOP AT customers ASSIGNING FIELD-SYMBOL(<customer>).
<customer>-CustImageURL = 'https://github.githubassets.com/images/modules/open_graph/github-octocat.png'.
ENDLOOP.
ct_calculated_data = CORRESPONDING #( customers ).
ENDMETHOD.
METHOD if_sadl_exit_calc_element_read~get_calculation_info.
ENDMETHOD.
ENDCLASS.
Showing an Image in the avatar.
@ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_VE_CUST_INITIAL'
virtual CustInital: abap.char( 2 ),
METHOD if_sadl_exit_calc_element_read~get_calculation_info.
LOOP AT it_requested_calc_elements ASSIGNING FIELD-SYMBOL(<fs_calc_element>).
CASE <fs_calc_element>.
WHEN 'CUSTINITAL'.
APPEND 'FIRSTNAME' TO et_requested_orig_elements.
APPEND 'LASTNAME' TO et_requested_orig_elements.
ENDCASE.
ENDLOOP.
ENDMETHOD.
METHOD if_sadl_exit_calc_element_read~calculate.
DATA customers TYPE STANDARD TABLE OF z_c_customer_fe_image WITH DEFAULT KEY.
customers = CORRESPONDING #( it_original_data ).
LOOP AT customers ASSIGNING FIELD-SYMBOL(<customer>).
<customer>-CustInital = |{ <customer>-FirstName(1) }{ <customer>-LastName(1) }|.
" <customer>-CustImageURL = 'https://github.githubassets.com/images/modules/open_graph/github-octocat.png'.
ENDLOOP.
ct_calculated_data = CORRESPONDING #( customers ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |