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: 

Shortcut to fixed value domain output in ALV

former_member186741
Active Contributor
0 Kudos

I have a fixed value domain, which has two values...A ='Major Project', B= 'Minor Project'.

I wish my alv report to show the long text for fields in this domain. i.e. if a field has a value of A I want the report to show 'Major Project'.

Am I going to have to this the long way (using function module Domain_get_value) or is there any automatic way within ALV to achieve this...similar to defining a screen-painter field as 'listbox'?

Edited by: Neil Woodruff on Dec 18, 2007 8:52 AM

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

I don't think we have any shortest way apart from the way you thought about.

You need to take the field and fill it with the values from the Domain.

Regards,

Naimesh Patel

4 REPLIES 4

former_member386202
Active Contributor
0 Kudos

Hi,

Refer this code

&----


*& Form sub_field_catalogmerge *

&----


  • This form builds the fieldcatalog using REUSE_ALV_FIELDCATALOG_MERGE*

  • function module *

----


FORM sub_field_catalogmerge.

CONSTANTS : lc_long_text(1) TYPE c VALUE 'L'.

*--Pass the Report name

v_repid = sy-repid.

*--Call funtion module to build the field catalog

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'I_FINAL'

i_client_never_display = c_chk

i_inclname = v_repid

CHANGING

ct_fieldcat = i_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT i_fieldcat INTO wa_fieldcat.

CASE wa_fieldcat-fieldname.

WHEN 'FELDV'.

wa_fieldcat-ddictxt = lc_long_text.

wa_fieldcat-seltext_l = text-014.

MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix

TRANSPORTING ddictxt seltext_l.

*--Clear

CLEAR wa_fieldcat.

WHEN 'VERPR'.

wa_fieldcat-ddictxt = lc_long_text.

wa_fieldcat-seltext_l = text-013.

MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix

TRANSPORTING ddictxt seltext_l.

*--Clear

CLEAR wa_fieldcat.

WHEN 'EINME'.

wa_fieldcat-ddictxt = lc_long_text.

wa_fieldcat-seltext_l = text-015.

MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix

TRANSPORTING ddictxt seltext_l.

*--Clear

CLEAR wa_fieldcat.

WHEN 'TVAL'.

wa_fieldcat-ddictxt = lc_long_text.

wa_fieldcat-seltext_l = text-016.

wa_fieldcat-do_sum = 'X'.

MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix

TRANSPORTING ddictxt seltext_l do_sum.

*--Clear

CLEAR wa_fieldcat.

ENDCASE. " CASE lwa_catlog-fieldname

ENDLOOP. "loop at i_fieldcat into wa_fieldcat

ENDFORM. "sub_field_catalogmerge

Regards,

Prashant

0 Kudos

sorry, but this is no good to me....this is only dealing with headings.... I want to format the actual output cells.

naimesh_patel
Active Contributor
0 Kudos

I don't think we have any shortest way apart from the way you thought about.

You need to take the field and fill it with the values from the Domain.

Regards,

Naimesh Patel

0 Kudos

that's not what I want to hear but thanks....I just thought there might be a simple way I didn't know about