on 03-10-2009 1:41 PM
Hi All,
I have some fields as dropdowns.
When the view is displayed these are filled with some default values.
The on_data_check or on_cell_action events will be triggered only if there is a change in value other than default value of the dropdown.
Now I need to trigger these events even though there is no change in the dropdown ie when I select the same default value in the dropdown these events will not get triggered.
How can we achieve this.
Thanks Much in Advance.
Regards,
Lekha.
Hi Lekha,
Check this code.
METHOD on_data_check .
Data declaration for assigning the contract,total and balance(remaining) amount
DATA : lo_nd_contract_payment TYPE REF TO if_wd_context_node,
lo_el_contract_payment TYPE REF TO if_wd_context_element,
ls_contract_payment TYPE wd_this->element_contract_payment,
lv_contract_amount LIKE ls_contract_payment-contract_amount,
lv_value_date LIKE ls_contract_payment-value_date.
Data Declaration
DATA : lo_nd_payment_table TYPE REF TO if_wd_context_node,
lo_el_payment_table TYPE REF TO if_wd_context_element,
ls_payment_table TYPE wd_this->element_payment_table,
lt_payment_table LIKE TABLE OF ls_payment_table,
lv_total_amount LIKE ls_payment_table-amount,
lv_balance_amount LIKE ls_payment_table-amount,
lv_paymeth LIKE ls_payment_table-payment_method,
lt_paycreate TYPE TABLE OF /dmpui/db_str_paycreate,
ls_paycreate TYPE /dmpui/db_str_paycreate.
Variable declaration
DATA : lv_master_contract TYPE bca_dte_acpool_ext,
lv_valuedate_new TYPE d,
lv_valuedate_old TYPE d,
lv_newdate TYPE d,
lv_days TYPE tb_avgstag,
lv_acct_no TYPE char_53,
lv_acct_number TYPE /dmpui/db_accont_type-acnum_ext,
lv_medium TYPE fspr_value2_y,
lv_trnstype TYPE bca_ttype_y,
lv_paysel TYPE bca_medium_y,
lv_disburstype TYPE bca_dte_disbursement_type,
iv_days TYPE tb_avgstag,
iv_bpare TYPE bapc_dte_bpare,
iv_sign TYPE char1,
iv_cal TYPE bca_cal_y VALUE '08',
lv_ctr TYPE c.
Data declaration for the grid column
DATA: ls_cell TYPE salv_wd_s_table_mod_cell.
FIELD-SYMBOLS: <l_cell> TYPE any.
Data declartion for message manager
DATA : lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager.
get message manager
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
navigate from <CONTEXT> to <PAYMENT_TABLE> via lead selection
lo_nd_payment_table = wd_context->get_child_node( name = wd_this->wdctx_payment_table ).
check for data error in the grid
CHECK r_param->t_error_cells IS INITIAL.
IF lo_nd_payment_table IS NOT INITIAL.
get all declared attrigbutes
lo_nd_payment_table->get_static_attributes_table(
IMPORTING
table = lt_payment_table ).
ENDIF.
lo_el_payment_table = lo_nd_payment_table->get_element( ).
lo_el_payment_table->get_attribute(
EXPORTING
name = `PAYMENT_METHOD`
IMPORTING
value = lv_paymeth ).
IF r_param->t_modified_cells IS NOT INITIAL.
LOOP AT r_param->t_modified_cells INTO ls_cell.
CASE ls_cell-attribute.
when changes made in the account cell
WHEN 'ACCOUNT_NUMBER'.
ASSIGN ls_cell-r_value->* TO <l_cell>.
lv_acct_no = <l_cell>.
lv_acct_number = lv_acct_no+18(35).
wd_this->fill_master_contract(
EXPORTING
im_account_number = lv_acct_number ).
when changes made in the payment method cell
WHEN 'PAYMENT_METHOD'.
ASSIGN ls_cell-r_value->* TO <l_cell>.
lv_medium = <l_cell>.
wd_this->mv_medium = <l_cell>.
Filling the transaction type related to the payment method in the grid
wd_this->mv_prodext = wd_this->contract_prod.
wd_this->fill_transtype(
EXPORTING
im_medium = lv_medium
im_prodext = wd_this->mv_prodext ).
Filling the Country/Bank/Account info
wd_this->fill_bank_account_info(
EXPORTING
im_medium = wd_this->mv_medium ).
Filling the Disbursement Type
wd_this->fill_disbrs_type(
EXPORTING
im_medium = lv_medium ).
when changes made in the transacton type cell
WHEN 'TRANSACTION_TYPE'.
ASSIGN ls_cell-r_value->* TO <l_cell>.
lv_trnstype = <l_cell>.
wd_this->mv_trnstype = <l_cell>.
setting the valueset to the contribution type attributes
wd_this->fill_cont_type( ).
ENDCASE.
ENDLOOP.
ENDIF.
lv_ctr = 0.
lv_total_amount = 0.
wd_assist->gc_total_amount = 0.
CLEAR ls_payment_table.
CLEAR : lv_valuedate_new,lv_valuedate_old.
IF lt_payment_table[] IS NOT INITIAL.
Looping at the payment internal table
LOOP AT lt_payment_table INTO ls_payment_table.
CLEAR lv_valuedate_new.
IF ls_payment_table IS NOT INITIAL.
IF ls_payment_table-account_number IS NOT INITIAL.
CLEAR lv_acct_number.
lv_acct_number = ls_payment_table-account_number+18(35).
IF lv_acct_number EQ wd_this->mv_account_numer.
IF ls_payment_table-mc_number NE wd_this->lv_master_cnt_number.
ls_payment_table-mc_number = wd_this->lv_master_cnt_number.
ENDIF.
MODIFY lt_payment_table INDEX sy-tabix FROM ls_payment_table.
CLEAR : wd_this->lv_master_cnt_number.
ENDIF.
ELSE.
CLEAR : ls_payment_table-mc_number.
MODIFY lt_payment_table INDEX sy-tabix FROM ls_payment_table.
ENDIF.
if submit is checked, then calculate the value date
IF wd_this->lv_proposal = abap_false.
Logic for getting the value date for a payment method
wd_this->get_value_date(
EXPORTING
im_paymeth = ls_payment_table-payment_method
im_transtype = ls_payment_table-transaction_type
IMPORTING
ex_value_date = lv_valuedate_new ).
lv_ctr = lv_ctr + 1.
IF lv_ctr = 1.
lv_valuedate_old = lv_valuedate_new.
wd_this->value_date = lv_valuedate_old.
ELSEIF lv_valuedate_new > lv_valuedate_old. "Checking for bigger date
wd_this->value_date = lv_valuedate_new.
ELSEIF lv_valuedate_new < lv_valuedate_old. "Checking for bigger date
wd_this->value_date = lv_valuedate_old.
ENDIF.
ENDIF.
Calculating the contract start date
wd_this->cal_contract_sdate(
EXPORTING
im_trnstype = ls_payment_table-transaction_type ).
check if master contract is not initial
IF ls_payment_table-mc_number IS NOT INITIAL AND ls_payment_table-disbursement_type IS INITIAL.
if check master contract for the source and target account is different
IF ls_payment_table-mc_number <> wd_comp_controller->mt_contract_detail-master_contract_no
AND ls_payment_table-payment_method = '0001'.
report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = wd_assist->if_wd_component_assistance~get_text('127').
ENDIF.
ENDIF.
calculating the total amount in the grid
lv_total_amount = lv_total_amount + ls_payment_table-amount.
ENDIF.
CLEAR ls_payment_table.
ENDLOOP.
ENDIF.
Passing the Total Amount Value to the Assistance class variable
wd_assist->gc_total_amount = lv_total_amount.
navigate from <CONTEXT> to <CONTRACT_PAYMENT> via lead selection
lo_nd_contract_payment = wd_context->get_child_node( name = wd_this->wdctx_contract_payment ).
get element via lead selection
lo_el_contract_payment = lo_nd_contract_payment->get_element( ).
lo_el_contract_payment->get_attribute(
EXPORTING
name = `CONTRACT_AMOUNT`
IMPORTING
value = lv_contract_amount ).
Calculating the balance amount
lv_balance_amount = lv_contract_amount - wd_assist->gc_total_amount.
get single attribute
lo_el_contract_payment->set_attribute(
EXPORTING
name = `TOTAL_AMOUNT`
value = wd_assist->gc_total_amount ).
lo_el_contract_payment->set_attribute(
EXPORTING
name = `BALANCE_AMOUNT`
value = lv_balance_amount ).
lo_el_contract_payment->set_attribute(
EXPORTING
name = `VALUE_DATE`
value = wd_this->value_date ).
Binding the data to the context node
lo_nd_payment_table->bind_table(
EXPORTING
new_items = lt_payment_table " List of Elements or Model Data
set_initial_elements = abap_true " If TRUE, Set Initial Elements Otherwise Add
).
Checking if balance amount is less than zero, then raise a warning message
IF lv_balance_amount < 0.
Clear Old Messages
lo_message_manager->clear_messages( ).
report warning message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = wd_assist->if_wd_component_assistance~get_text( '084' )." Message Text
ENDIF.
ENDMETHOD.
Regard
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lekha,
It will Trigger the On_Data_Check event.
You also have to add the below code where you configure the alv component .
wd_this->alv_config_table->if_salv_wd_table_settings~set_data_check( if_salv_wd_c_table_settings=>data_check_on_cell_event ).
wd_this->alv_config_table is of type ref to -CL_SALV_WD_CONFIG_TABLE
Regard
Manoj Kumar
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
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.