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

Former Member
0 Likes
1,167

hi help me in this issue

The actual date format is 2005/05/29

i need the date format as 05/29/2005

CONCATENATE L_ZFBDT5(3) L_ZFBDT8(2) '/' L_ZFBDT+0(4) INTO G_ZFBDT.

by concatenating this way iam getting like this 05/29/20 since g_zfbdt is of type dats 8 in length so is there any field of type 10 for date.

thanks in advance

kiran kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,125

HI,

if you want the User format date,

then use this simple code

Data: Date(10) ,

date1 like sy-daum.

lets say your field is G_ZFBDT.

move G_ZFBDT to date1.

write date1 to date.

write:/ date.

so, here the date will contain the userformat (This code will support all the SAP date formats).

If you want to use your code,

then write in this way ..

CONCATENATE L_ZFBDT5(2) L_ZFBDT8(2) L_ZFBDT+0(4) INTO G_ZFBDT

SEPARETED BY '/'.

field G_ZFBDT should be length 10.

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

15 REPLIES 15
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,125
data:  G_ZFBDT(10) type c.

CONCATENATE L_ZFBDT+5(2) L_ZFBDT+8(2) '/' L_ZFBDT+0(4) INTO G_ZFBDT.



Make it a length of 10 and character field.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,125

why dont u declare a variable of length 10

data : v_date(10).
CONCATENATE L_ZFBDT+5(3) L_ZFBDT+8(2) '/' L_ZFBDT+0(4) INTO v_date.

Read only

Former Member
0 Likes
1,125

declare variables as V1, V2, V3.

V1 = L_ZFBDT+0(4).

V2 = L_ZFBDT+4(2) or 5(2).

V3 = L_ZFBDT+6(2) or 7(2).

Concatenate v2 v3 v1 into G_ZFBDT separated by '/'.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,125

Hi,

make the field g_zfdbt to char of length 10 and it will work fine.

Read only

Former Member
0 Likes
1,125

Hi,

U can do this...

Goto System menu->USer Profile->own data-> and select the date format u want in default values...

Sreedhar

Read only

Former Member
0 Likes
1,126

HI,

if you want the User format date,

then use this simple code

Data: Date(10) ,

date1 like sy-daum.

lets say your field is G_ZFBDT.

move G_ZFBDT to date1.

write date1 to date.

write:/ date.

so, here the date will contain the userformat (This code will support all the SAP date formats).

If you want to use your code,

then write in this way ..

CONCATENATE L_ZFBDT5(2) L_ZFBDT8(2) L_ZFBDT+0(4) INTO G_ZFBDT

SEPARETED BY '/'.

field G_ZFBDT should be length 10.

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

Read only

0 Likes
1,125

hi but i need to add again this g_fbdt to days

like g_netdt = g_fbdt + 30

there it is getting dump as unable to interrupt 05/29/2005 as a number

how to proceed with it.

thanks in advance

kiran kumar

Read only

0 Likes
1,125

Right, you must do your calculation using a date field having the format YYYYMMDD, then you can add days to this value. It must be a date field for the calcuation to work properly. Then you can reformat it as you like.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,125

<b>Hi

Call FM

CONVERSION_EXIT_PDATE_OUTPUT by passing date directly

like

CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

exporting

input = sy-datum

importing

output = out

Regs

Manas Ranjan Panda</b>

Read only

Former Member
0 Likes
1,125

check this.

data : val1(10) type c,
       date like sy-datum.

       date = '20050529'.

       write:/ date.
       concatenate  date+4(2) '/' date+6(2) '/' date+0(4) into val1.
       write:/ val1.

regards,

vijay

Read only

Former Member
0 Likes
1,125
REPORT zex3 .

data: v_date like sy-datum,
      v_datenew like sy-datum.

 v_date = sy-datum.


CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    date            = v_date  "current date
    days            = 05       "days added
    months          = 00
   SIGNUM           = '+'
    years           = 00
 IMPORTING
   CALC_DATE       = v_datenew. " new date


write:/'Current date',  v_date,
         'new date   ', v_datenew.

regards,

VIjy

Read only

Former Member
0 Likes
1,125

we'll keep it this way ..

i will take val1 for display and date2 for the Functional module i/p ..

execute this ..

regards,

vijay

data : val1(10) type c,
       date like sy-datum,
       date2 like sy-datum,
       v_datenew like sy-datum.
       date = '20050529'.

       write:/ date.
       date2 = date.
       concatenate  date+4(2) '/' date+6(2) '/' date+0(4) into val1.
       write:/ val1,
               date2.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    date            = date2
    days            = 05       "days added
    months          = 00
   SIGNUM           = '+'
    years           = 00
 IMPORTING
   CALC_DATE       = v_datenew. " new date


write:/ 'Current date',  date2,
         'new date   ', v_datenew.

lets see if this is working for u kiran .

Read only

Former Member
0 Likes
1,125

REPORT YCHATEST.

DATA : V_DATE(10) VALUE '25/05/2006',

V_DT LIKE SY-DATUM.

REPLACE ALL OCCURRENCES OF '/' IN V_DATE WITH SPACE.

CONDENSE V_DATE.

CONCATENATE V_DATE4(4) V_DATE2(2) V_DATE+0(2) INTO V_DATE.

V_DT = V_DATE.

V_DT = V_DT + 30.

WRITE : V_DT.

Read only

0 Likes
1,125

Hi

when iam adding

g_netdt = g_fbdt + fbit

=29/05/2005 +30

it is giving a wrong value

how to add it .

thanks in advacne

kiran kumar

Read only

0 Likes
1,125

pls check my previous post,

before u add change convert the date format to YYYYMMDD , then add