2009 Feb 18 6:14 AM
Hi,
i gone through the different threads related to date issue, but i didnt find my issue.
In selection screen : pbudat 01.12.2008 to 31.03.2009
it will fetch the data from MKPF camparing BUDAT (say for field qty MENGE).
and it should display differentiating monthwise, means
dec-08 jan-09 feb-09 mar-09
mkpf-menge mkpf-menge mkpf-menge mkpf-menge
2009 Feb 18 6:31 AM
Hi,
Test the following Sample Code it will Solve out your problem.
DATA: BEGIN OF it_datemy OCCURS 12,
datemy LIKE sy-datum,
datecmy(20),
END OF it_datemy.
it_datemy-datemy = '20080101'.
DO 12 TIMES.
APPEND it_datemy TO it_datemy.
ADD 1 TO it_datemy-datemy+4(2).
ENDDO.
LOOP AT it_datemy INTO it_datemy.
CASE it_datemy+4(2).
WHEN 1.
CONCATENATE: 'Jan' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 2.
CONCATENATE: 'Feb' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 3.
CONCATENATE: 'Mar' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 4.
CONCATENATE: 'Apr' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 5.
CONCATENATE: 'May' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 6.
CONCATENATE: 'Jun' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 7.
CONCATENATE: 'Jul' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 8.
CONCATENATE: 'Agu' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 9.
CONCATENATE: 'Sep' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 10.
CONCATENATE: 'Oct' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 11.
CONCATENATE: 'Nov' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 12.
CONCATENATE: 'Dec' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN OTHERS.
ENDCASE.
MODIFY it_datemy FROM it_datemy.
ENDLOOP.
LOOP AT it_datemy INTO it_datemy.
WRITE: / it_datemy-datecmy.
ENDLOOP.Kind Regards,
Faisal
Hi,
i gone through the different threads related to date issue, but i didnt find my issue.
In selection screen : pbudat 01.12.2008 to 31.03.2009
it will fetch the data from MKPF camparing BUDAT (say for field qty MENGE).
and it should display differentiating monthwise, means
dec-08 jan-09 feb-09 mar-09
mkpf-menge mkpf-menge mkpf-menge mkpf-menge
2009 Feb 18 6:19 AM
Hi,
separate the string using offset and then try to print the data accordingly.
loop at itab.
if itab-budat+4(2) = 12 and itab-budat+0(4) = 2008.
then print the data of the month. "--> Data to be displayes
and the data of the month.
else...
endif.
endloop.regards
sarves
2009 Feb 18 6:22 AM
Hi ,
After fetching records in internal table you write a short program to display according to your requirement ---
data : w_budat(2).
loop at t_itab into fs_itab.
if fs_itab-bdut+4(2) ne w_budat.
uline.
endif.
w_budat = fs_itab-bdut+4(2).
endloop.
2009 Feb 18 6:31 AM
Hi,
Test the following Sample Code it will Solve out your problem.
DATA: BEGIN OF it_datemy OCCURS 12,
datemy LIKE sy-datum,
datecmy(20),
END OF it_datemy.
it_datemy-datemy = '20080101'.
DO 12 TIMES.
APPEND it_datemy TO it_datemy.
ADD 1 TO it_datemy-datemy+4(2).
ENDDO.
LOOP AT it_datemy INTO it_datemy.
CASE it_datemy+4(2).
WHEN 1.
CONCATENATE: 'Jan' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 2.
CONCATENATE: 'Feb' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 3.
CONCATENATE: 'Mar' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 4.
CONCATENATE: 'Apr' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 5.
CONCATENATE: 'May' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 6.
CONCATENATE: 'Jun' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 7.
CONCATENATE: 'Jul' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 8.
CONCATENATE: 'Agu' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 9.
CONCATENATE: 'Sep' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 10.
CONCATENATE: 'Oct' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 11.
CONCATENATE: 'Nov' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN 12.
CONCATENATE: 'Dec' '-' it_datemy+2(2) INTO it_datemy-datecmy.
WHEN OTHERS.
ENDCASE.
MODIFY it_datemy FROM it_datemy.
ENDLOOP.
LOOP AT it_datemy INTO it_datemy.
WRITE: / it_datemy-datecmy.
ENDLOOP.Kind Regards,
Faisal
2009 Feb 20 3:05 PM
Hi altaf,
each answer for this question is by selecting date in parameters.
if i will select the date in range, then how to get the month and year in between them
e.g., 01.04.2008 - 31.03.2009
it should display :
apr-08 may-08 ................................ dec-08 jan-09 feb-09 ..........
thanks in advance.
2009 Feb 20 5:18 PM
Hi, Debendra Sahoo
First of all can you please let me know that you want the data like i am selecting in my 2nd post?
if yes than follow the steps bellow you will fine the required results.
--> in my 2nd Post where i am selecting data,
--> there is a final Internal Table (it) where budat is available in the format 200901 and you need this as Jan-09 if i am right again than go to next steps
-->No you need to Loop at this final Internal Table (it) and inside this you only Need to use my Code of CASE which i send you in my First Post
--> you only need to Change where i wrote it_datemy-datecmy you will have to Write it-budat
--> and after the CASE statement you just need to modify you Internal Table (it) using the bellow Statement.
modify it index sy-tabix.Hope will Help you to solve out your problem,
Please Reply if any Issue,
Kind Regards,
Faisal
2009 Apr 10 8:47 AM
hi,
my question has been solved.
thanks faisal and all for ur valuable reply.
regards
2009 Feb 18 6:32 AM
Hi,
Loop at itab,
CASE field+2(2) "offset is depending on date of that field formate.
when '01'
concatenate JAN '-' field+4(4) " offset depenting on date formate
-
-
-
When '12'
concatenate DEC '-' field+4(4) " offset depenting on date formate.
Regards,
2009 Feb 18 6:41 AM
Hi,
Just copy and execute it..it give the result exactly what u want...I tried in my sytem.. it is working...
DATA:
D8(20),
MONTH_NAMES LIKE T247 OCCURS 12 WITH HEADER LINE.
PARAMETERS: DATE LIKE SY-DATUM.
D8 = DATE.
WRITE:
/ D8 USING EDIT MASK '==SDATE'.
Regards
Kiran
2009 Feb 19 5:43 AM
Hi,
my issue till not solved.
from the given range of BUDAT, i want to fetch MENGE from MKPF and MSEG and separately display month wise.
thanks.
debendra
2009 Feb 19 6:03 AM
>
> Hi,
>
> my issue till not solved.
> from the given range of BUDAT, i want to fetch MENGE from MKPF and MSEG and separately display month wise.
>
> thanks.
> debendra
Hi,
Test the following Sample Code hope will solve out your problem this time i have tested it is working fine.
TABLES: mkpf, mseg.
SELECT-OPTIONS sobudat FOR mkpf-budat.
DATA: BEGIN OF it OCCURS 10,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
zeile LIKE mseg-zeile,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
END OF it.
DATA: BEGIN OF it_final OCCURS 10,
mblnr LIKE mseg-mblnr,
mjahr LIKE mseg-mjahr,
zeile LIKE mseg-zeile,
budat(6),"LIKE mkpf-budat,
menge LIKE mseg-menge,
END OF it_final.
SELECT mseg~mblnr mseg~mjahr mseg~zeile mkpf~budat SUM( mseg~menge ) AS menge
INTO CORRESPONDING FIELDS OF TABLE it
FROM mseg INNER JOIN mkpf ON ( mseg~mblnr = mkpf~mblnr AND mseg~mjahr = mkpf~mjahr )
WHERE mkpf~budat IN sobudat
GROUP BY mseg~mblnr mseg~mjahr mseg~zeile mkpf~budat.
SORT it by mblnr mjahr zeile budat menge.
LOOP AT it INTO it.
MOVE-CORRESPONDING it TO it_final.
it_final-budat = it-budat+0(6).
COLLECT it_final INTO it_final.
ENDLOOP.Waiting for you reply if any Issue.
Kind Regards,
Faisal
2009 Feb 18 6:48 AM
Hi,
Try with this code.
FORM set_text_date.
DATA: month(9),
year(4),
date(2).
CASE p_frd+4(2).
WHEN '01'.
month = 'January'.
WHEN '02'.
month = 'February'.
WHEN '03'.
month = 'March'.
WHEN '04'.
month = 'April'.
WHEN '05'.
month = 'May'.
WHEN '06'.
month = 'June'.
WHEN '07'.
month = 'July'.
WHEN '08'.
month = 'August'.
WHEN '09'.
month = 'September'.
WHEN '10'.
month = 'October'.
WHEN '11'.
month = 'November'.
WHEN '12'.
month = 'December'.
WHEN OTHERS.
ENDCASE.
WRITE p_frd+0(4) TO year.
WRITE p_frd+6(2) TO date.
CONCATENATE month date ',' year INTO return_date SEPARATED BY space.
CONDENSE return_date.
ENDFORM.
Thanks,
Neelima.
2009 Feb 19 8:26 AM