How to set data length in ALV?

7.3k views Asked by At

I have "Müşteri siparişinden müşteri siparişine nakil kaydı" text from HTEXT.

HTEXT is a 25-character field you know. But when I use "WRITE" command, it writes "Müşteri siparişinden müşteri siparişine nakil kaydı".

I changed my code for ALV. Then it shows me text as "Müşteri siparişinden müş" in ALV.

"Müşteri siparişinden müş" text has 25 character as you see.

How can I change data length which is shown on screen?

I search the my problem but I couldn't integrated my own code. My code is below.

TABLES : mseg, mkpf, zrapor_mseg_mkpf_alv .

CONSTANTS : gc_alv_item_table TYPE slis_tabname VALUE 'GT_ALV' ,                                    "ALV itab name
            gc_program_name LIKE sy-repid VALUE 'ZRAPOR_MSEG_MKPF_ALV' , "Program name
            gc_structure_name LIKE dd02l-tabname VALUE 'ZRAPOR_MSEG_MKPF_ALV'. "Structure name

DATA : gt_alv TYPE TABLE OF zrapor_mseg_mkpf_alv WITH HEADER LINE .
DATA : gt_flcat TYPE slis_t_fieldcat_alv . "Field Catalog is defined
DATA : gwa_flcat LIKE LINE OF gt_flcat . "Field catalog's work area
DATA : gwa_flcat2 LIKE LINE OF gt_flcat .
DATA : gs_alv LIKE LINE OF gt_alv .

FORM make_field_catalog .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = gc_program_name
          i_internal_tabname     = gc_alv_item_table
          i_structure_name       = gc_structure_name
        CHANGING
          ct_fieldcat            = gt_flcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      DELETE gt_flcat WHERE fieldname = 'SOBKZ'.
ENDFORM.
1

There are 1 answers

0
Nelson Miranda On BEST ANSWER

Mmm, is a very strange behaviour because the ALV grid should show the entire value. Well, as I don't see any more than the code in your post I think you've coded a field catalog (or not) where you specify the length you want to be displayed. Something like this:

data wa_fieldcat like line of gt_flcat. " The fieldcat line to append

wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-ref_fieldname = 'MATNR'.
wa_fieldcat-ref_tabname = 'MARA'.

wa_fieldcat-outputlen = 10. " Specify the length

wa_fieldcat-col_pos = cont.
append wa_fieldcat to gt_flcat.

clear wa_fieldcat.
add 1 to cont.

...

Or maybe the variable you're using in the structure for ALV is 25 length long. Check it or post your code to see what happens.