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: 

ALV output date an time format

former_member1284402
Participant
0 Kudos
917

hi all,

i am using NAST-ERDAT and NAST-ERUHR and selecting data from NAST table but problem is that in ALV output it is showing date '20100203' and time '020312' format and if i call function module CONVERT_DATE_TO_external or FM CONVERT_DATE_FORMAT then it only convert it to '03.02.20' while i need '03.02.2010'.

can anyone please help me for both date and time.

i defined ALV output length 10.

i used this :

FORM BUILD_FIELDCAT1 .

ADD 1 TO col_pos.

fieldcat_ln-ref_tabname = gc_gt_final.

fieldcat_ln-fieldname = gc_date. "ERDAT

fieldcat_ln-seltext_m = text-003.

fieldcat_ln-outputlen = '10'.

fieldcat_ln-key = space.

fieldcat_ln-no_zero = space.

fieldcat_ln-do_sum = space.

fieldcat_ln-col_pos = col_pos.

fieldcat_ln-no_out = space.

fieldcat_ln-qfieldname = space.

fieldcat_ln-hotspot = space.

APPEND fieldcat_ln TO fieldcat.

ENDFORM. " BUILD_FIELDCAT1

regards .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
183

Hello,

When you define the fieldcatalog try using the components ref_fieldname as ERDAT for date field and ERUHR for time and ref_tabname as NAST.

Regards,

Sachin

4 REPLIES 4

Former Member
0 Kudos
184

Hello,

When you define the fieldcatalog try using the components ref_fieldname as ERDAT for date field and ERUHR for time and ref_tabname as NAST.

Regards,

Sachin

Former Member
0 Kudos
183

Hi

Instead of using Function module, you can use Concatenate to get the date in whichever format u want.

eg. date 20100203 is converted to 03.02.2010 by

data: v_date type dats default '20100203',
          v_changed(10) type c.            

concatenate v_date+6(2) '.' v_date+4(2) '.' v_date0+(4) into v_changed.

write: v_changed.

Former Member
0 Kudos
183

Hi,

I think it will be better if you use offset method to convert date into desired format. This method will not affect your date displayed irrespective of the format in different clients.

Thanks,

Archana

praveen_hannu
Contributor
0 Kudos
183

Hi

Pass both values in the fieldcatalog ref_tabname and ref_fieldname, both should be exists in the data dictonary, do not pass the internal tables which we created in the program.

Even if you comment the ref_tabname, i hope it will work.

Thanks

Praveen