2、固定资产业务过渡科目摘要增强功能-MIGO
ENHANCEMENT 2 ZEHENC_SAPMF05A. "active version
* FI 20221215:固定资产业务过渡科目摘要增强功能
WAIT UP TO 1 SECONDS.READ TABLE xbseg WITH KEY hkont = '1601990001'.
IF sy-subrc = 0.DATA: lt_bkdf TYPE TABLE OF bkdf,lt_bkpf TYPE TABLE OF bkpf,ls_bkpf TYPE bkpf,lt_bsec TYPE TABLE OF bsec,lt_bsed TYPE TABLE OF bsed,ls_bseg TYPE bseg,lt_bseg TYPE TABLE OF bseg,lt_bset TYPE TABLE OF bset.DATA: ls_belnr_second TYPE belnr_d.DATA: ls_xbkpf TYPE bkpf.CLEAR: ls_bkpf,lt_bkpf[],lt_bseg[],ls_xbkpf.DATA: ls_bkpf_judge TYPE bkpf.CLEAR: ls_bkpf_judge.ls_belnr_second = bkpf-belnr + 1.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = ls_belnr_secondIMPORTINGoutput = ls_belnr_second.SELECT SINGLE *INTO CORRESPONDING FIELDS OF ls_bkpf_judgeFROM bkpfWHERE bukrs eq bkpf-bukrsAND gjahr eq bkpf-gjahrAND belnr EQ ls_belnr_second.if ls_bkpf_judge IS NOT INITIAL.ls_bkpf-mandt = sy-mandt.ls_bkpf-bukrs = bkpf-bukrs.ls_bkpf-gjahr = bkpf-gjahr.ls_bkpf-belnr = ls_belnr_second.APPEND ls_bkpf TO lt_bkpf.LOOP AT xbseg.CLEAR: ls_bseg.ls_bseg-mandt = sy-mandt.ls_bseg-bukrs = xbseg-bukrs.ls_bseg-gjahr = xbseg-gjahr.ls_bseg-buzei = xbseg-buzei.ls_bseg-belnr = ls_belnr_second.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = xbseg-belnrIMPORTINGoutput = xbseg-belnr.ls_bseg-sgtxt = xbseg-sgtxt && '-原凭证(' && xbseg-belnr && ')'.APPEND ls_bseg TO lt_bseg.ENDLOOP.CALL FUNCTION 'CHANGE_DOCUMENT'TABLESt_bkdf = lt_bkdft_bkpf = lt_bkpft_bsec = lt_bsect_bsed = lt_bsedt_bseg = lt_bsegt_bset = lt_bset.IF sy-subrc EQ 0.COMMIT WORK AND WAIT.ENDIF.ENDIF.
ENDIF.
* FI 20221215
ENDENHANCEMENT.
ENHANCEMENT 1 Z_MIGO_CREATE_ACC_DOCUMENT. "active version" FI 20221230:MIGO自动生成会计凭证增强 LIANG ED1K924636DATA: lt_bkdf TYPE TABLE OF bkdf,lt_bsec TYPE TABLE OF bsec,lt_bsed TYPE TABLE OF bsed,lt_bset TYPE TABLE OF bset.DATA: ls_BKPF1 TYPE BKPF,ls_BKPF2 TYPE BKPF,lt_BKPF TYPE TABLE OF BKPF.DATA: LT_BKPF_RESULT TYPE TABLE OF BKPF.DATA: ls_bseg TYPE bseg,lt_bseg TYPE TABLE OF bseg.DATA: ls_bseg_temp TYPE bseg.DATA: ls_AWKEY TYPE bkpf-AWKEY.CLEAR: lt_BKPF[],ls_BKPF1,ls_BKPF2,ls_AWKEY,ls_bseg_temp,ls_bseg,lt_bseg[],LT_BKPF_RESULT[].ls_AWKEY = ls_emkpf-MBLNR && ls_emkpf-MJAHR.SELECT *INTO CORRESPONDING FIELDS OF TABLE lt_BKPFFROM BKPFWHERE AWKEY EQ ls_AWKEY.SORT lt_BKPF BY BELNR ASCENDING.IF sy-subrc EQ 0.READ TABLE lt_BKPF INTO ls_BKPF1 INDEX 1.READ TABLE lt_BKPF INTO ls_BKPF2 INDEX 2.APPEND ls_BKPF2 TO LT_BKPF_RESULT.SELECT *INTO CORRESPONDING FIELDS OF TABLE lt_bsegFROM bsegWHERE BUKRS EQ ls_BKPF2-bukrsAND BELNR EQ ls_BKPF2-BELNRAND GJAHR EQ ls_BKPF2-GJAHR.LOOP AT lt_bseg INTO ls_bseg.IF ls_bseg-hkont EQ '1601990001'.CLEAR: ls_bseg_temp." 取第一个行项目的行项目文本SELECT SINGLE *INTO CORRESPONDING FIELDS OF ls_bseg_tempFROM bsegWHERE BUKRS EQ ls_bseg-bukrsAND BELNR EQ ls_BKPF1-BELNRAND GJAHR EQ ls_bseg-GJAHRAND BUZEI EQ ls_bseg-BUZEI.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = ls_bseg_temp-belnrIMPORTINGoutput = ls_bseg_temp-belnr.ls_bseg-sgtxt = ls_bseg_temp-sgtxt && '-原凭证(' && ls_bseg_temp-belnr && ')'.MODIFY lt_bseg FROM ls_bseg.ENDIF.ENDLOOP.CALL FUNCTION 'CHANGE_DOCUMENT'TABLESt_bkdf = lt_bkdft_bkpf = LT_BKPF_RESULTt_bsec = lt_bsect_bsed = lt_bsedt_bseg = lt_bsegt_bset = lt_bset.ENDIF." FI 20221230 LIANG ED1K924636
ENDENHANCEMENT.
* 反记账替代 Modify By LIANG ED1K924602 20221226exits-name = 'U305'.exits-param = c_exit_param_field.exits-title = TEXT-305. "APPEND exits.
* FI 20221226 主营业务收入等科目自动反记账功能
*
FORM u305 USING bseg-xnegp TYPE bseg-xnegp.DATA: ls_zfi_fjz1 TYPE zfi_fjz.DATA: ls_zfi_fjz2 TYPE zfi_fjz.CLEAR: ls_zfi_fjz1,ls_zfi_fjz2.SELECT SINGLE *INTO CORRESPONDING FIELDS OF ls_zfi_fjz1FROM zfi_fjzWHERE hkontf <= bseg-hkontAND hkontt >= bseg-hkont.IF sy-subrc EQ 0.IF bseg-shkzg = ls_zfi_fjz1-shkzg.bseg-xnegp = ''.ELSE.bseg-xnegp = 'X'.ENDIF.ELSE.SELECT SINGLE *INTO CORRESPONDING FIELDS OF ls_zfi_fjz2FROM zfi_fjzWHERE hkontf = bseg-hkont.IF sy-subrc EQ 0.IF bseg-shkzg = ls_zfi_fjz2-shkzg.bseg-xnegp = ''.ELSE.bseg-xnegp = 'X'.ENDIF.ENDIF.ENDIF.
ENDFORM.
* FI 20221226