Hi Kumar,
thanks for the input. Problem is that with your code nothing happens on the screen.
I do not get any errors but I do not see the sales employee beeing filled in.
When I debug, the variables are correctly filled.
this is the complete code.
CALL METHOD SUPER->DO_INIT_CONTEXT.
DATA: lr_entity type REF TO if_bol_bo_property_access,
lv_sales_emp TYPE string,
lv_emp type string,
lv_account type bu_partner,
lv_account_int type bu_partner,
lr_account TYPE REF TO cl_crm_bol_entity.
*get the customer number
try.
lr_entity ?= me->typed_context->salesemployee->collection_wrapper->get_current( ).
catch cx_root.
endtry.
lv_account = lr_entity->get_property_as_string( 'BP_NUMBER' ).
lv_sales_emp = lr_entity->get_property_as_string( 'SALESEMPLOYEE' ).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lv_account
IMPORTING
OUTPUT = lv_account_int.
if lv_sales_emp is INITIAL.
*Get the Sales employee from the customer
Select partner2 into lv_emp from but050
where partner1 = lv_account_int and reltyp = 'BUR011'.
endselect.
*Set the sales employee
CALL METHOD LR_ENTITY->SET_PROPERTY
EXPORTING
IV_ATTR_NAME = SALESEMPLOYEE'
IV_VALUE = lv_emp.
ENDIF.