Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to code this

Former Member
0 Likes
427

1) Read Function modules FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET to ge the first and last dates of the periods entered on the selection screen. Here Year = First 4 characters and Period = Next two characters of YearPeriod field of the selection screen.

2) Read VBAK and filter all the sales documents where VBAK - AUART is ZJE or ZJR and VBAK – AUDAT in the first and last dates of the periods detrmined from the above step.

3 REPLIES 3
Read only

Former Member
0 Likes
404

Hi

To get the First day (Start date) of the month and the Last day (End date) calendar day of the month for a given file run date in the Selection screen.

We can use this Function Module 'LAST_DAY_OF_MONTHS'.

For Eg :

To get the Start date first day of the month of the file run and ENDA equal to the last calendar day of the month of the file run based on the File Run Date given in the Selection .( You can use the following code snippet) …

DATA: FIRST_DATE LIKE SY-DATUM.

DATA: LAST_DATE LIKE SY-DATUM.

*

CALL FUNCTION 'LAST_DAY_OF_MONTHS'

EXPORTING

DAY_IN = SY-DATUM

IMPORTING

LAST_DAY_OF_MONTH = LAST_DATE.

*

CONCATENATE LAST_DATE+0(6) '01' INTO FIRST_DATE.

*

WRITE: / FIRST_DATE, LAST_DATE.

Read only

0 Likes
404

i need to use the function modules to get the result..

read it properly

Read only

Former Member
0 Likes
404

You can try this:

REPORT ztest_l.

parameter: period(6) type c.

Data: date1 like sy-datum.

data: date2 like sy-datum.

DATA: YEAr type T009B-BDATJ.

data: per(2) type c .

data : fp like T009B-periv.

data: perod type T009B-POPER.

year = period+0(4).

per = period+4(2).

concatenate '0' per into perod.

select PERIV from T009B into fp where poper = perod.

endselect.

CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = year

  • I_MONMIT = 00

i_periv = fp

i_poper = perod

IMPORTING

E_DATE = date1

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write:/ date1.

reward points if useful.

CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = year

  • I_MONMIT = 00

i_periv = fp

i_poper = perod

IMPORTING

E_DATE = date2

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write:/ date2.

Reward points if useful.