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: 

Bad date format in ALV output

Former Member
0 Kudos
90

Hi All,

I use ALV for output with several fields

All works fine except for the ouput format of one field : WADAT_IST

The ouput format for this is YYYYMMDD (ie 20070120) and when I clic on F1 on this field nothing happened

I have other dates like for instance LFDAT and the ouput format is as I want : DD.MM.YYYYY and the F1 give me the documentation for this field.

I have declared this 2 field in an internal table like this :

TYPES: BEGIN OF ty_itab,

lfdat LIKE likp-lfdat,

wadat_ist LIKE likp-wadat_ist,

......

END OF ty_itab.

And I use the method set_table_for_first_display for output

Any idea to solve my output issue

Thanks

Seb

5 REPLIES 5

Former Member
0 Kudos
49

Use Set date mask Command.

Former Member
0 Kudos
49

Thanks for quick answer but can you be more precise ?

How is the syntax to include it in field catalog ?

Seb

0 Kudos
49

are you populating the fieldcatalog manually..? there you might be doing some mistake..?

Former Member
0 Kudos
49

No,

I use a function :

FORM build_fieldcat USING value(p_it_name) TYPE c

value(p_wa_name) TYPE c

.

DATA: stru_ref TYPE REF TO cl_abap_structdescr,

comp_tab TYPE abap_compdescr_tab,

one_comp TYPE abap_compdescr,

wa_fcat TYPE lvc_s_fcat,

one_name TYPE string,

type_ref TYPE REF TO cl_abap_typedescr,

is_ddic TYPE abap_bool,

lt_ddic TYPE dd_x031l_table,

wa_ddic TYPE x031l.

FIELD-SYMBOLS: <fs_type> TYPE ANY,

<fs_table> TYPE ANY TABLE,

<fs_line> TYPE ANY.

ASSIGN (p_it_name) TO <fs_table>.

ASSIGN (p_wa_name) TO <fs_line>.

stru_ref ?= cl_abap_structdescr=>describe_by_data( <fs_line> ).

comp_tab = stru_ref->components.

LOOP AT comp_tab INTO one_comp.

CLEAR wa_fcat.

wa_fcat-tabname = p_it_name.

wa_fcat-fieldname = one_comp-name.

CONCATENATE p_wa_name '-' one_comp-name INTO one_name.

ASSIGN (one_name) TO <fs_type>.

type_ref ?= cl_abap_typedescr=>describe_by_data( <fs_type> ).

is_ddic = type_ref->is_ddic_type( ).

IF is_ddic = abap_true.

lt_ddic = type_ref->get_ddic_object( ).

LOOP AT lt_ddic INTO wa_ddic.

CLEAR wa_ddic-tabname.

SELECT SINGLE

dd03l~tabname

INTO wa_ddic-tabname

FROM dd03l

WHERE dd03l~fieldname = wa_ddic-fieldname

AND dd03l~tabname NOT LIKE '/%'. " I live in normal namespace

wa_fcat-ref_table = wa_ddic-tabname.

wa_fcat-ref_field = wa_ddic-fieldname.

SELECT SINGLE

dd04t~scrtext_s

dd04t~scrtext_m

dd04t~scrtext_l

INTO (wa_fcat-scrtext_s, wa_fcat-scrtext_m, wa_fcat-scrtext_l)

FROM dd04t

WHERE dd04t~rollname = wa_ddic-fieldname

AND dd04t~ddlanguage = sy-langu.

ENDLOOP.

ELSE.

MOVE one_comp-name TO: wa_fcat-scrtext_s, wa_fcat-scrtext_m, wa_fcat-scrtext_l.

ENDIF.

APPEND wa_fcat TO gt_fieldcat.

ENDLOOP.

LOOP AT gt_fieldcat INTO wa_fcat.

CASE wa_fcat-fieldname.

WHEN 'MATNR'.

wa_fcat-hotspot = 'X'.

WHEN 'VGBEL'.

wa_fcat-hotspot = 'X'.

WHEN 'ZVBELN'.

wa_fcat-hotspot = 'X'.

WHEN 'BELNR'.

wa_fcat-hotspot = 'X'.

ENDCASE.

MODIFY gt_fieldcat FROM wa_fcat INDEX sy-tabix.

CLEAR wa_fcat.

ENDLOOP.

ENDFORM. " BUILD_FIELDCAT

Former Member
0 Kudos
49

Hi,

I have solved my problem

In my function which build the field catalog I added a criteria in the select of the table dd03l

SELECT SINGLE

dd03l~tabname

INTO wa_ddic-tabname

FROM dd03l

WHERE dd03l~fieldname = wa_ddic-fieldname

AND dd03l~tabname NOT LIKE '/%' " I live in normal namespace

AND dd03l~comptype EQ 'E'.

I do the select only on lines type 'Data Element'

Thanks for help

Seb