‎2007 Aug 23 8:08 AM
Hi Abap expert,
i'm using SAP query SQ01 to run the report from MKPF table, this table does not contain any monthly period. the available field that can i use is BUDAT.
how do i extract the month from date using SAP query report? example;
Date - 01.01.2007 (DD.MM.YYYY) extract to 01.2007 (MM.YYYY)
i think we can use 'local field' and just put the coding but i don't know how to use, please help ?
‎2007 Aug 23 8:37 AM
Check the default format for date then follow the code.
generally the default format is (yyyy.mm.dd)
data: month(2) type c .
date type sy-datum.
month = date+4(2).
4(2).
here 4 specifies the no of characters you are skipping. This is your starting point
and 2 is the no of characters you want to select.
so extract the month according to your date format.
‎2007 Aug 23 8:16 AM
Hi,
In SQ02 - Maintaining infoset u can add additional field for u r field groups.
U can add field code to that additional field where u can get month(mm.yyyy) from date field.
Create additional field in extras of the infoset.
Regards,
Sankar
‎2007 Aug 23 8:29 AM
Hi,
Ya for that u have to use local field but for that u sq01 in this goto edit menu and create local field in that. But for that u have to create one temp field at sq02 and then specify that temp field to local field. And make your all calculation in sq02.
Rewards points if it is useful.
‎2007 Aug 23 10:36 AM
Hi need more information, i could not manage to figure out the solution
i have created one additional field in SQ02, that field i created referring to field MKPF-BUDAT.
in SQ01 i also have created one field referring to MKPF-BUDAT, how do i use
in calculation formula and what other thing do i need to enter in complex calculation
condition .... ?
formula ....?
‎2007 Aug 23 11:59 AM
Create posting month as an additional field in the infoset using SQ02. Add some field code to convert BUDAT into month. Then in SQ01, just reference the new field.
‎2007 Aug 27 3:33 AM
Hii
I have created extra field in my info set.
Detail-
Field Name = ZPOSTINGMONTH
Type = C
lnght = 8
Outputlenght = 10
and now i what to extract the month in field MKPF-BUDAT
i have use this statement below, it's seem cannot work
-
data: month(2) type c.
date type sy-datum.
month = date+4(2).
4(2).
-
When i do the checking the system give me this message-
The statement "DATE" is not expected. Correct similar statements are "DATA" and "UPDATE".
null
‎2007 Aug 23 8:37 AM
Check the default format for date then follow the code.
generally the default format is (yyyy.mm.dd)
data: month(2) type c .
date type sy-datum.
month = date+4(2).
4(2).
here 4 specifies the no of characters you are skipping. This is your starting point
and 2 is the no of characters you want to select.
so extract the month according to your date format.