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 Grid output length not working

Former Member
0 Kudos

I have a problem I have not come across in the user forum before. I added 2 text fields to a structure with 94 fields to display in ALV. I have defaulted the following 3 output length controls to 25(ddic_outputlen, outputlen, intlen) but it is still displaying 80 characters. Can someone help?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

ALso here is the code for the display if maybe something jumps out at you on this.

FORM alv_grid_display .

*"Display List

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ML_LADDERS'

  • i_buffer_active = 'X'

i_callback_program = g_repid

it_fieldcat = gt_fc

i_bypassing_buffer = 'X'

  • i_structure_name = 'ZWM_CARTON_COUNT_ALV_01'

is_layout = gs_layout

i_save = g_save

is_variant = gs_variant

it_events = gt_events[]

is_print = gs_print

IMPORTING

e_exit_caused_by_caller = g_exit_caused_by_caller

es_exit_caused_by_user = gs_exit_caused_by_user

TABLES

t_outtab = ptab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc = 0.

IF g_exit_caused_by_caller = 'X'.

*" Forced Exit by calling program

*" <do_something>.

ELSE.

*" User left list via F3, F12 or F15

IF gs_exit_caused_by_user-back = 'X'. "F3

*" <do_something>.

ELSE.

IF gs_exit_caused_by_user-exit = 'X'. "F15

*" <do_something>.

ELSE.

IF gs_exit_caused_by_user-cancel = 'X'. "F12

*" <do_something>.

ELSE.

*" should not occur!

*" <do_Abnormal_End>.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

*"Fatal error callin ALV

  • MESSAGE AXXX(XY) WITH ...

ENDIF.

*"Form routines

ENDFORM. " ALV_GRID_DISPLAY

20 REPLIES 20

former_member223537
Active Contributor
0 Kudos

Hi,

Welcome to SDN !

The field OUTPUTLEN is correct field.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = c_tabname.

wa_fieldcat-fieldname = 'ROUTE'.

wa_fieldcat-no_out = ' '.

wa_fieldcat-ref_fieldname = 'ROUTE'.

wa_fieldcat-ref_tabname = 'VTTK'.

wa_fieldcat-outputlen = '25'.

append wa_fieldcat to it_fielcat.

Seems there is some problem in appending. Check in debug mode.

Best regards,

Prashant

0 Kudos

I have run in debug trying lots of different ideas, but none seems to be working. All appears as it should. I am believing there is something that is overriding these changes somehow so that they are not taking effect.

former_member223537
Active Contributor
0 Kudos

Hi Lisa,

Could you please paste the code.

Best regards,

Prashant

0 Kudos

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

  • I_INTERNAL_TABNAME =

  • i_buffer_active = 'X'

i_bypassing_buffer = 'X'

i_structure_name = 'ZWM_CARTON_COUNT_ALV_01'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = gt_fc[]

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_fc INTO gs_fc.

CASE gs_fc-fieldname.

WHEN 'RTE_TDLINE'.

gs_fc-seltext_l = 'EDI-Routing Code from EDI'.

gs_fc-seltext_m = 'Route Text from EDI'.

gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.

gs_fc-seltext_s = 'Route Text'.

gs_fc-ddic_outputlen = 25.

gs_fc-outputlen = 25.

gs_fc-intlen = 25.

IF sy-tcode <> 'ZROUTETEXT'.

gs_fc-tech = 'X'.

Else.

gs_fc-no_out = ' '.

ENDIF.

Since the structure has 94 fields, I changed 4 other fileds to no_out = 'X' and blanked this one out but that wasn't it. I also tried forcing it to use the seltext_m but that didn't work.

0 Kudos

Hi Lisa. I don't see you modifing gs_fc anywhere.


LOOP AT gt_fc INTO gs_fc.
CASE gs_fc-fieldname.
WHEN 'RTE_TDLINE'.
gs_fc-seltext_l = 'EDI-Routing Code from EDI'.
gs_fc-seltext_m = 'Route Text from EDI'.
gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.
gs_fc-seltext_s = 'Route Text'.
gs_fc-ddic_outputlen = 25.
gs_fc-outputlen = 25.
gs_fc-intlen = 25.
IF sy-tcode <> 'ZROUTETEXT'.
gs_fc-tech = 'X'.
Else.
gs_fc-no_out = ' '.
ENDIF.

endcase.

<b>modify gt_fc from gs_fc.</b>

endloop.

Regards,

Rich Heilman

0 Kudos

I have gt_fc defined in a Top include also the work area as slis_t_fieldcat_alv. The modify statement is also in the subroutine, I only cut and pasted the specific field info I am having problems with. All else displays fine. Table was previously filled prior to going to this subroutine to pull the fieldcatalog from the DD defined structure which is also being used in other ALV grids.

0 Kudos

Hi lisa,

LOOP AT gt_fc INTO gs_fc.

CASE gs_fc-fieldname.

WHEN 'RTE_TDLINE'.

gs_fc-seltext_l = 'EDI-Routing Code from EDI'.

gs_fc-seltext_m = 'Route Text from EDI'.

gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.

gs_fc-seltext_s = 'Route Text'.

gs_fc-ddic_outputlen = 25.

gs_fc-outputlen = 25.

gs_fc-intlen = 25.

IF sy-tcode <> 'ZROUTETEXT'.

gs_fc-tech = 'X'.

Else.

gs_fc-no_out = ' '.

ENDIF.

append gs_fc to gt_fc.

endloop.

now u can pass gt_fc[] in reuse_alv_fieldcatalog_merge.

hope this will be helpful.

reghards,

keerthi.

0 Kudos

Lisa, can I see the complete code where you are modifing the field catalog.

Regards,

Rich Heilman

0 Kudos

Probably should have done that previously to eliminate confusion. Here it is. Pretty simple.

FORM modify_catalog .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

  • I_INTERNAL_TABNAME =

  • i_buffer_active = 'X'

i_bypassing_buffer = 'X'

i_structure_name = 'ZWM_CARTON_COUNT_ALV_01'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = gt_fc[]

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_fc INTO gs_fc.

CASE gs_fc-fieldname.

WHEN 'LGMNG'.

gs_fc-seltext_l = 'Units'.

gs_fc-seltext_m = 'Units'.

gs_fc-reptext_ddic = 'Units'.

gs_fc-seltext_s = 'Units'.

gs_fc-ref_tabname = ' '.

WHEN 'CTN_COUNT'.

gs_fc-seltext_l = 'Cartons'.

gs_fc-seltext_m = 'Cartons'.

gs_fc-reptext_ddic = 'Cartons'.

gs_fc-seltext_s = 'Cartons'.

gs_fc-ref_tabname = ' '.

WHEN 'ABLAD'.

gs_fc-seltext_l = 'Telephone'.

gs_fc-seltext_m = 'Telephone'.

gs_fc-reptext_ddic = 'Telephone'.

gs_fc-seltext_s = 'Telephone'.

gs_fc-ref_tabname = ' '.

gs_fc-outputlen = 15.

gs_fc-ddic_outputlen = 15.

gs_fc-intlen = 15.

WHEN 'ADDRESS_NAME'.

gs_fc-seltext_l = 'Shipto Address'.

gs_fc-seltext_m = 'Shipto Address'.

gs_fc-reptext_ddic = 'Shipto Address'.

gs_fc-seltext_s = 'Shipto Address'.

gs_fc-ref_tabname = ' '.

WHEN 'ADDRESS'.

gs_fc-seltext_l = 'Final Dest Address'.

gs_fc-seltext_m = 'Final Dest Address'.

gs_fc-reptext_ddic = 'Final Dest Address'.

gs_fc-seltext_s = 'Final Dest Address'.

gs_fc-ref_tabname = ' '.

WHEN 'REF_TDLINE'.

gs_fc-seltext_l = 'EDI-Customer Reference Number'.

gs_fc-seltext_m = 'EDI-Cust Ref Number'.

gs_fc-reptext_ddic = 'EDI-Customer Reference Number'.

gs_fc-seltext_s = 'Cust Ref#'.

gs_fc-ddic_outputlen = 30.

gs_fc-outputlen = 30.

gs_fc-intlen = 30.

IF sy-tcode <> 'ZROUTETEXT'.

gs_fc-tech = 'X'.

Else.

gs_fc-no_out = ' '.

ENDIF.

WHEN 'RTE_TDLINE'.

gs_fc-seltext_l = 'EDI-Routing Code from EDI'.

gs_fc-seltext_m = 'Route Text from EDI'.

gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.

gs_fc-seltext_s = 'Route Text'.

gs_fc-ddic_outputlen = 25.

gs_fc-outputlen = 25.

gs_fc-intlen = 25.

IF sy-tcode <> 'ZROUTETEXT'.

gs_fc-tech = 'X'.

Else.

gs_fc-no_out = ' '.

ENDIF.

WHEN 'ZSEQ'.

IF sy-tcode = 'ZROUTETEXT'.

gs_fc-no_out = 'X'.

ENDIF.

WHEN 'ZSPECIAL'.

IF sy-tcode = 'ZROUTETEXT'.

gs_fc-no_out = 'X'.

ENDIF.

WHEN 'ZSAMPLE'.

IF sy-tcode = 'ZROUTETEXT'.

gs_fc-no_out = 'X'.

ENDIF.

WHEN 'KNFAK'.

IF sy-tcode = 'ZROUTETEXT'.

gs_fc-no_out = 'X'.

ENDIF.

ENDCASE.

MODIFY gt_fc FROM gs_fc.

CLEAR : gs_fc.

ENDLOOP.

ENDFORM. " Modify_catalog

Former Member
0 Kudos

Hi,

check this. its working for me!

clear l_fieldcat.

L_FIELDCAT-TABNAME = 'IT_MARA'.

L_FIELDCAT-FIELDNAME = 'MATNR'.

l_fieldcat-seltext_l = 'material number'.

  • l_fieldcat-ddictxt = 'l'.

l_fieldcat-col_pos = 2.

l_fieldcat-outputlen = 20.

APPEND L_FIELDCAT TO I_FIELDTAB.

CLEAR L_FIELDCAT .

reward if helpful.

regards,

keerthi.

former_member223537
Active Contributor
0 Kudos

Hi,

The flow is wrong :-

1st populate the internal table and then pass it to ALV :-

LOOP AT gt_fc INTO gs_fc.

CASE gs_fc-fieldname.

WHEN 'RTE_TDLINE'.

gs_fc-seltext_l = 'EDI-Routing Code from EDI'.

gs_fc-seltext_m = 'Route Text from EDI'.

gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.

gs_fc-seltext_s = 'Route Text'.

gs_fc-ddic_outputlen = 25.

gs_fc-outputlen = 25.

gs_fc-intlen = 25.

IF sy-tcode <> 'ZROUTETEXT'.

gs_fc-tech = 'X'.

Else.

gs_fc-no_out = ' '.

ENDIF.

append gs_fc to gt_fc.

clear : gs_fc.

endloop.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = g_repid

  • I_INTERNAL_TABNAME =

  • i_buffer_active = 'X'

i_bypassing_buffer = 'X'

i_structure_name = 'ZWM_CARTON_COUNT_ALV_01'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = gt_fc[]

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.

Replace your code with the above code.

Best regards,

Prashant

Message was edited by: Prashant Patil

0 Kudos

Lisa, you flow is correct. The fm 'REUSE_ALV_FIELDCATALOG_MERGE' will give you a field catalog for your structure. You are looping it and changing the output for a specific field, make sure that you are modifing the line after changing the values.

Regards,

Rich Heilman

Former Member
0 Kudos

ALso here is the code for the display if maybe something jumps out at you on this.

FORM alv_grid_display .

*"Display List

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ML_LADDERS'

  • i_buffer_active = 'X'

i_callback_program = g_repid

it_fieldcat = gt_fc

i_bypassing_buffer = 'X'

  • i_structure_name = 'ZWM_CARTON_COUNT_ALV_01'

is_layout = gs_layout

i_save = g_save

is_variant = gs_variant

it_events = gt_events[]

is_print = gs_print

IMPORTING

e_exit_caused_by_caller = g_exit_caused_by_caller

es_exit_caused_by_user = gs_exit_caused_by_user

TABLES

t_outtab = ptab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc = 0.

IF g_exit_caused_by_caller = 'X'.

*" Forced Exit by calling program

*" <do_something>.

ELSE.

*" User left list via F3, F12 or F15

IF gs_exit_caused_by_user-back = 'X'. "F3

*" <do_something>.

ELSE.

IF gs_exit_caused_by_user-exit = 'X'. "F15

*" <do_something>.

ELSE.

IF gs_exit_caused_by_user-cancel = 'X'. "F12

*" <do_something>.

ELSE.

*" should not occur!

*" <do_Abnormal_End>.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

*"Fatal error callin ALV

  • MESSAGE AXXX(XY) WITH ...

ENDIF.

*"Form routines

ENDFORM. " ALV_GRID_DISPLAY

0 Kudos

There are no "Saved" "Default" layouts for the alv grid are there. This could definitely cause the problem.

REgards,

Rich Heilman

0 Kudos

There is a default layout that I added the 2 fields to. I remember at one time stumbling across the fields lengths on the layouts, but don't remember where that is at. I also thought that the fields catalog would override those lengths anyway.

0 Kudos

No, the field cat will not override it. Please delete the default layout and try your program again. I think that you will see that the lengths will be as you set them in the field cat.

Regards

Rich Heilman

0 Kudos

You can then re-create the default layout.

Regards,

Rich Heilman

0 Kudos

Thanks rich! How assisnine was that to be so simple. Can't see past the nose on my face!

0 Kudos

Only reason that I suggested that is because I ran into the same problem before and it drove me nuts for days. Glad that I was able to save you a couple days.

Regards,

Rich Heilman

0 Kudos

Too late. I already drove myself nuts for a couple of days after just getting back from vacation looking for it prior to putting the post out here.