
Hello Everybody,
It's my first time posting in SCN, so I hope this article be useful for all of those people dealing with massive changes in customers master data.
The code below change the W/Tax code field where it finds witholding tax type equal to parameter in selection screen:
The meaning of fields are these:
Cliente: Customer.
Tipo de ret. a buscar: Witholding tax type to search
Indi. ret a buscar: Witholding tax code to search
Indi. ret a colocar: Witholding tax code to put into the field in case of find data with prior parameters.
The next screenshot is where the data is going to be changed is located, Transaction XD02 enter costumer and company code, after that click on Company code data, and go to Withholding Tax tab.
The code to change the data once the data is selected is below:
form update_customer using p_kunnr p_bukrs p_tipind_i p_indret.
data: ls_i_main type cmds_ei_main,
ls_e_main type cmds_ei_main,
lt_custs type cmds_ei_extern_t,
ls_cust type cmds_ei_extern,
ls_head type cmds_ei_header,
ls_instance type cmds_ei_instance.
data: ls_company_data type cmds_ei_cmd_company,
ls_company type cmds_ei_company,
ls_wtax_type type cmds_ei_wtax_type_s,
lt_wtax_type_t type cmds_ei_wtax_type_t,
l_wtax_type type cmds_ei_wtax_type,
l_update_errors type cvis_message,
l_it_bdcmsgcoll type table of bdcmsgcoll,
l_wa_bdcmsgcoll type bdcmsgcoll,
l_wa_messages type bapiret2.
data: l_wa_log_alv type ty_log_alv.
constants: lc_obj_task type cmd_ei_object_task value 'U'.
ls_instance-kunnr = p_kunnr.
l_wtax_type-task = 'U'.
l_wtax_type-data_key-witht = p_tipind_i.
l_wtax_type-data-wt_withcd = p_indret.
l_wtax_type-datax-wt_withcd = 'X'.
append l_wtax_type to lt_wtax_type_t.
ls_wtax_type-wtax_type = lt_wtax_type_t.
ls_company-data_key-bukrs = p_bukrs.
ls_company-wtax_type = ls_wtax_type.
ls_company-task = 'U'.
append ls_company to ls_company_data-company.
ls_head-object_instance = ls_instance.
ls_head-object_task = lc_obj_task.
ls_cust-header = ls_head.
ls_cust-company_data = ls_company_data.
append ls_cust to lt_custs.
ls_e_main-customers = lt_custs.
cmd_ei_api=>maintain(
exporting
iv_test_run = space
is_master_data = ls_e_main
importing
es_error = l_update_errors ).
commit work.
call function 'DEQUEUE_EXKNA1'
exporting
kunnr = p_kunnr.
endform.
The parameter p_tipind_i is the Witholding tax type (the key) to search the row to modify, and p_indret is the new value for the field Witholding tax code.
Best regards.
Jhon Jairo Teran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
2 | |
2 |