2007 Mar 23 12:54 PM
Hi Folks,
I am fetching the Invoice Date from IS_BIL_INVOICE-HD_GEN-BIL_DATE 03/21/2007.Now I need this to be March 2007.
The other is the date format in &sfsy-date& which should also come in the same way as described earlier.
Can anyone here please help me with this.
Points will be given.
Thanks.
K.Kiran,
2007 Mar 23 12:57 PM
Please check this FM HR_IN_GET_DATE_COMPONENTS.
DATA: L_DAY(2) TYPE C,
L_MONTH(2) TYPE C,
L_YEAR(4) TYPE C,
L_LTEXT TYPE T247-LTX.
DATA: L_DATE TYPE STRING.
CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
EXPORTING
IDATE = SY-DATUM
IMPORTING
DAY = L_DAY
MONTH = L_MONTH
YEAR = L_YEAR
LTEXT = L_LTEXT
EXCEPTIONS
INPUT_DATE_IS_INITIAL = 1
TEXT_FOR_MONTH_NOT_MAINTAINED = 2
OTHERS = 3.
CONCATENATE L_DATE L_DAY L_YEAR INTO L_DATE SEPARATED BY SPACE.
WRITE: L_DATE.
Regards,
Santosh
2007 Mar 23 12:57 PM
Please check this FM HR_IN_GET_DATE_COMPONENTS.
DATA: L_DAY(2) TYPE C,
L_MONTH(2) TYPE C,
L_YEAR(4) TYPE C,
L_LTEXT TYPE T247-LTX.
DATA: L_DATE TYPE STRING.
CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
EXPORTING
IDATE = SY-DATUM
IMPORTING
DAY = L_DAY
MONTH = L_MONTH
YEAR = L_YEAR
LTEXT = L_LTEXT
EXCEPTIONS
INPUT_DATE_IS_INITIAL = 1
TEXT_FOR_MONTH_NOT_MAINTAINED = 2
OTHERS = 3.
CONCATENATE L_DATE L_DAY L_YEAR INTO L_DATE SEPARATED BY SPACE.
WRITE: L_DATE.
Regards,
Santosh
2007 Mar 23 1:20 PM
Santhosh,
Thanks for your reply.when I had executed the code it is just converting the date format 23.03.2007 to 23 2007.
But what I want is March 2007.
Any idea?
Points given.
Thanks,
K.Kiran.
2007 Mar 23 1:34 PM
hi Kiran,
Check out this way
DATA: V_INPUT(8) VALUE '20112006'.
DATA: V_CHAR(25).
data: date type sydatum.
DATA: MONTH_NAMES LIKE T247.
SELECT SINGLE * FROM T247
INTO MONTH_NAMES
WHERE SPRAS = SY-LANGU
AND MNR = V_INPUT+2(2).
CONCATENATE MONTH_NAMES-KTX V_INPUT(2) V_INPUT+4(4)
INTO V_CHAR SEPARATED BY SPACE.
write: / V_CHAR.
Regards,
Santosh
2007 Mar 23 3:26 PM
Santosh,
tables: t247.
data:ltx like t247-ltx.
data:idate(25) type c, vdate like sy-datum.
vdate = sy-datum.
select single ltx from t247 into (ltx) where spras = sy-langu and mnr = vdate+3(3).
write:/ vdate,ltx.
CONCATENATE lTX vdate(4)
INTO idate SEPARATED BY SPACE.
write: / idate.
This code is working perfectly if it is report but not in smart form.
Can we give sfsy-date as per smart form.
K.Kiran.
2007 Mar 23 3:30 PM
You can use the same code in the program lines node and store the value of sfsy-date in a variable and pass it to this code and then instead of sfsy-date display the resultant field.
Regards,
Amit
2007 Mar 23 3:38 PM
parameters : p_date like sy-datum.
data : date like sy-datum.
data:mon_name like t247.
data : final(18) type c.
date = p_date.
select single * FROM T247
INTO mon_name
WHERE SPRAS = SY-LANGU
AND MNR = date+2(2).
concatenate mon_name-ltx date+0(4) into final separated by space.
write:/ final.
what santosh has given is correct thing is u have to use same logic in ur sf ...
see to get the date in the format march 2007 ( month name Year ) you need to have a logic in place . &SF-date& will only give u the std date setting defaulted in user settings.
make a global variable just like final and push the value as
&final& in ur sf .
oh amit is there already
Regards,
Vijay.
2007 Mar 30 4:55 AM