总账科目凭证明细清单

*&---------------------------------------------------------------------*
*& Report  ZFI_R_22_GL
*&
*&---------------------------------------------------------------------*
*& Created   2009.04.08       LU.X
*& Old name  ZSMARTFORM1
*&---------------------------------------------------------------------*


report  zfi_r_22_gl                             .
datafm_name type rs38l_fnam.
dataw_sflight like bsis occurs with header line.

tablesbsas,bsis.
dataw_si type i,
      w_pi type i,
      w_pl type i,
      w_txt50 type skat-txt50,
      w_hkont type bsas-hkont.

dataw_bsas like table of bsis with header line.
dataw_bsas1 like table of bsis with header line.
selection-screen begin of block block.
parametersp_bukrs like bsad-bukrs obligatory default '1000'.    "Company Code
parameters     p_hkont like bsis-hkont obligatory.
*SELECT-OPTIONS p_hkont FOR bsis-hkont obligatory.
select-options     p_bldat for bsas-bldat.
parameters     p_gjahr like bsas-gjahr.
*PARAMETERS     p_bukrs LIKE bsas-bukrs.
selection-screen end of block block.

*公司代码的权限控制
at selection-screen on p_bukrs.
    authority-check object 'F_BKPF_BUK' id 'BUKRS' field p_bukrs
                                        id 'ACTVT' field '03'.
    if sy-subrc ne 0.
      message  e007(zfiwith '你没有权限查看' p_bukrs '公司代码的数据!'.
      exit.
    endif.

select txt50 into w_txt50
from skat  up to  rows
where saknr p_hkont
      and ktopl '1000'.
endselect.

select  mandt bukrs hkont belnr bldat wrbtr waers dmbtr sgtxt shkzg
from  bsas  into corresponding  fields of table w_bsas
where gjahr p_gjahr
and bukrs p_bukrs
and hkont p_hkont
and bldat in p_bldat.

select  mandt bukrs hkont belnr bldat wrbtr waers dmbtr sgtxt shkzg
from  bsis  appending corresponding  fields of table w_bsas
where gjahr p_gjahr
and bukrs p_bukrs
and hkont p_hkont
and bldat in p_bldat.

loop at w_bsas.
  if w_bsas-shkzg 'H'.
    w_bsas-wrbtr w_bsas-wrbtr * -1.
    w_bsas-dmbtr w_bsas-dmbtr * -1.
    modify w_bsas.
  endif.
endloop.


w_sflight[] w_bsas[].
sort w_sflight by bldat belnr.



*SELECT * FROM bsis INTO TABLE w_sflight up to 100 rows.

call function 'SSF_FUNCTION_MODULE_NAME'
  exporting
    formname
*    ='ZFI_ACCOUNT_Q
    ='ZSMARTFORMS'
  importing
    fm_name            fm_name
  exceptions
    no_form            1
    no_function_module 2
    others       3.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.




if sy-subrc <> 0.
  exit.
endif.
write fm_name.
call function fm_name
  exporting
    txt50            w_txt50
    hkont            p_hkont
  tables
    i_bsis           w_sflight
  exceptions
    formatting_error
    =1
    internal_error
    =2
    send_error
    =3
    user_canceled
    =4
    others           5.
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.




if sy-subrc <> 0.
endif.



*****************************************************************
P_BLDAT 凭证日期
P_BUKRS 公司代码
P_GJAHR 会计年度
P_HKONT 总帐帐目
请使用浏览器的分享功能分享到微信等