
define behavior for ZBP_xxxx alias PurCon
...
{ ...
validation ValidateHeaderFields on save { field Supplier , CompCode ; }
… }
Supplier;
@UI:{ lineItem: [{ position: 50 }] , identification: [{ position: 50 ,qualifier: 'General'}]}
@Consumption.valueHelpDefinition: [{ entity: {
name: 'ZRK_I_SUP_CON',
element: 'SupConId'
} ,
additionalBinding: [{
localElement: 'Supplier',
localConstant: '',
element: 'SupNo',
usage: #FILTER_AND_RESULT
}] ,
useForValidation: true
}]
SupConId;
update ( precheck );
METHODS precheck_update FOR PRECHECK
IMPORTING entities FOR UPDATE PurCon.
CHECK <fs_entity>-%control-Supplier EQ '01' OR <fs_entity>-%control-CompCode EQ '01' .
zrk_cl_mng_pur_con=>validate_supp_le(
iv_supplier = <fs_db_con>-Supplier
iv_comp_code = <fs_db_con>-CompCode
) .
METHOD precheck_update.
LOOP AT entities ASSIGNING FIELD-SYMBOL(<fs_entity>).
CHECK <fs_entity>-%control-Supplier EQ '01' OR <fs_entity>-%control-CompCode EQ '01' .
READ ENTITIES OF zrk_i_pur_con_ud IN LOCAL MODE
ENTITY PurCon
FIELDS ( Supplier CompCode )
WITH VALUE #( ( %key = <fs_entity>-%key ) )
RESULT DATA(lt_con).
READ TABLE lt_con ASSIGNING FIELD-SYMBOL(<fs_db_con>) INDEX 1.
IF sy-subrc EQ 0.
<fs_db_con>-Supplier = COND #( WHEN <fs_entity>-%control-Supplier EQ '01' THEN <fs_entity>-Supplier ELSE <fs_db_con>-Supplier ) .
<fs_db_con>-CompCode = COND #( WHEN <fs_entity>-%control-CompCode EQ '01' THEN <fs_entity>-CompCode ELSE <fs_db_con>-compcode ) .
IF NOT zrk_cl_mng_pur_con=>validate_supp_le(
iv_supplier = <fs_db_con>-Supplier
iv_comp_code = <fs_db_con>-CompCode
) .
APPEND VALUE #( %tky = <fs_entity>-%tky ) TO failed-purcon.
APPEND VALUE #( %tky = <fs_entity>-%tky
%state_Area = 'VALIDATE_SUP_LE'
)
TO reported-purcon.
APPEND VALUE #( %tky = <fs_entity>-%tky
%state_Area = 'VALIDATE_SUP_LE'
%msg = NEW zrk_cx_msg(
severity = if_abap_behv_message=>severity-error
textid = zrk_cx_msg=>c_sup_le_match
supplier = <fs_db_con>-Supplier
comp_code = <fs_db_con>-CompCode )
%element-supplier = if_abap_behv=>mk-on
%element-compcode = if_abap_behv=>mk-on
) TO reported-purcon.
ELSE.
APPEND VALUE #( %tky = <fs_entity>-%tky
%state_Area = 'VALIDATE_SUP_LE'
)
TO reported-purcon.
ENDIF.
ENDIF.
ENDLOOP.
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 |
---|---|
23 | |
19 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |