sorry can not get your actual requirement.
if your internal table contains this data then you can do like this.
loop at itab.
if itab-endda(6) ne itab-begda(6).
delete itab index sy-tabix.
endif.
endloop.
please clear me if it is not your requirement.
regards
shiba dutta
Hi,
Store the date by concatenating the month and year from sy-datum and using 01 for date in a variable called v1.
select * from db into table itab where begda > = v1 and endda < = v1.
Hi Rajneesh,
Please refer the reply of Kripa in the link,
sample code for month / year needed
Similarly you can fetch for the specific month data.
Hope this helps.
Regards,
Hema.
Reward points if it is useful.
Hello Rajneesh
You could use a function module like HR_JP_MONTH_BEGIN_END_DATE to determine begin date and end date of a month based on a single date. Then you select:
SELECT * FROM <guess some infotype> INTO TABLE gt_itab WHERE ( endda >= ev_month_begin_date AND endda <= ev_month_end_date ) AND ( begda >= ev_month_begin_date AND begda <= ev_month_end_date ).
00000004 31.12.9999 01.02.2007: 01.02.2007 > 31.01.2007 -> not selected
00000004 31.01.2007 05.01.2007: selected
00000004 04.01.2007 13.11.2006: 13.11.2006 < 01.01.2007 -> not selected
00000004 12.11.2006 14.01.1982: 12.11.2006 < 01.01.2007 -> not selected
Regards
Uwe
hi Rajneesh,
Just copy this demo code of mine ,it will serve ur purpose..u have to just fetch dat based on ur requirement from databsae and then use my logic as below..solution 2 is exactly same as tht of ur requirement.
reward if helpfull.
1)tables pa0006.
data:begin of itab occurs 0,
pernr like p0006-pernr,
begda like p0006-begda,
endda like p0006-endda,
end of itab.
data itab1 like table of itab with header line.
data d_beg like p0006-begda.
data d_end like p0006-begda.
select * from pa0006 up to 20 rows into corresponding fields of table itab.
loop at itab.
d_beg = itab-begda.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = d_beg
IMPORTING
LAST_DAY_OF_MONTH = d_end.
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2 .
if itab-endda ge d_beg and itab-endda le d_end.
move itab to itab1.
append itab1.
endif.
endloop.
loop at itab1.
write:/ itab1.
endloop.
2) tables pa0006.
data:begin of itab occurs 0,
pernr like p0006-pernr,
begda like p0006-begda,
endda like p0006-endda,
end of itab.
data itab1 like table of itab with header line.
data d_beg like p0006-begda.
data d_end like p0006-begda.
*select * from pa0006 up to 20 rows into corresponding fields of table itab.
Clear itab.
itab-pernr = '00000004'.
itab-begda = '20070105'.
itab-endda = '20070131'.
append itab.
itab-pernr = '00000004'.
itab-begda = '20070201'.
itab-endda = '99991231'.
append itab.
loop at itab.
d_beg = itab-begda.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = d_beg
IMPORTING
LAST_DAY_OF_MONTH = d_end.
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2 .
if itab-endda ge d_beg and itab-endda le d_end.
move itab to itab1.
append itab1.
endif.
clear itab.
endloop.
loop at itab1.
write:/ itab1.
endloop.
Message was edited by:
Amit Tyagi
Add a comment