Calculate/find number of working days between two dates in SAP

Go down

Calculate/find number of working days between two dates in SAP

Post  Uma_ABAP on Tue Apr 24, 2012 2:06 pm

REPORT ZFIND_WORKING_DAYS.

SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_INDAT TYPE SY-DATUM,
P_OUTDAT TYPE SY-DATUM.
SELECTION-SCREEN: END OF BLOCK B1.

DATA: BEGIN OF ETH_DATS OCCURS 0.
INCLUDE STRUCTURE RKE_DAT.
DATA: END OF ETH_DATS .


DATA: V_LINES TYPE I.

IF P_INDAT LE P_OUTDAT.

CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
EXPORTING
I_DATAB = P_INDAT
I_DATBI = P_OUTDAT
I_FACTID = 'US'
TABLES
ETH_DATS = ETH_DATS
EXCEPTIONS
DATE_CONVERSION_ERROR = 1
OTHERS = 2.

ELSE.

CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
EXPORTING
I_DATAB = P_OUTDAT
I_DATBI = P_INDAT
I_FACTID = 'US'
TABLES
ETH_DATS = ETH_DATS
EXCEPTIONS
DATE_CONVERSION_ERROR = 1
OTHERS = 2.

ENDIF.

DESCRIBE TABLE ETH_DATS LINES V_LINES.

WRITE:/ 'the no of working days is :' , V_LINES.

WRITE:/ .

WRITE:/ 'working days are:'.

LOOP AT ETH_DATS .
WRITE:/ ETH_DATS.
ENDLOOP.

Uma_ABAP

Posts : 56
Join date : 2012-03-31

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum