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: 

Date Format in Smart Form

kiran_k8
Active Contributor
0 Kudos
175

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,

1 ACCEPTED SOLUTION

Former Member
0 Kudos
97

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

7 REPLIES 7

Former Member
0 Kudos
98

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

0 Kudos
97

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.

0 Kudos
97

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

0 Kudos
97

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.

0 Kudos
97

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

Former Member
0 Kudos
97
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.

kiran_k8
Active Contributor
0 Kudos
97

problem solved