on 06-09-2015 2:16 PM
HI experts.
I created a button with ACTION inside this action i call a method:
DATA lv_return TYPE REF TO char2.
lv_return = wd_this->del_ordem(
ordemfrete = ls_nd_tb_fo-ordemfrete " /scmtms/tor_id
).
-------------------------------------------------------------------------------------------------------------------------------------------------
Inside this method is:
METHOD del_ordem .
data:lt_sel_opt TYPE /bobf/t_frw_query_selparam,
ls_sel_opt TYPE /bobf/s_frw_query_selparam.
" get the service manager of the Invoice BO
DATA lo_customer_invoice TYPE REF TO /bobf/if_tra_service_manager.
lo_customer_invoice = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( iv_bo_key = /scmtms/if_tor_c=>sc_bo_key ).
" query all existing invoices
ls_sel_opt-attribute_name = /scmtms/if_tor_c=>sc_query_attribute-root-planning_attributes-tor_id.
ls_sel_opt-sign = 'I'.
ls_sel_opt-option = 'EQ'.
ls_sel_opt-low = ORDEMFRETE.
ls_sel_opt-high = ''.
INSERT ls_sel_opt INTO TABLE lt_sel_opt.
DATA ls_root_key TYPE /bobf/s_frw_key.
DATA lt_root_key TYPE /bobf/t_frw_key.
lo_customer_invoice->query(
EXPORTING iv_query_key = /scmtms/if_tor_c=>sc_query-root-planning_attributes
it_selection_parameters = lt_sel_opt
IMPORTING et_key = lt_root_key ).
" delete all invoices
DATA ls_modification TYPE /bobf/s_frw_modification.
DATA lt_modification TYPE /bobf/t_frw_modification.
LOOP AT lt_root_key INTO ls_root_key.
ls_modification-node = /scmtms/if_tor_c=>sc_node-root.
ls_modification-key = ls_root_key-key.
ls_modification-change_mode = /bobf/if_frw_c=>sc_modify_delete.
APPEND ls_modification TO lt_modification.
ENDLOOP.
" execute modification
lo_customer_invoice->modify( it_modification = lt_modification ).
" save the transaction
DATA lo_transaction_manager TYPE REF TO /bobf/if_tra_transaction_mgr.
lo_transaction_manager = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).
lo_transaction_manager->save( ).
ENDMETHOD.
------------------------------------------------------------------------------------------------------------------------------------------------------------
I want to know how could i put a validation after call method like sy-subrc = 0 to know if it worked or no ,then i could show my messages.
Thanks.
Hi,
Are you using the return parameter lv_return ?, if not remove it and create a return parameter RB_SUCCESS TYPE WDY_BOOLEAN inside the method del_ordem( ) and set the flag X if it is successful or space if its not successful.
data lb_success type wdy_boolean.
lb_success = wd_this->del_ordem(
ordemfrete = ls_nd_tb_fo-ordemfrete " /scmtms/tor_id
).
if lb_success = 'X'.
" raise message here for success
else.
" raise message here for unsuccessful processing
endif.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.