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

ALV display

Former Member
0 Likes
465

I need to display the GL descirption to 20 characters, when the user drag right side , it should display the entire GL Description.

I am using the following code.

FORM build_fieldcatalog_fx.

DATA: lv_tmp_tabix LIKE sy-tfill.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'ZGLS_FX_ENTRIES'

CHANGING

ct_fieldcat = gt_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 gt_fieldcat INTO gs_fieldcat.

IF gs_fieldcat-fieldname = 'ZZ_BELNR' OR

gs_fieldcat-fieldname = 'GJAHR' OR

gs_fieldcat-fieldname = 'ZZ_USNAM' OR

gs_fieldcat-fieldname = 'BUDAT' OR

gs_fieldcat-fieldname = 'VBUND' OR

gs_fieldcat-fieldname = 'ZZBS_ACCT' OR

gs_fieldcat-fieldname = 'ZZ_PPRCT' OR

gs_fieldcat-fieldname = 'PROJK' OR

gs_fieldcat-fieldname = 'KOSTL'.

gs_fieldcat-no_out = 'X'.

MODIFY gt_fieldcat FROM gs_fieldcat.

ENDIF.

IF gs_fieldcat-fieldname = 'ZZAMT_DC' OR

gs_fieldcat-fieldname = 'ZZ_DMBTR' OR

gs_fieldcat-fieldname = 'ZZAMT_GCC'.

gs_fieldcat-do_sum = 'X'.

MODIFY gt_fieldcat FROM gs_fieldcat.

ENDIF.

IF gs_fieldcat-fieldname = 'ZZ_TXT50'.

<b>gs_fieldcat-outputlen = '20'.</b>

MODIFY gt_fieldcat FROM gs_fieldcat.

ENDIF.

if gs_fieldcat-fieldname = 'ZZ_SGTXT'.

gs_fieldcat-outputlen = '30'.

MODIFY gt_fieldcat FROM gs_fieldcat.

ENDIF.

ENDLOOP.

DESCRIBE TABLE gt_fieldcat LINES sy-tfill.

lv_tmp_tabix = sy-tfill + 1.

MOVE lv_tmp_tabix TO gv_col_pos.

ENDFORM. "build_fieldcatalog

&----


*& Form BUILD_LAYOUT

&----


  • Text : Build the layout

----


FORM build_layout_fx.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

ENDFORM. "BUILD_LAYOUT

Please let me know how to do this.

Thanks,

Pavan.

4 REPLIES 4
Read only

Former Member
0 Likes
420

Looks like you have given the output legnth as 20, is it not working?

Regards,

Ravi

Read only

0 Likes
420

Yes Ravi.

It is not working can u please how to do that.

Thanks,

Pavan.

Read only

Former Member
0 Likes
420

Hi Pavan,

try by commenting this line

gd_layout-colwidth_optimize = 'X'.

regards,

keerthi.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
420

I would have thought that it would have worked as you have it coded. But try to set the initial lenghth as well.

F gs_fieldcat-fieldname = 'ZZ_TXT50'.
 gs_fieldcat-outputlen = '20'.
<b> gs_fieldcat-intlen    = '50'.</b> 
 MODIFY gt_fieldcat FROM gs_fieldcat.
ENDIF.

Regards,

Rich Heilman