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:

Selection screen.PNG

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.

Withholding Tax screenshot.PNG

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_instancekunnr = p_kunnr.

   l_wtax_typetask = ‘U’.

   l_wtax_typedata_keywitht = p_tipind_i.

   l_wtax_typedatawt_withcd = p_indret.

   l_wtax_typedataxwt_withcd = ‘X’.

   append l_wtax_type to lt_wtax_type_t.

   ls_wtax_typewtax_type = lt_wtax_type_t.

   ls_companydata_keybukrs = p_bukrs.

   ls_companywtax_type = ls_wtax_type.

   ls_companytask = ‘U’.

   append ls_company to ls_company_datacompany.

   ls_headobject_instance = ls_instance.

   ls_headobject_task = lc_obj_task.

   ls_custheader = ls_head.

   ls_custcompany_data = ls_company_data.

   append ls_cust to lt_custs.

   ls_e_maincustomers = 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

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply