Skip to Content
author's profile photo Former Member
Former Member

is there any options there in fieldcatalog ?

hi friends..

i am using ALV report using fieldcatalog..

in that i dispaly the field with output length 10..

but i want that output length as optimised one...

ie based on the maximum digitsin the field it get vary..

is there any options there in fieldcatalog ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 06:50 AM

    try this

    fieldcat-fieldname = 'matnr'.

    fieldcat-outputlen = '15'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 06:53 AM

    Hi

    try using this

    round type i, " round in write statement

    or this

    edit_mask type slis_edit_mask,

    vivekanand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 06:56 AM

    Hi see This program .

    REPORT zn_alv_complex .

    TABLES : vbrk .

    TYPE-POOLS : slis .

    CONSTANTS : gc_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

    TYPES : BEGIN OF ty_vbrk ,

    vbeln TYPE vbrk-vbeln ,

    vkorg TYPE vbrk-vkorg,

    vtweg TYPE vbrk-vtweg,

    kunrg TYPE vbrk-kunrg,

    END OF ty_vbrk,

    BEGIN OF ty_vbrp,

    vbeln TYPE vbrp-vbeln,

    posnr TYPE vbrp-posnr,

    matnr TYPE vbrp-matnr,

    netwr TYPE vbrp-netwr,

    END OF ty_vbrp,

    BEGIN OF ty_final,

    vbeln TYPE vbrk-vbeln ,

    posnr TYPE vbrp-posnr,

    matnr TYPE vbrp-matnr,

    netwr TYPE vbrp-netwr,

    vkorg TYPE vbrk-vkorg,

    vtweg TYPE vbrk-vtweg,

    kunrg TYPE vbrk-kunrg,

    END OF ty_final .

    DATA : it_vbrk TYPE TABLE OF ty_vbrk,

    it_vbrp TYPE TABLE OF ty_vbrp,

    it_final TYPE TABLE OF ty_final ,

    wa_vbrk TYPE ty_vbrk,

    wa_vbrp TYPE ty_vbrp,

    wa_final TYPE ty_final ,

    git_event TYPE slis_t_event,

    git_layout TYPE slis_layout_alv,

    git_fieldcat TYPE slis_t_fieldcat_alv,

    gwa_fieldcat TYPE slis_fieldcat_alv.

    SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln,

    s_vkorg FOR vbrk-vkorg,

    s_vtweg FOR vbrk-vtweg.

    START-OF-SELECTION .

    SELECT vbeln vkorg vtweg kunrg

    FROM vbrk

    INTO TABLE it_vbrk

    WHERE vbeln IN s_vbeln

    AND vkorg IN s_vkorg

    AND vtweg IN s_vtweg .

    SELECT vbeln posnr matnr netwr

    FROM vbrp

    INTO TABLE it_vbrp

    FOR ALL ENTRIES IN it_vbrk

    WHERE vbeln = it_vbrk-vbeln .

    LOOP AT it_vbrp INTO wa_vbrp .

    READ TABLE it_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbrp-vbeln .

    wa_final-vbeln = wa_vbrk-vbeln.

    wa_final-posnr = wa_vbrp-posnr.

    wa_final-netwr = wa_vbrp-netwr.

    wa_final-matnr = wa_vbrp-matnr.

    wa_final-vkorg = wa_vbrk-vkorg.

    wa_final-vtweg = wa_vbrk-vkorg.

    wa_final-kunrg = wa_vbrk-kunrg.

    APPEND wa_final TO it_final.

    CLEAR : wa_vbrk , wa_vbrp , wa_final .

    ENDLOOP .

    PERFORM sub_fieldcatalog.

    PERFORM sub_layout_init CHANGING git_layout.

    PERFORM sub_build_event USING git_event[] .

    PERFORM sub_alv_display.

    &----


    *& Form SUB_FIELDCATALOG

    &----


    • text

    ----


    FORM sub_fieldcatalog.

    REFRESH git_fieldcat.

    gwa_fieldcat-col_pos = 0.

    gwa_fieldcat-fieldname = 'VBELN'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 14.

    gwa_fieldcat-seltext_l = 'Billing Doc.' .

    gwa_fieldcat-seltext_m = 'Billing Doc.' .

    gwa_fieldcat-seltext_s = 'Billing Doc.' .

    APPEND gwa_fieldcat TO git_fieldcat .

    gwa_fieldcat-col_pos = 1.

    gwa_fieldcat-fieldname = 'POSNR'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 5.

    gwa_fieldcat-seltext_l = 'Item.' .

    gwa_fieldcat-seltext_m = 'Item' .

    gwa_fieldcat-seltext_s = 'Item' .

    APPEND gwa_fieldcat TO git_fieldcat .

    gwa_fieldcat-col_pos = 2.

    gwa_fieldcat-fieldname = 'VKORG'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 14.

    gwa_fieldcat-seltext_l = 'Sales Org' .

    gwa_fieldcat-seltext_m = 'Sales Org' .

    gwa_fieldcat-seltext_s = 'Sales Org' .

    APPEND gwa_fieldcat TO git_fieldcat .

    gwa_fieldcat-col_pos = 3.

    gwa_fieldcat-fieldname = 'VTWEG'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 14.

    gwa_fieldcat-seltext_l = 'Dist. Ch.' .

    gwa_fieldcat-seltext_m = 'Dist. Ch.' .

    gwa_fieldcat-seltext_s = 'Dist. Ch.' .

    APPEND gwa_fieldcat TO git_fieldcat .

    gwa_fieldcat-col_pos = 4.

    gwa_fieldcat-fieldname = 'MATNR'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 18.

    gwa_fieldcat-seltext_l = 'Material' .

    gwa_fieldcat-seltext_m = 'Material' .

    gwa_fieldcat-seltext_s = 'Material' .

    APPEND gwa_fieldcat TO git_fieldcat .

    gwa_fieldcat-col_pos = 5.

    gwa_fieldcat-fieldname = 'NETWR'.

    gwa_fieldcat-tabname = 'IT_FINAL'.

    gwa_fieldcat-outputlen = 14.

    gwa_fieldcat-seltext_l = 'Price' .

    gwa_fieldcat-seltext_m = 'Price' .

    gwa_fieldcat-seltext_s = 'Price' .

    gwa_fieldcat-do_sum = 'X' .

    APPEND gwa_fieldcat TO git_fieldcat .

    ENDFORM . "SUB_FIELDCATALOG

    &----


    *& Form sub_alv_display

    &----


    • text

    ----


    FORM sub_alv_display .

    DATA : gv_repid TYPE sy-repid .

    gv_repid = sy-repid.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = gv_repid

    i_callback_user_command = 'USER-COMMAND'

    is_layout = git_layout

    it_fieldcat = git_fieldcat

    i_save = 'A'

    it_events = git_event[]

    TABLES

    t_outtab = it_final

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    ENDFORM . "sub_alv_display

    &----


    *& Form

    &----


    • text

    ----


    FORM sub_layout_init CHANGING xyt_layout TYPE slis_layout_alv.

    CLEAR xyt_layout .

    xyt_layout-colwidth_optimize = 'X'.

    xyt_layout-zebra = 'X' .

    ENDFORM. "SUB_LAYOUT_INIT

    &----


    *& Form SUB_BUILD_EVENT

    &----


    • text

    ----


    • -->XT_EVENT text

    ----


    FORM sub_build_event USING xt_event TYPE slis_t_event .

    DATA : lwa_event TYPE slis_alv_event .

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = xt_event

    EXCEPTIONS

    list_type_wrong = 1

    OTHERS = 2.

    READ TABLE xt_event WITH KEY name = slis_ev_top_of_page INTO

    lwa_event.

    lwa_event-form = gc_top_of_page.

    IF sy-subrc EQ 0 .

    MODIFY xt_event FROM lwa_event TRANSPORTING form WHERE name =

    gc_top_of_page.

    ENDIF.

    ENDFORM. "SUB_BUILD_EVENT

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM top_of_page .

    CONSTANTS : lc_s TYPE char01 VALUE 'S'.

    DATA : lv_ecfld(250) TYPE c ,

    lwa_header TYPE slis_listheader ,

    lv_date(10) TYPE c,

    lv_user(10) TYPE c,

    lit_alv_header TYPE slis_t_listheader .

    CLEAR : lv_user , lv_date .

    CLEAR : lwa_header .

    lwa_header-typ = 'S'.

    lv_ecfld = 'User'.

    lwa_header-key = lv_ecfld .

    lwa_header-info = sy-uname.

    APPEND lwa_header TO lit_alv_header .

    CLEAR : lwa_header .

    lwa_header-typ = 'S'.

    lv_ecfld = 'Date'.

    lwa_header-key = lv_ecfld .

    lwa_header-info = sy-datum .

    APPEND lwa_header TO lit_alv_header .

    CLEAR : lwa_header .

    lwa_header-typ = 'S'.

    APPEND lwa_header TO lit_alv_header .

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = lit_alv_header.

    ENDFORM . "TOP_OF_PAGE

    Regards,

    Nihar Swain.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 07:01 AM

    Hi Deva ,

    I dont think there is a filed in the catalog , but there is a field in the layout called CWIDTH_OPT (in LVC_S_LAYO ) there is also a similar field in the the SLIS structure , you can use this to get your desired output.

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2007 at 07:07 AM

    In the layout parameter (IS_LAYOUT in REUSE modules) there is a parameter to optimize column width : <i>colwidth_optimize</i>

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.