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

Initial Value display for table filed

Former Member
0 Likes
672

Hi,

I created a ZTable.One of my field is ca_date( date field). Domain for this field is DATS.

In my report i output ca_date and erdat(from vbap).

Now in the output the value for ca_date is ' ', and for erdat is '00/00/0000'.

Can any one tell me why there is a difference even though the domain for both the fields is same?

ca_date is not key field in my table and also the key for initial value is not checked?

Thanks,

Challa.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
577

Hi Challa Bhaskar,

I am not sure whether you used the Build-in type or the data element. It is also good to use the Data element. Please use the data element DATUM for the field CA_DATA.

I just created a table as follows and printed it.

Field DataElement Data type

MANDT MANDT CLNT 3 0 Client

VEBLN VBELN CHAR 10 0 Sales and Distribution Document Number

POSNR POSNR NUMC 6 0 Item number of the SD document

C_DATE DATUM DATS 8 0 Date

It printed correctly.

Sample program

REPORT zkas1 .

DATA : it_zkas LIKE zkas OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF it_tab OCCURS 0,

vbeln TYPE vbeln,

posnr TYPE posnr,

erdat TYPE erdat,

END OF it_tab.

SELECT * FROM zkas

INTO TABLE it_zkas.

SELECT vbeln posnr erdat FROM vbap

INTO TABLE it_tab

WHERE vbeln = '0020012485'

AND posnr = '0010'.

Write : / 'Printed from Ztable'.

LOOP AT it_zkas.

WRITE : / it_zkas-vebln,

it_zkas-posnr,

it_zkas-c_date.

ENDLOOP.

skip 3.

Write : / 'Printed from VBAP'.

LOOP AT it_tab.

WRITE : / it_tab-vbeln,

it_tab-posnr,

it_tab-erdat.

ENDLOOP.

Output

Printed from Ztable

20012485 000010 00/00/0000

Printed from VBAP

20012485 000010 11/09/2004

Hope this Helps.

Regards,

Kasthuri Rangan Srinivasan

2 REPLIES 2
Read only

Former Member
0 Likes
578

Hi Challa Bhaskar,

I am not sure whether you used the Build-in type or the data element. It is also good to use the Data element. Please use the data element DATUM for the field CA_DATA.

I just created a table as follows and printed it.

Field DataElement Data type

MANDT MANDT CLNT 3 0 Client

VEBLN VBELN CHAR 10 0 Sales and Distribution Document Number

POSNR POSNR NUMC 6 0 Item number of the SD document

C_DATE DATUM DATS 8 0 Date

It printed correctly.

Sample program

REPORT zkas1 .

DATA : it_zkas LIKE zkas OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF it_tab OCCURS 0,

vbeln TYPE vbeln,

posnr TYPE posnr,

erdat TYPE erdat,

END OF it_tab.

SELECT * FROM zkas

INTO TABLE it_zkas.

SELECT vbeln posnr erdat FROM vbap

INTO TABLE it_tab

WHERE vbeln = '0020012485'

AND posnr = '0010'.

Write : / 'Printed from Ztable'.

LOOP AT it_zkas.

WRITE : / it_zkas-vebln,

it_zkas-posnr,

it_zkas-c_date.

ENDLOOP.

skip 3.

Write : / 'Printed from VBAP'.

LOOP AT it_tab.

WRITE : / it_tab-vbeln,

it_tab-posnr,

it_tab-erdat.

ENDLOOP.

Output

Printed from Ztable

20012485 000010 00/00/0000

Printed from VBAP

20012485 000010 11/09/2004

Hope this Helps.

Regards,

Kasthuri Rangan Srinivasan

Read only

Former Member
0 Likes
577

hi bhaskar,

may be the date format is incorrect,,

if u want to convert date from dd.mm.yyyy to yyyymmdd at runtime then check this code..

data mydate like sy-datum.

data: year(4) type c,

month(2) type c,

date(2) type c.

year = mydate(4).

month = mydate+4(2).

date = mydate+6(2).