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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |