Application Development and Automation 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: 
Read only

date format

Former Member
0 Likes
930

Hi all,

In my report i have to display date in mmddyyyy format but date is being concatenated from the different parameters entered by the user what i m doing is ..concatenating all the parameters into a variable fdate which is of type string now i want to transfer this fdate into final_date which is of type sy-datum but output is not coming proper ....plz help me out..

Thanks & regards

Ashu SIngh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
906

Hi,

Use this FM : HRGPBS_HESA_DATE_FORMAT. It will convert varriable like fdate to date format.

Regards,

T.D.M.

8 REPLIES 8
Read only

Former Member
0 Likes
906

If you want to display the final output as mmddyyyy, then display the string itself

dont pass it to sy-datum.

Read only

Former Member
0 Likes
906

can you explain with an example ?

Read only

Former Member
0 Likes
906

declare a variable of type STRING or CHAR. Then pass that date to that variable and output it. Let me know if you have any more queries

Read only

Former Member
0 Likes
906

Hi,

You are making a variable fdate that is made from concatenation of parameters then why do you need to pass in another variable final_date which is of type sy-datum. Output that string only na i.e fdate arranged in mmddyyyy manner.

hope this helps.

thanx,

dhanashri.

Read only

Former Member
0 Likes
907

Hi,

Use this FM : HRGPBS_HESA_DATE_FORMAT. It will convert varriable like fdate to date format.

Regards,

T.D.M.

Read only

Former Member
0 Likes
906

Hi Ashu ,

Try this :

select-options :
  s_inprd for sy-datum.

 DATA :
  w_date        like sy-datum,     
  w_year(4)       TYPE n,              " Year
  w_month(2)      TYPE n,              " Month
  w_day(2)        TYPE n,              " Day
  w_condat(10)    TYPE c,              " Date

    w_year = s_inprd-high+0(4).
    w_month = s_inprd-high+4(2).
    w_day = s_inprd-high+6(2).

    CONCATENATE w_day
                w_month
                w_year
           INTO w_condat
   SEPARATED BY '.'.
w_date = w_condat.

This will surely solve the purpose.

Regards,

Swapna.

Read only

Former Member
0 Likes
906

Hi,

DATA :
 w_date    TYPE sy-datum,
*Assuming the date after concatenate is  
 w_string  TYPE string VALUE '20080820'.

w_date = w_string.

WRITE:
  w_date.

Regards

Adil

Read only

Former Member
0 Likes
906

Hi

I didn't get your question..

Just for example i am assuming that you are grabing baseline date which was posted by one user and trying to do vendor posting with another user.

in this scenario you will get into this kind of trouble.

Solution:

read the baseline date(always in format yyyymmdd)

convert it to the present user format.

SELECT SINGLE * INTO l_usr01

FROM usr01

WHERE bname = sy-uname. "YYYYMMDD

CASE l_usr01-datfm.

WHEN '1'.

convert to "dd.mm.yyyy

when '2'.

convert to "mm.dd.yyyy

when '3'.

convert to "mm-dd-yyyy

when '4'.

convert to "mm-dd-yyyy

when '5'.

convert to "yyyy/mm/dd

when '6'.

convert to "yyyy-mm-dd