Interstate and Intrastate GST Determination in REFX RECN T-code
Requirement: To automate intrastate or interstate GST determination in the RECN t-code in the posting parameters tab based on customer and plant regions.
Challenge: The standard config for REFX let’s us define tax types and tax groups, but only specifically for one particular region at a time, which doesn’t work for us in case of GST because interstate and intrastate have to be taken into consideration which would be determined for the Lessor and Lessee by their respective regions. That is, 2 regions have to be considered at the same time to determine IGST or CGST/SGST needs to be picked.
Proposed Solution: After trial and error, there were 2 methods which we found could be solutions for our requirement.
- If the contract is already created and existing in the system, using the FM BAPI_RE_CN_CHANGE, in the term payment structure, the new tax groups can be updated according to given logic.
- For adding this requirement at the time for creation of contract:
In the BADI BADI_RECN_CONTRACT, a Z implementation can be created, where in the CHECK_ALL method a validation can be added to check whether the correct tax group has been entered by the user or not.
During creation, the SUBSTITUTE method was being triggered just as we enter inside the transaction therefore the only available data to us was the Contract Type and company code at best which was not sufficient to automate the tax determination as we needed other details such as the region of the Partner assigned and the region of the Business Entity.
For our specific scenario, the region we picked were the region of the partner assigned and the region of the business entity of an equipment being leased out.
Following is the validation:
METHOD IF_EX_RECN_CONTRACT~CHECK_ALL . TYPE-POOLS: reca1. DATA: ls_message TYPE recamsg. DATA: lo_contract TYPE REF TO cl_recn_contract, lo_term_mngr TYPE REF TO cl_retm_term_mngr, lo_paym_mngr TYPE REF TO cl_retm_payment_mngr, rd_busent TYPE rebdbeno, lt_list_post TYPE re_t_posting_py, ls_list_post TYPE retm_posting_py, lv_partner TYPE retm_posting_py-partner, lt_date_slice TYPE re_t_recadaterange, ls_date_slice TYPE recadaterange. CONSTANTS : C_IGST_TAXGROUP TYPE retm_posting_py-taxgroup VALUE 'IGST18%', C_CSGST_TAXGROUP TYPE retm_posting_py-taxgroup VALUE 'CGST9%&SGST9%', c_mwst_taxtype TYPE retm_posting_py-taxtype VALUE 'MWST'. * BAdI should be executed only for country version India CHECK cl_recac_country_addon=>is_active( id_country = 'IN' ) = abap_true. TRY. lo_contract ?= io_object. CATCH cx_sy_move_cast_error. ENDTRY. CHECK lo_contract IS BOUND. * get term manager lo_term_mngr ?= lo_contract->if_retm_has_term~get_term_mngr( ). * get specific one lo_paym_mngr ?= lo_term_mngr->get_specific_term_mngr( id_termtype = retm1_term_type-payment ). * get the structure of the posting term lo_paym_mngr->get_list( IMPORTING et_list = lt_list_post ). "Business Entity and region rd_busent = lo_contract->get_swenr( ). IF rd_busent IS NOT INITIAL. SELECT SINGLE c~region FROM vibdbe AS a LEFT OUTER JOIN vzobject AS b ON b~adrobjnr = a~intreno LEFT OUTER JOIN adrc as c ON c~addrnumber = b~adrnr INTO @DATA(ls_regio_be) WHERE a~swenr = @rd_busent AND a~bukrs = @lo_contract->md_bukrs. ENDIF. LOOP AT lt_list_post INTO ls_list_post. ls_date_slice-datefrom = ls_list_post-validfrom. ls_date_slice-dateto = ls_list_post-validto. APPEND ls_date_slice TO lt_date_slice. "Partner lv_partner = ls_list_post-partner. ENDLOOP. * Get partner region SELECT SINGLE regio FROM kna1 INTO @DATA(ls_regio_kna1) WHERE kunnr = @lv_partner. SORT lt_list_post BY taxtype taxgroup validfrom. DELETE ADJACENT DUPLICATES FROM lt_list_post COMPARING taxtype taxgroup validfrom validto. IF ls_regio_kna1 IS NOT INITIAL AND ls_regio_be IS NOT INITIAL. LOOP AT lt_list_post ASSIGNING FIELD-SYMBOL(<fs_list_post>) WHERE taxtype = c_mwst_taxtype. IF ls_regio_be EQ ls_regio_kna1. IF <fs_list_post>-taxgroup NE C_CSGST_TAXGROUP. CLEAR ls_message. ls_message-msgty = 'E'. ls_message-msgid = 'ZRECN'. ls_message-msgno = '000'. ls_message-msgv1 = 'Tax group entered incorrect'. "#EC NOTEXT APPEND ls_message TO ct_message. EXIT. ENDIF. ELSEIF ls_regio_be NE ls_regio_kna1. IF <fs_list_post>-taxgroup NE C_IGST_TAXGROUP. CLEAR ls_message. ls_message-msgty = 'E'. ls_message-msgid = 'ZRECN'. ls_message-msgno = '000'. ls_message-msgv1 = 'Tax group entered incorrect'. "#EC NOTEXT APPEND ls_message TO ct_message. EXIT. ENDIF. ENDIF. ENDLOOP. CLEAR: LS_REGIO_KNA1, LS_REGIO_be. ENDIF. ENDMETHOD.
If the user is entering any tax group which does not match our validation, the error message will be thrown.
In conclusion, it does not automate the GST determination but as a revised solution it was decided to be kept as a validation. Will be looking forward to looking for solutions to that if possible in the future.