Posted: Mon Sep 03, 2007 11:54 pm Post subject: Cальдо по заданному счёту на заданную дату
Code:
REPORT ZSALDO_ACC .
DATA: BEGIN OF GLTAB OCCURS 10,
DRCRK LIKE GLT0-DRCRK,
RYEAR LIKE GLT0-RYEAR,
TSLVT LIKE GLT0-TSLVT,
TSL01 LIKE GLT0-TSL01,
TSL02 LIKE GLT0-TSL01,
TSL03 LIKE GLT0-TSL01,
TSL04 LIKE GLT0-TSL01,
TSL05 LIKE GLT0-TSL01,
TSL06 LIKE GLT0-TSL01,
TSL07 LIKE GLT0-TSL01,
TSL08 LIKE GLT0-TSL01,
TSL09 LIKE GLT0-TSL01,
TSL10 LIKE GLT0-TSL01,
TSL11 LIKE GLT0-TSL01,
TSL12 LIKE GLT0-TSL01,
TSL13 LIKE GLT0-TSL01,
TSL14 LIKE GLT0-TSL01,
TSL15 LIKE GLT0-TSL01,
TSL16 LIKE GLT0-TSL01,
END OF GLTAB,
T_BSIS LIKE BSIS OCCURS 0 WITH HEADER LINE,
MONS(2),
MONS1(2),
GOD LIKE GLT0-RYEAR,
NFIELD(20),
PER(2) TYPE N,
BUDATE TYPE D,
SALDO LIKE GLT0-TSL01.
DATA: TSL TYPE GLT0-TSL01.
FIELD-SYMBOLS: <H>,
<S>.
PARAMETERS: BUKRS TYPE BUKRS MEMORY ID BUK OBLIGATORY,
SAKNR LIKE SKA1-SAKNR MEMORY ID SAK OBLIGATORY,
BUDAT LIKE BKPF-BUDAT DEFAULT SY-DATUM OBLIGATORY.
TABLES: GLT0.
START-OF-SELECTION.
BUDATE = BUDAT.
BUDATE+6(2) = '01'.
GOD = BUDAT(4).
MONS = BUDAT+4(2).
IF MONS = '01'.
GOD = GOD - 1.
ENDIF.
CLEAR: GLTAB, T_BSIS.
REFRESH: GLTAB, T_BSIS.
SELECT * FROM GLT0
WHERE RLDNR = '00'
AND RRCTY = '0'
AND RVERS = '001'
AND BUKRS = BUKRS
AND RYEAR <= GOD
AND RACCT = SAKNR
AND RPMAX = '016'.
MOVE-CORRESPONDING GLT0 TO GLTAB.
COLLECT GLTAB.
ENDSELECT.
SELECT * FROM BSIS APPENDING TABLE T_BSIS
WHERE BUKRS = BUKRS
AND HKONT = SAKNR
AND BUDAT >= BUDATE
AND BUDAT < BUDAT.
CLEAR: SALDO.
CONCATENATE 'GLTAB-TSL' MONS INTO NFIELD.
LOOP AT GLTAB.
PER = '01'.
IF GLTAB-RYEAR < BUDAT(4).
MONS1 = 17.
ELSE.
MONS1 = MONS.
ENDIF.
SUBTRACT 1 FROM MONS1.
DO MONS1 TIMES
VARYING TSL FROM GLTAB-TSL01 NEXT GLTAB-TSL02.
SALDO = SALDO + TSL.
ENDWHILE.
ENDLOOP.
LOOP AT T_BSIS.
CASE T_BSIS-SHKZG.
WHEN 'H'.
SALDO = SALDO - T_BSIS-DMBTR.
WHEN 'S'.
SALDO = SALDO + T_BSIS-DMBTR.
ENDCASE.
ENDLOOP.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.