on 2021 Nov 02 7:21 PM
Hello.
I am trying to make a field mandatory depending on the status of an object. I do it through "external_calculation".
View Code:
@AbapCatalog.sqlViewName: 'ZIDVAGOODSRECSTP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Goods Records View'
@VDM.viewType: #TRANSACTIONAL
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeActivePersistence:'ZTDVA_GOODS'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
@ObjectModel.draftEnabled: true
@ObjectModel.writeDraftPersistence: 'ZTDVA_GOODS_D'
@ObjectModel.semanticKey: ['GoodUuid', 'StoreUuid']
define view ZI_DVA_GoodsRecordsTP
as select from ZI_DVA_Goods
{
@ObjectModel.readOnly: true
key GoodUuid,
@ObjectModel.mandatory: true
StoreUuid,
@ObjectModel.mandatory: true
Name,
@ObjectModel.mandatory: 'EXTERNAL_CALCULATION'
Quantity,
@Semantics.amount.currencyCode : 'Currency'
@ObjectModel.mandatory: true
Price,
@Semantics.currencyCode: true
@ObjectModel.mandatory: true
Currency,
@ObjectModel.mandatory: true
StatusUuid,
_Statuses.Status,
_Stores.Name as StoreName,
_Statuses,
_Stores,
_GoodsLogs
}
Code in determination:
method /BOBF/IF_FRW_DETERMINATION~EXECUTE.
DATA lt_goods TYPE ztidva_goodsrecordstp.
io_read->retrieve(
EXPORTING
iv_node = is_ctx-node_key
it_key = it_key
IMPORTING
et_data = lt_goods ).
data(lo_property_helper) = new /bobf/cl_lib_h_set_property( io_modify = io_modify
is_context = is_ctx ).
LOOP AT lt_goods INTO DATA(ls_good).
IF ls_good-StatusUuid = 'mS{Jam7V7ko6s72CWlRP{W'.
lo_property_helper->set_attribute_mandatory(
iv_attribute_name = zif_i_dva_goodsrecordstp_c=>sc_node_attribute-zi_dva_goodsrecordstp-quantity
iv_value = abap_true
iv_key = ls_good-key ).
ELSE.
lo_property_helper->set_attribute_mandatory(
iv_attribute_name = zif_i_dva_goodsrecordstp_c=>sc_node_attribute-zi_dva_goodsrecordstp-quantity
iv_value = abap_false
iv_key = ls_good-key ).
ENDIF.
ENDLOOP.
endmethod.
This way works. Only if you change the status and refresh the page or click on the save button, the action of which updates the view. How do I make the view change without refreshing the page or how do I refresh the view?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.