MZFICOM003TOP

Embed Size (px)

DESCRIPTION

Programa ABAP

Citation preview

*&---------------------------------------------------------------------**& Include MZFICOM003TOP **& **&---------------------------------------------------------------------**&---------------------------------------------------------------------**& Declarao de dados globais*&---------------------------------------------------------------------**&constants: c_mark type c value 'X'.controls: tb_comissao type tableview using screen 0200, tb_impostos type tableview using screen 0200, tb_historico type tableview using screen 0400, tb_tvbur type tableview using screen 0500.tables : zfitcom011, zfiecom001, zfitcom009, tvbur, bsis, zfitcom014, lfbw.data : v_lines like sy-loopc, v_mark type c, v_copied type c, v_cop400 type c, v_indice type i, v_oldind type i, v_indatu type i, v_answer type c, v_rescisao type c, v_confirm type c, v_tabix like sy-tabix, v_dynnr like sy-dynnr, ok_code like sy-ucomm, code100 like sy-ucomm, v_totreal like zfitcom004-vlreal, v_totpdd like zfitcom004-vlpdd, v_linhas(02) type n, v_mod3 type c, v_vlcorr like zfitcom011-vlcorr, v_zuonr like bseg-zuonr, v_numdoc like zfitcom003-numdoc, v_compdc like zfitcom003-compdc, v_totbase12 like zfitcom011-vlcorr, v_msg(256) type c, v_valor(16) type c, v_totlin type i, v_valant type p decimals 8, v_dest like rfcdes-rfcdest, v_campo(20) type c, v_chg_lfbw type c, v_bukrs like zfitcom004-bukrs.*&---------------------------------------------------------------------**& Macros e field-symbols*&---------------------------------------------------------------------**&define append_compda. loop at t_compdoc into wa_compdoc where ( bukrs eq wa_bsad-bukrs ) and ( kunnr eq wa_bsad-kunnr ) and ( augbl eq wa_bsad-augbl ). wa_compda = wa_compdoc. append wa_compda to t_compda. endloop.end-of-definition.*&---------------------------------------------------------------------**& Tabelas internas e work areas ( telas )*&---------------------------------------------------------------------**&data: wa_auxhist type zfic2_wa_historico, wa_historico type zfic2_wa_historico.data: t_item type zfic2_zfitcom004, t_aux type zfic2_zfitcom004, t_itemaux type zfic2_zfitcom004, wa_itemaux type zfic2_wa_item, t_oldite type zfic2_zfitcom004, t_oldhist type zfic2_historico, t_auxhist type zfic2_historico, t_historico type zfic2_historico.*&---------------------------------------------------------------------**& Tabelas internas e work areas ( funes e rotinas )*&---------------------------------------------------------------------**&data: begin of wa_shdb, mark type c, hkont like zfitcom004-hkont, belnr like zfitcom004-belnr, buzei like zfitcom004-buzei, gjahr like zfitcom004-gjahr, nfnum like zfitcom003-nfnum, zuonr like zfitcom004-zuonr, gsber like zfitcom004-gsber, lifnr like lfa1-lifnr, vkbur like tvbur-vkbur, pagnr like zfitcom003-pagnr, totalnf like zfiecom002-totalnf, vlpgto like zfitcom004-vlpgto, vlperd like zfitcom004-vlperd, vldesc like zfitcom004-vldesc, vlpdd like zfitcom004-vlpdd, end of wa_shdb.data: begin of wa_shdb60, mark type c, hkont like zfitcom004-hkont, gsber like zfitcom004-gsber, belnr like zfitcom004-belnr, buzei like zfitcom004-buzei, gjahr like zfitcom004-gjahr, nfnum like zfitcom003-nfnum, zuonr like zfitcom004-zuonr, lifnr like lfa1-lifnr, vkbur like tvbur-vkbur, pagnr like zfitcom003-pagnr, totalnf like zfiecom002-totalnf, vlpgto like zfitcom004-vlpgto, vlperd like zfitcom004-vlperd, vldesc like zfitcom004-vldesc, vlpdd like zfitcom004-vlpdd, end of wa_shdb60.data: wa_tvbur like tvbur, wa_lfa1 type zfico_wa, wa_spopli like spopli, wa_status like dd07v, wa_aux like zfitcom003, wa_shdbaux like wa_shdb, wa_60aux like wa_shdb60, wa_impostos like zfiecom001, wa_id like arfctid, wa_finan like zfitcom006.*> estrutura para batch input/call transactiondata: wa_bdcdata like bdcdata, wa_bdcaux like bdcdata, wa_messtab like bdcmsgcoll, t_bdcdata like standard table of bdcdata, t_bdcaux like t_bdcdata, t_bdcaux2 like t_bdcdata, t_messtab like standard table of bdcmsgcoll.data: t_tvbur like standard table of wa_tvbur, t_finan like standard table of wa_finan, t_tverr like standard table of wa_tvbur, t_status like standard table of dd07v, t_lfa1 type zfico_fornec, t_spopli like standard table of spopli, t_impostos like standard table of wa_impostos, t_auxdev like standard table of wa_item, t_auxprn like t_zfitcom004, t_auxbase like t_base12, t_shdb like standard table of wa_shdb, t_shdb60 like standard table of wa_shdb60, t_lfbw_old like standard table of lfbw.*&---------------------------------------------------------------------**& Tela de seleo*&---------------------------------------------------------------------**&selection-screen begin of screen 0110 as subscreen.selection-screen begin of block b1 with frame title text-s01.parameters: p_bukrs like zfitcom003-bukrs obligatory.select-options: s_vkbur for zfitcom003-vkbur, s_pagnr for zfitcom004-pagnr matchcode object zficom_pagnr.select-options: s_docto for bsis-belnr modif id aba.parameters p_data like zfitcom003-quinzena.selection-screen end of block b1.selection-screen begin of block b2 with frame title text-s02.selection-screen begin of line.parameters p_novcom as checkbox default c_mark.selection-screen comment (40) for field p_novcom.selection-screen end of line.selection-screen begin of line.parameters p_ctocom as checkbox default c_mark.selection-screen comment (40) for field p_ctocom.selection-screen end of line.selection-screen end of block b2.selection-screen begin of block b3 with frame title text-s07.selection-screen begin of line.parameters p_excjob as checkbox default ' '.selection-screen comment (40) for field p_excjob.selection-screen end of line.selection-screen end of block b3.selection-screen end of screen 0110.selection-screen begin of screen 0101 title text-s03 as window.selection-screen begin of block s1 with frame title text-s04.parameters: p_mode type c default 'N'.selection-screen end of block s1.selection-screen end of screen 0101.selection-screen begin of screen 0120 title text-s05 as window.selection-screen begin of block s2 with frame title text-s06.parameters: p_indi like zfitcom009-indice default 'CORR' obligatory, p_mes like zfitcom009-mes obligatory, p_ano like zfitcom009-ano obligatory, p_val like zfitcom009-valind obligatory.selection-screen end of block s2.selection-screen end of screen 0120.*&---------------------------------------------------------------------**& Event selection-screen output*&---------------------------------------------------------------------**&at selection-screen output. loop at screen. if ( screen-group1 eq 'ABA' ) and ( sy-uname+00(04) ne 'ABAP' and sy-uname ne 'FABIANO' and sy-uname ne 'SILVIO' and sy-uname ne 'PATI' ). screen-active = 0. modify screen. endif. endloop.*&---------------------------------------------------------------------**& Event at selection-screen*&---------------------------------------------------------------------**&at selection-screen. if ( not sy-ucomm is initial ). case sy-dynnr. when '0110'. refresh s_xref3. loop at s_vkbur. move-corresponding s_vkbur to s_xref3. append s_xref3. endloop. when '0120'. select single * from zfitcom009 into zfitcom009 where ( indice eq p_indi ) and ( mes eq p_mes ) and ( ano eq p_ano ). if ( sy-subrc eq 0 ). message e999(zarm) with text-m31. endif. select * from zfitcom009 into table t_indices where ( indice eq p_indi ). sort t_indices by indice ano descending mes descending.*> Verifica se o perodo informado o prximo esperado. read table t_indices into wa_indices index 1. if ( sy-subrc eq 0 ). if ( wa_indices-mes eq 12 ). wa_indices-mes = 1. wa_indices-ano = wa_indices-ano + 1. else. wa_indices-mes = wa_indices-mes + 1. endif. if ( wa_indices-ano ne p_ano ) or ( wa_indices-mes ne p_mes ). message e999(zarm) with text-m32 wa_indices-mes wa_indices-ano. endif. endif. clear zfitcom009. zfitcom009-indice = p_indi. zfitcom009-mes = p_mes. zfitcom009-ano = p_ano. zfitcom009-valind = p_val. zfitcom009-valori = p_val. insert zfitcom009. commit work. endcase. endif.at selection-screen on p_bukrs. REFRESH S_BUKRS. s_bukrs-sign = 'I'. s_bukrs-option = 'EQ'. s_bukrs-low = P_BUKRS. append s_bukrs.