You are on page 1of 13

*&---------------------------------------------------------------------* *& Include ZXAPCU05 >> EXIT_SAPLAPCF_005 *&---------------------------------------------------------------------* TABLES: zfiaa001, j_1btxcof, j_1btxpis, anep, anla.

*"---------------------------------------------------------------------*Recupera o valor total da fatura para clculo dos valores das reas *"---------------------------------------------------------------------FIELD-SYMBOLS: <fs_valor> TYPE ANY. DATA: v_valor v_valor1 v_urwrt v_leart v_bukrs v_anln1 v_anln2 v_tcode v_tabix TYPE LIKE LIKE LIKE LIKE LIKE LIKE TYPE TYPE wrbtr, drseg-mwskz, anla-urwrt, anla-leart, t_anepi-bukrs, t_anepi-anln1, t_anepi-anln2, sy-tcode, sy-tabix.

*"---------------------------------------------------------------------*Work Area *"---------------------------------------------------------------------DATA wa_anla TYPE anla. DATA wa_anep TYPE anep. *"---------------------------------------------------------------------*Variveis *"---------------------------------------------------------------------DATA : vl_ebeln TYPE ekko-ebeln, vl_ebelp TYPE ekpo-ebelp. *"---------------------------------------------------------------------*Buscas. *"---------------------------------------------------------------------*IF sy-tcode = 'MIRO'. * **--->>> Verifica se o IVA e para ser levado para as reas de CIAP - Pis / Cofins * CLEAR v_valor1. * ASSIGN ('(SAPLMR1M)DRSEG-MWSKZ') TO <fs_valor>. * * v_valor1 = <fs_valor>. * * CHECK v_valor1 = 'C2' OR * v_valor1 = 'C0'. * * CLEAR: j_1btxcof, * j_1btxpis. * ** Recupera COFINS * SELECT SINGLE * FROM j_1btxcof * WHERE country = 'BR' * AND gruop = '15'. *

** Recupera PIS * SELECT SINGLE * FROM j_1btxpis * WHERE country = 'BR' * AND gruop = '15'. * * "----------------------------------------------------------------------* * LOOP AT t_anepi. **---->>> Determina valores para as novass reas de avalio (PIS / COFINS) * SELECT SINGLE * FROM zfiaa001 * WHERE afaber = t_anepi-afabe * AND gdatu <= t_anepi-bzdat. * * IF sy-subrc = 0. * IF v_valor1 = 'C2'. * v_valor = ( t_anepi-anbtr * 100 ) / ( 100 - ( j_1btxcof-rate + j_1btxpi s-rate ) ). * t_anepi-anbtr = ( v_valor * zfiaa001-aliquota ) / 100. * ** Nesse ponto so exportadas informaes que sero utilizadas no ** ENHANCEMENT Point z_imobilizado_miro_mr8m que foi implementado em ** Grupo de Funo: AMBU ** Funo: AMBU_ASSET_ITEMS_CREATE ** para gravar a informao de valor de aquisio para o imobilizado * * FREE MEMORY ID 'URWRT'. * FREE MEMORY ID 'BUKRS'. * FREE MEMORY ID 'ANLN1'. * FREE MEMORY ID 'ANLN2'. * FREE MEMORY ID 'TCODE'. * * v_urwrt = v_valor. * v_bukrs = t_anepi-bukrs. * v_anln1 = t_anepi-anln1. * v_anln2 = t_anepi-anln2. * v_tcode = 'MIRO'. * * vl_ebeln = i_rlambu-ebeln. * vl_ebelp = i_rlambu-ebelp. * * EXPORT vl_ebeln = vl_ebeln TO MEMORY ID 'DOCCOMPRA'. * EXPORT vl_ebelp = vl_ebelp TO MEMORY ID 'ITEMCOMPRA'. * * EXPORT v_urwrt = v_urwrt TO MEMORY ID 'URWRT'. * EXPORT v_bukrs = v_bukrs TO MEMORY ID 'BUKRS'. * EXPORT v_anln1 = v_anln1 TO MEMORY ID 'ANLN1'. * EXPORT v_anln2 = v_anln2 TO MEMORY ID 'ANLN2'. * EXPORT v_tcode = v_tcode TO MEMORY ID 'TCODE'. * * MODIFY t_anepi. * * ELSEIF v_valor1 = 'C0'. * t_anepi-anbtr = 0. * * MODIFY t_anepi. * ENDIF. * * ENDIF. * * m_anepi = t_anepi. * APPEND m_anepi.

* * ENDLOOP. * * UNASSIGN <fs_valor>. * *ELSEIF sy-tcode = 'MR8M'. * **--->>> Verifica se o IVA e para ser levado para as reas de CIAP - Pis / Cofins * CLEAR: j_1btxcof, * j_1btxpis. * ** Recupera COFINS * SELECT SINGLE * FROM j_1btxcof * WHERE country = 'BR' * AND gruop = '15'. * ** Recupera PIS * SELECT SINGLE * FROM j_1btxpis * WHERE country = 'BR' * AND gruop = '15'. * * "----------------------------------------------------------------------* * * LOOP AT t_anepi. **---->>> Determina valores para as novass reas de avalio (PIS / COFINS) * SELECT SINGLE * FROM zfiaa001 * WHERE afaber = t_anepi-afabe * AND gdatu <= t_anepi-bzdat. * * IF sy-subrc = 0. * * CASE t_anepi-afabe. * WHEN '90'. * CLEAR: anep. * SELECT SINGLE * FROM anep * WHERE bukrs = t_anepi-bukrs * AND anln1 = t_anepi-anln1 * AND anln2 = t_anepi-anln2 * AND gjahr = t_anepi-gjahr * AND lnran = t_anepi-lnran * AND afabe = t_anepi-afabe. * * IF NOT sy-subrc IS INITIAL. * SELECT SINGLE * FROM anep * WHERE bukrs = t_anepi-bukrs * AND anln1 = t_anepi-anln1 * AND anln2 = t_anepi-anln2 * AND gjahr = t_anepi-gjahr * AND lnran = '00001' * AND afabe = t_anepi-afabe. * ENDIF. * * IF anep-anbtr IS INITIAL. * CLEAR: t_anepi-anbtr. * * m_anepi = t_anepi. * APPEND m_anepi. * * MODIFY t_anepi. *

* ELSE. * v_valor = ( t_anepi-anbtr * 100 ) / ( 100 - ( j_1btxcof-rate + j_1b txpis-rate ) ). * t_anepi-anbtr = ( v_valor * j_1btxpis-rate / 100 ). * MODIFY t_anepi. * * ENDIF. * ** Nesse ponto so exportadas informaes que sero utilizadas no ** ENHANCEMENT Point z_imobilizado_miro_mr8m que foi implementado em ** Grupo de Funo: AMBU ** Funo: AMBU_ASSET_ITEMS_CREATE ** para gravar a informao de valor de aquisio para o imobilizado * * FREE MEMORY ID 'BUKRS'. * FREE MEMORY ID 'ANLN1'. * FREE MEMORY ID 'ANLN2'. * FREE MEMORY ID 'TCODE'. * * v_bukrs = t_anepi-bukrs. * v_anln1 = t_anepi-anln1. * v_anln2 = t_anepi-anln2. * v_tcode = 'MR8M'. * * EXPORT v_bukrs = v_bukrs TO MEMORY ID 'BUKRS'. * EXPORT v_anln1 = v_anln1 TO MEMORY ID 'ANLN1'. * EXPORT v_anln2 = v_anln2 TO MEMORY ID 'ANLN2'. * EXPORT v_tcode = v_tcode TO MEMORY ID 'TCODE'. * * WHEN '91'. * CLEAR: anep. * SELECT SINGLE * FROM anep * WHERE bukrs = t_anepi-bukrs * AND anln1 = t_anepi-anln1 * AND anln2 = t_anepi-anln2 * AND gjahr = t_anepi-gjahr * AND lnran = t_anepi-lnran * AND afabe = t_anepi-afabe. * * IF NOT sy-subrc IS INITIAL. * SELECT SINGLE * FROM anep * WHERE bukrs = t_anepi-bukrs * AND anln1 = t_anepi-anln1 * AND anln2 = t_anepi-anln2 * AND gjahr = t_anepi-gjahr * AND lnran = '00001' * AND afabe = t_anepi-afabe. * ENDIF. * * IF anep-anbtr IS INITIAL. * CLEAR: t_anepi-anbtr. * * m_anepi = t_anepi. * APPEND m_anepi. * * MODIFY t_anepi. * * ELSE. * v_valor = ( t_anepi-anbtr * 100 ) / ( 100 - ( j_1btxcof-rate + j_1b txpis-rate ) ).

* t_anepi-anbtr = ( v_valor * j_1btxcof-rate / 100 ). * MODIFY t_anepi. * * ENDIF. * ** Nesse ponto so exportadas informaes que sero utilizadas no ** ENHANCEMENT Point ZMIROIMOBILIZADO que foi implementado em ** Grupo de Funo: MR1M ** Include: LMR1MF2Y ** Perfomr: variant_transaction ** para gravar a informao de valor de aquisio para o imobilizado * * FREE MEMORY ID 'BUKRS'. * FREE MEMORY ID 'ANLN1'. * FREE MEMORY ID 'ANLN2'. * FREE MEMORY ID 'TCODE'. * * v_bukrs = t_anepi-bukrs. * v_anln1 = t_anepi-anln1. * v_anln2 = t_anepi-anln2. * v_tcode = 'MR8M'. * * EXPORT v_bukrs = v_bukrs TO MEMORY ID 'BUKRS'. * EXPORT v_anln1 = v_anln1 TO MEMORY ID 'ANLN1'. * EXPORT v_anln2 = v_anln2 TO MEMORY ID 'ANLN2'. * EXPORT v_tcode = v_tcode TO MEMORY ID 'TCODE'. * * WHEN OTHERS. * ENDCASE. * ** ELSEIF v_valor1 = 'C0'. ** t_anepi-anbtr = 0. ** ** MODIFY t_anepi. ** ENDIF. * ENDIF. * ** RMB Maio/2012 ----->>> * m_anepi = t_anepi. * APPEND m_anepi. * * ENDLOOP. * * *ENDIF. * DATA: v_teste TYPE lko74-testlauf. ***** Liquidao PEP IF sy-tcode = 'KO8G' OR sy-tcode = 'KO88'. * Verifica se execuo de teste ASSIGN ('(SAPLKO71)LKO74-TESTLAUF') TO <fs_valor>. v_teste = <fs_valor>. CHECK v_teste IS INITIAL. * Declaraes DATA: v_objnr TYPE coep-objnr,

v_docref TYPE j_1bnfdoc-docref, v_belnr TYPE j_1bnfdoc-belnr, v_gjahr TYPE j_1bnfdoc-gjahr. DATA: BEGIN OF t_coep OCCURS 0, belnr TYPE coep-belnr, buzei TYPE coep-buzei, objnr TYPE coep-objnr, ebeln TYPE coep-ebeln, ebelp TYPE coep-ebelp, bukrs TYPE coep-bukrs. DATA: END OF t_coep. DATA: t_ekbe_po TYPE STANDARD TABLE OF ekbe WITH HEADER LINE, t_ekbe TYPE STANDARD TABLE OF ekbe WITH HEADER LINE. " Documento de faturamento DATA: BEGIN OF t_doc OCCURS 0, ebeln TYPE ekbe-ebeln, ebelp TYPE ekbe-ebelp, gjahr TYPE ekbe-gjahr, belnr TYPE ekbe-belnr, buzei TYPE j_1bnflin-refitm, refkey TYPE j_1bnflin-refkey, bukrs TYPE coep-bukrs, END OF t_doc. DATA: BEGIN OF t_j1bnfdoc OCCURS 0, docnum LIKE j_1bnfdoc-docnum, direct LIKE j_1bnfdoc-direct, docdat LIKE j_1bnfdoc-docdat, pstdat LIKE j_1bnfdoc-pstdat, model LIKE j_1bnfdoc-model, series LIKE j_1bnfdoc-series, nfnum LIKE j_1bnfdoc-nfnum, belnr LIKE j_1bnfdoc-belnr, gjahr LIKE j_1bnfdoc-gjahr, bukrs LIKE j_1bnfdoc-bukrs, parid LIKE j_1bnfdoc-parid, nfenum LIKE j_1bnfdoc-nfenum, END OF t_j1bnfdoc. * Tabela interna com dados dos itens da nota fiscal. DATA: BEGIN OF t_j1bnflin OCCURS 0, docnum LIKE j_1bnflin-docnum, itmnum LIKE j_1bnflin-itmnum, matnr LIKE j_1bnflin-matnr, maktx LIKE j_1bnflin-maktx, refkey LIKE j_1bnflin-refkey, refitm LIKE j_1bnflin-refitm, nfnum LIKE j_1bnfdoc-nfnum, nfe LIKE j_1bnfdoc-nfe, nfenum LIKE j_1bnfdoc-nfenum, series LIKE j_1bnfdoc-series, END OF t_j1bnflin. * Tabela interna com impostos dos itens da nota fiscal. DATA: BEGIN OF t_j1bnfstx OCCURS 0, docnum LIKE j_1bnfstx-docnum, itmnum LIKE j_1bnfstx-itmnum,

base LIKE j_1bnfstx-base, rate LIKE j_1bnfstx-rate, taxval LIKE j_1bnfstx-taxval, excbas LIKE j_1bnfstx-excbas, othbas LIKE j_1bnfstx-othbas, taxtyp LIKE j_1bnfstx-taxtyp, taxgrp LIKE j_1baj-taxgrp, END OF t_j1bnfstx. DATA: BEGIN OF t_collect OCCURS 0, taxtyp TYPE j_1bnfstx-taxtyp, taxval TYPE j_1bnfstx-taxval, base TYPE j_1bnfstx-base. DATA: END OF t_collect. DATA: t_zaat001 TYPE STANDARD TABLE OF zaat001 WITH HEADER LINE. DATA: wa_zaat001 TYPE zaat001. CLEAR: v_objnr, t_coep[], t_doc[]. CONCATENATE i_rlambu-obart i_rlambu-objid INTO v_objnr. * Seleciona COEP - Busca pedido SELECT p~belnr p~buzei p~objnr p~ebeln p~ebelp p~bukrs INTO TABLE t_coep FROM coep AS p INNER JOIN cobk AS k ON p~kokrs = k~kokrs AND p~belnr = k~belnr WHERE ( p~kokrs = 'ACC1' OR p~kokrs = 'ACC2' ) AND p~objnr = v_objnr AND p~gjahr = i_rlambu-gjahr AND p~perio = i_rlambu-monat AND p~kstar = i_rlambu-kstar AND k~stflg = '' AND k~stokz = ''. LOOP AT t_coep. CLEAR: t_ekbe_po[]. CALL FUNCTION 'MMPUR_EKBE_READ_EBELN_EBELP' EXPORTING pi_ebeln = t_coep-ebeln pi_ebelp = t_coep-ebelp TABLES pto_ekbe_po = t_ekbe_po EXCEPTIONS no_records_requested = 1 OTHERS = 2. IF sy-subrc = 0. DELETE t_ekbe_po WHERE vgabe <> '2'. t_ekbe[] = t_ekbe_po[].

LOOP AT t_ekbe_po. " Crdito IF t_ekbe_po-shkzg = 'H'. " Procurar notas de devoluo SELECT docref UP TO 1 ROWS INTO v_docref FROM j_1bnfdoc WHERE belnr = t_ekbe_po-belnr AND gjahr = t_ekbe_po-gjahr AND cancel <> 'X' AND bukrs = t_coep-bukrs AND ( nftype = 'E4' OR nftype = 'I9' ). ENDSELECT. IF sy-subrc IS INITIAL. " Deletar o registro atual da tabela auxiliar DELETE t_ekbe WHERE gjahr = t_ekbe_po-gjahr AND belnr = t_ekbe_po-belnr. " Procurar devoluo SELECT SINGLE belnr gjahr INTO (v_belnr, v_gjahr) FROM j_1bnfdoc WHERE docnum = v_docref. IF sy-subrc IS INITIAL. " Apagar o documento de devoluo da EKBE DELETE t_ekbe WHERE belnr = v_belnr AND gjahr = v_gjahr. * " Apagar o documento de debito na IT_DOC DELETE t_doc WHERE belnr = v_belnr AND gjahr = v_gjahr. " Mover os registros restantes para processamento LOOP AT t_ekbe. MOVE-CORRESPONDING t_ekbe TO t_doc. CONCATENATE t_ekbe-belnr t_ekbe-gjahr INTO t_doc-refkey. t_doc-bukrs = t_coep-bukrs. APPEND t_doc. ENDLOOP. ENDIF. ELSE. " Se no houve nota de devoluo, deve gravar o registro de crdito MOVE-CORRESPONDING t_ekbe_po TO t_doc. CONCATENATE t_ekbe_po-belnr t_ekbe_po-gjahr INTO t_doc-refkey. t_doc-bukrs = t_coep-bukrs. APPEND t_doc. ENDIF. " Dbito ELSEIF t_ekbe_po-shkzg = 'S'. MOVE-CORRESPONDING t_ekbe_po TO t_doc. CONCATENATE t_ekbe_po-belnr t_ekbe_po-gjahr INTO t_doc-refkey. t_doc-bukrs = t_coep-bukrs. APPEND t_doc. ENDIF. ENDLOOP. ENDIF.

ENDLOOP. SORT t_doc. DELETE ADJACENT DUPLICATES FROM t_doc COMPARING ALL FIELDS. IF t_doc[] IS NOT INITIAL. " Cabealho da Nota Fiscal SELECT docnum direct docdat pstdat model series nfnum belnr gjahr bukrs parid nfenum INTO TABLE t_j1bnfdoc FROM j_1bnfdoc FOR ALL ENTRIES IN t_doc WHERE doctyp = '1' AND belnr = t_doc-belnr AND gjahr = t_doc-gjahr AND bukrs = t_doc-bukrs AND cancel <> 'X'. IF sy-subrc IS INITIAL. " Itens da nota fiscal SELECT l~docnum l~itmnum l~matnr l~maktx l~refkey l~refitm d~nfnum d~nfe d ~nfenum d~series INTO TABLE t_j1bnflin FROM j_1bnflin AS l INNER JOIN j_1bnfdoc AS d ON l~docnum = d~docnum FOR ALL ENTRIES IN t_doc WHERE l~reftyp = 'LI' AND l~refkey = t_doc-refkey AND l~refitm = t_doc-buzei AND d~doctyp = '1' AND d~cancel <> 'X' AND d~bukrs = t_doc-bukrs. ENDIF. IF NOT t_j1bnflin[] IS INITIAL. " Verifica tabela de dados j gravados SELECT * INTO TABLE t_zaat001 FROM zaat001 FOR ALL ENTRIES IN t_j1bnflin WHERE docnum = t_j1bnflin-docnum AND itmnum = t_j1bnflin-itmnum. LOOP AT t_zaat001. DELETE t_j1bnflin WHERE docnum = t_zaat001-docnum AND itmnum = t_zaat001-itmnum. ENDLOOP. ENDIF. IF NOT t_j1bnflin[] IS INITIAL. " Nota fiscal: imposto por item SELECT x~docnum x~itmnum x~base x~rate x~taxval x~excbas x~othbas x~taxtyp "j~taxgrp INTO TABLE t_j1bnfstx FROM j_1bnfstx AS x FOR ALL ENTRIES IN t_j1bnflin WHERE docnum = t_j1bnflin-docnum AND itmnum = t_j1bnflin-itmnum AND

( taxtyp = 'IPSU' OR taxtyp = 'ICOU' ). ENDIF. SORT t_j1bnfstx BY taxtyp. CLEAR: t_collect[], t_collect. " Soma valores de IPIS e ICOF LOOP AT t_j1bnfstx. t_collect-taxtyp = t_j1bnfstx-taxtyp. t_collect-taxval = t_j1bnfstx-taxval. t_collect-base = t_j1bnfstx-base. COLLECT t_collect. CLEAR t_collect. ENDLOOP. CLEAR: v_urwrt. " Busca valor original ja gravado SELECT SINGLE urwrt INTO v_urwrt FROM anla WHERE bukrs = i_rlambu-bukrs AND anln1 = i_rlambu-anln1 AND anln2 = i_rlambu-anln2. LOOP AT t_collect. CASE t_collect-taxtyp. WHEN 'IPSU'. READ TABLE t_anepi WITH KEY afabe = 82. IF sy-subrc = 0. v_tabix = sy-tabix. t_anepi-anbtr = t_collect-taxval. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. v_urwrt = v_urwrt + t_collect-base. ENDIF. ** INICIO - RMF - 21/02/2013 - Lanamento de valor PIS na rea 84 (Longo Prazo) READ TABLE t_anepi WITH KEY afabe = 84. IF sy-subrc = 0. v_tabix = sy-tabix. t_anepi-anbtr = t_collect-taxval / 2. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. v_urwrt = v_urwrt + t_collect-base. ENDIF. ** FIM - RMF - 21/02/2013 WHEN 'ICOU'.

READ TABLE t_anepi WITH KEY afabe = 83. IF sy-subrc = 0. v_tabix = sy-tabix. t_anepi-anbtr = t_collect-taxval. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ** INICIO - RMF - 21/02/2013 - Lanamento de valor COFINS na rea 85 (Longo Prazo) READ TABLE t_anepi WITH KEY afabe = 85. IF sy-subrc = 0. v_tabix = sy-tabix. t_anepi-anbtr = t_collect-taxval / 2. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. v_urwrt = v_urwrt + t_collect-base. ENDIF. ** FIM - RMF - 21/02/2013 ENDCASE. ENDLOOP. IF t_j1bnfstx[] IS INITIAL. LOOP AT t_anepi WHERE ( afabe = 82 OR afabe = 83 OR afabe = 84 OR afabe = 85 ). v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDLOOP. ENDIF. UPDATE anla SET urwrt = WHERE bukrs AND anln1 AND anln2 v_urwrt = i_rlambu-bukrs = i_rlambu-anln1 = i_rlambu-anln2.

IF sy-subrc = 0. COMMIT WORK. ELSE. ROLLBACK WORK. ENDIF. LOOP AT t_j1bnflin. wa_zaat001-docnum wa_zaat001-itmnum wa_zaat001-bukrs wa_zaat001-objnr wa_zaat001-mes wa_zaat001-ano = = = = = = t_j1bnflin-docnum. t_j1bnflin-itmnum. i_rlambu-bukrs. v_objnr. i_rlambu-monat. i_rlambu-gjahr.

wa_zaat001-ativo = i_rlambu-anln1. wa_zaat001-subnum = i_rlambu-anln2. INSERT zaat001 FROM wa_zaat001. IF sy-subrc = 0. COMMIT WORK. ELSE. ROLLBACK WORK. ENDIF. ENDLOOP. ELSE. READ TABLE t_anepi WITH KEY afabe = 82. IF sy-subrc = 0. v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ** INICIO - RMF - 21/02/2013 - Lanamento de valor PIS na rea 84 (Longo Prazo) READ TABLE t_anepi WITH KEY afabe = 84. IF sy-subrc = 0. v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ** FIM - RMF - 21/02/2013 READ TABLE t_anepi WITH KEY afabe = 83. IF sy-subrc = 0. v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ** INICIO - RMF - 21/02/2013 - Lanamento de valor COFINS na rea 85 (Longo Prazo) READ TABLE t_anepi WITH KEY afabe = 85. IF sy-subrc = 0. v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ** FIM - RMF - 21/02/2013 ENDIF. " Busca tipo leasing

SELECT SINGLE leart INTO v_leart FROM anla WHERE bukrs = i_rlambu-bukrs AND anln1 = i_rlambu-anln1 AND anln2 = i_rlambu-anln2. IF v_leart = '01'. READ TABLE t_anepi WITH KEY afabe = 60. IF sy-subrc = 0. v_tabix = sy-tabix. CLEAR t_anepi-anbtr. MODIFY t_anepi INDEX v_tabix TRANSPORTING anbtr. m_anepi = t_anepi. APPEND m_anepi. ENDIF. ENDIF. ENDIF.