Application Development 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: 

VBAK fetch based on month only

Former Member
0 Kudos

Hi Team,

I'm getting input of the individual elements(day,month and year) of date field and constructing the required date.

Based on this date I'm fetching sales documents from the VBAP table

by comparing this date with the ERDAT field.

In case,if some components are not input;for instance,only if the month field

is entered ,my report should list the documents dated on the specified month

of any day and year.

How to accomplish this?

Regards,

Lakshmanan

3 REPLIES 3

Former Member
0 Kudos

If month is blank.. use sy-datum month.

same to other fields also... date is blank means use sy-datum date.

here is sample code..

data:

w_date(2),

w_month(2),

w_year(4),

w_fulldate like sy-datum.

w_date = '05'.

w_month = '10'.

w_year = '2007'.

if w_date is initial.

w_date = sy-datum+6(2).

endif.

if w_month is initial.

w_month = sy-datum+4(2).

endif.

if w_year is initial.

w_year = sy-datum+0(4).

endif.

concatenate w_year

w_month

w_date

into w_fulldate.

Message was edited by:

Rama Jyothi

0 Kudos

Hi Rama,

Now I'm using the following condition inside my select loop,

ERDAT = date,where date is of the usual form 12.10.2007 and I'm

constructing this from the individual fields.

Suppose if only the month is entered ,the resulting date is

something like this 00.10.0000.In this case no records are selected.

If I'm going to use sy-datum year and date as they are blank only

respective date's documents will be listed,while my requirement is to

list the documents only for the specified month of every year and day.

Regards,

Lakshmanan

Former Member
0 Kudos

Hi

You need to write some conditions and get the no of days for the month and put them in one range get the values from the table

to get the no of days per month

use FM ISHMED_GET_DAYS_PER_MONTH

regards

Shiva