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

ABAP code help...

Former Member
0 Likes
857

Hi,

I'm changing an old report with write sentences... I would like to "write" date in DATS (type- Date field (YYYYMMDD) stored as char(8)) format.

How Can I change this?

Example:

TYPES: BEGIN OF line,

budat LIKE bkpf-budat,

cpudt END OF line.

END OF line.

WRITE: /(4) itab-cpudt, (Iwold like to have in dats format 20071107, but now it is 11.07.2007)

Thanks + points granted

Saso

1 ACCEPTED SOLUTION
Read only

Maciej_DomagaBa
Contributor
0 Likes
825
WRITE: / itab-cpudt+0(4), itab-cpudt+4(2), itab-cpudt+6(2).

regards

7 REPLIES 7
Read only

suresh_datti
Active Contributor
0 Likes
825

Did you try

WRITE: /(4) itab-cpudt YYYYMMDD.

~Suresh

Read only

0 Likes
825

Yep, I tryed... it is not ok (

Read only

Former Member
0 Likes
825

Hi,

Before writing move the dats to a 8 char field ..

declare v_cpudt(8).

v_cpudt = itab-cpudt.

now write this v_cpudt.

Regards,

Srinivas.

Read only

Former Member
0 Likes
825

Hi check this code...


DATA : d LIKE sy-datum.
DATA : d2 TYPE char8.
d = sy-datum.
d2 = d.
WRITE :/ d2.

Read only

0 Likes
825

you can also use this FM

CONVERSION_EXIT_PDATE_OUTPUT

for converting date format

Read only

Former Member
0 Likes
825

Hi

i didn't get the exact idea abt ur doubt,but i am giving the solution which i understood.

use edit mask option in write statement.it can help u.

Read only

Maciej_DomagaBa
Contributor
0 Likes
826
WRITE: / itab-cpudt+0(4), itab-cpudt+4(2), itab-cpudt+6(2).

regards