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

ALV OOPs

Can any body give logic, how to use function module LVC_FIELDCATALOG_MERGE to design fieldcatalog in ALV OOPs.

Regards,

Naseer.

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 Jan 08, 2008 at 06:39 AM

    Hi,

    see this example

    DATA:t_mara TYPE TABLE OF mara.

    DATA:FCAT TYPE LVC_T_FCAT.

    DATA:G_CONTAINER TYPE SCRFNAME VALUE 'TABC',"TABC is *container in screen 101

    GRID TYPE REF TO CL_GUI_ALV_GRID,

    G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

    set screen 101.

    MODULE STATUS_0101 output.

    IF G_CUSTOM_CONTAINER IS INITIAL.

    CREATE OBJECT G_CUSTOM_CONTAINER "CREATING OBJECT FOR CUSTOM CONTAINER

    EXPORTING CONTAINER_NAME = G_CONTAINER.

    CREATE OBJECT GRID "CREATING GRID IN WRKBNCH SCREEN

    EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

    I_STRUCTURE_NAME = 'MARA'

    CHANGING

    CT_FIELDCAT = FCAT[].

    SELECT * from mara into table t_mara.

    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

    CHANGING

    IT_FIELDCATALOG = FCAT[]

    IT_OUTTAB = t_MARA.

    ENDIF.

    ENDMODULE.

    flow logic of screen 101:

    PROCESS BEFORE OUTPUT.

    MODULE STATUS_0101.

    PROCESS AFTER INPUT.

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 08, 2008 at 06:45 AM

    Hi,

    Check this..

    DATA ls_fldcat TYPE lvc_s_fcat.

    DATA lc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.

    *--- Creating container.

    CREATE OBJECT go_container

    EXPORTING

    container_name = lc_custom_control_name

    EXCEPTIONS

    cntl_error = 0

    cntl_system_error = 0

    create_error = 0

    lifetime_error = 0

    lifetime_dynpro_dynpro_link = 0

    OTHERS = 0

    .

    CREATE OBJECT go_grid

    EXPORTING

    i_parent = go_container

    EXCEPTIONS

    error_cntl_create = 0

    error_cntl_init = 0

    error_cntl_link = 0

    error_dp_create = 0

    OTHERS = 0

    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

    i_structure_name = 'VBAK'

    CHANGING

    ct_fieldcat = gt_fldcat

    EXCEPTIONS

    inconsistent_interface = 0

    program_error = 0

    OTHERS = 0.

    *-- Display ALV

    CALL METHOD go_grid->set_table_for_first_display

    CHANGING

    it_outtab = gt_leg_details

    it_fieldcatalog = gt_fldcat

    EXCEPTIONS

    invalid_parameter_combination = 0

    program_error = 0

    too_many_lines = 0

    OTHERS = 0.

    Reward points if useful,

    Regards,

    Niyaz

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 06:50 AM

    Hi,

    Please refer to the link below :

    http://www.sapdevelopment.co.uk/reporting/alv/alv_variousfcat.htm

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 07:02 AM

    Hi Naseer,

    you can try this

    DATA : TABNAME TYPE DD02L-TABNAME,

    fcat type table of LVC_T_FCAT.

    TABNAME = 'ITAB'.

    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

    • I_BUFFER_ACTIVE =

    I_STRUCTURE_NAME = TABNAME

    • I_CLIENT_NEVER_DISPLAY = 'X'

    • I_BYPASSING_BUFFER =

    I_INTERNAL_TABNAME = TABNAME

    CHANGING

    ct_fieldcat = fcat

    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.

    Regards,

    Mohaiyuddin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 07:15 AM

    hi

    good

    check this code.

    data : wa_fieldcat TYPE slis_fieldcat_alv."Work area for fieldcatalog

    i_fieldcat TYPE slis_t_fieldcat_alv..

    &----


    *& 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

    thanks

    mrutyun^

    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.