View previous topic :: View next topic
Author
Message
tdebug Участник Joined: 26 Feb 2009 Posts: 6
Posted: Thu Nov 11, 2010 3:11 pm Post subject: CCM_GO_BACK_MONTHS
Поделитесь плиз, кто может, исходным кодом ФМ "CCM_GO_BACK_MONTHS". В нашей инсталяции такого модуля нет к сож. Если не ошибаюсь он из функ. группы CCMC.
Back to top
Igor_34_rus Специалист Joined: 08 Apr 2009 Posts: 75
Posted: Thu Nov 11, 2010 5:00 pm Post subject:
FUNCTION CCM_GO_BACK_MONTHS .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(CURRDATE) LIKE SY-DATUM
*" VALUE(BACKMONTHS) TYPE NUMC3
*" EXPORTING
*" VALUE(NEWDATE) LIKE SY-DATUM
*"----------------------------------------------------------------------
DATA: YEAR(4) TYPE C,
TMONTHS TYPE NUMC3,
T1MONTHS TYPE NUMC3,
DAY(2) TYPE C.
MOVE: CURRDATE(4) TO YEAR,
CURRDATE+4(2) TO TMONTHS,
CURRDATE+6(2) TO DAY.
*t1months = tmonths - backmonths.
IF TMONTHS <= BACKMONTHS.
CURRDATE(4) = CURRDATE(4) - 1.
CURRDATE+4(2) = '12'.
BACKMONTHS = BACKMONTHS - TMONTHS.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
CURRDATE = CURRDATE
BACKMONTHS = BACKMONTHS
IMPORTING
NEWDATE = NEWDATE.
* call function recursively
ELSE.
NEWDATE(4) = CURRDATE(4).
NEWDATE+6(2) = CURRDATE+6(2).
NEWDATE+4(2) = CURRDATE+4(2) - BACKMONTHS.
ENDIF.
ENDFUNCTION.
Back to top
tav_48 Участник Joined: 27 Oct 2008 Posts: 3
Posted: Thu Nov 11, 2010 7:16 pm Post subject:
Более новая версия ФМ'а:
Code:
FUNCTION CCM_GO_BACK_MONTHS .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(CURRDATE) LIKE SY-DATUM
*" VALUE(BACKMONTHS) TYPE NUMC3
*" EXPORTING
*" VALUE(NEWDATE) LIKE SY-DATUM
*"----------------------------------------------------------------------
*DATA: YEAR(4) TYPE C,
* TMONTHS TYPE NUMC3,
* T1MONTHS TYPE NUMC3,
* DAY(2) TYPE C.
*
*MOVE: CURRDATE(4) TO YEAR,
* CURRDATE+4(2) TO TMONTHS,
* CURRDATE+6(2) TO DAY.
*
**t1months = tmonths - backmonths.
*IF TMONTHS <= BACKMONTHS.
* CURRDATE(4) = CURRDATE(4) - 1.
* CURRDATE+4(2) = '12'.
* BACKMONTHS = BACKMONTHS - TMONTHS.
* CALL FUNCTION 'CCM_GO_BACK_MONTHS'
* EXPORTING
* CURRDATE = CURRDATE
* BACKMONTHS = BACKMONTHS
* IMPORTING
* NEWDATE = NEWDATE.
*
** call function recursively
*ELSE.
* NEWDATE(4) = CURRDATE(4).
* NEWDATE+6(2) = CURRDATE+6(2).
* NEWDATE+4(2) = CURRDATE+4(2) - BACKMONTHS.
*ENDIF.
DATA: BEGIN OF DAT,
JJJJ(4) ,
MM(2) ,
TT(2) ,
END OF DAT,
BEGIN OF HDAT,
JJJJ(4) ,
MM(2) ,
TT(2) ,
END OF HDAT,
NEWMM TYPE P,
DIFFJJJJ TYPE P.
WRITE: CURRDATE+0(4) TO DAT-JJJJ,
CURRDATE+4(2) TO DAT-MM,
CURRDATE+6(2) TO DAT-TT.
DIFFJJJJ = ( DAT-MM + ( - BACKMONTHS ) - 1 ) DIV 12.
NEWMM = ( DAT-MM + ( - BACKMONTHS ) - 1 ) MOD 12 + 1.
DAT-JJJJ = DAT-JJJJ + DIFFJJJJ.
IF NEWMM < 10.
WRITE '0' TO DAT-MM+0(1).
WRITE NEWMM TO DAT-MM+1(1).
ELSE.
WRITE NEWMM TO DAT-MM.
ENDIF.
IF DAT-TT > '28'.
HDAT-TT = '01'.
NEWMM = ( DAT-MM ) MOD 12 + 1.
HDAT-JJJJ = DAT-JJJJ + ( ( DAT-MM ) DIV 12 ).
IF NEWMM < 10.
WRITE '0' TO HDAT-MM+0(1).
WRITE NEWMM TO HDAT-MM+1(1).
ELSE.
WRITE NEWMM TO HDAT-MM.
ENDIF.
IF DAT-TT = '31'.
NEWDATE = HDAT.
NEWDATE = NEWDATE - 1.
ELSE.
IF DAT-MM = '02'.
NEWDATE = HDAT.
NEWDATE = NEWDATE - 1.
ELSE.
NEWDATE = DAT.
ENDIF.
ENDIF.
ELSE.
NEWDATE = DAT.
ENDIF.
ENDFUNCTION.
Back to top
tdebug Участник Joined: 26 Feb 2009 Posts: 6
Posted: Fri Nov 12, 2010 1:16 am Post subject:
Спасибо!
Back to top
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 can 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.