REUSE_ALV_FIELDCATALOG_MERGE

Hello I would like to know what are the exporting and changig parameters are inducating. I would need a detailed description of them. Thanks in advance.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
  I_PROGRAM_NAME               =
  I_INTERNAL_TABNAME           =
  I_STRUCTURE_NAME             =
  I_CLIENT_NEVER_DISPLAY       = 'X'
  I_INCLNAME                   =
  I_BYPASSING_BUFFER           =
  I_BUFFER_ACTIVE              =
  CHANGING
    CT_FIELDCAT                  =
EXCEPTIONS
  INCONSISTENT_INTERFACE       = 1
  PROGRAM_ERROR                = 2
  OTHERS                       = 3

Hi,
Check this documentation
1)     I_PROGRAM_NAME (Export Parameter)
This is the name of the program from which the function module is called or the program having the exit routines.
2)     I_INTERNAL_TABNAME (Export Parameter)
This is the name of the internal table to be displayed.
3)     I_STRUCTURE_NAME (Export Parameter)
If the internal table to be displayed is defined using a Dictionary structure (INCLUDE STRUCTURE xyz or LIKE xyz), then the field catalog can be built by passing the structure name.  The key fields of the structure will form the key fields of the list also.
4)     I_CLIENT_NEVER_DISPLAY (Export Parameter)
This parameter is used to handle the client field in the structure passed. If this parameter is left blank, then client fields (type CLNT) in the structure passed are flagged as technical (=> no screen output) in the field catalog.                 
5)     I_INCLNAME (Export Parameter)
If the output internal table is not declared in the TOP include, then the include in which this table is declared is to be passed here (If the structure is not passed).  If the output table is declared in the same program, pass the program name here.
6)     I_BYPASSING_BUFFER, I_BUFFER_ACTIVE (Export Parameters)
When the program is run for the first time, the fields present in the output table and their positions are stored in a buffer.  So the buffer is taken as reference for the successive executions.  In order to bypass this buffer the above parameter values should be ‘X’ and  ‘ ‘(space) respectively. If these values are not passed to the function module, the changes made in the structure of the internal table MAY NOT be reflected in the output.
7)     CT_FIELDCAT (Import Parameter)
Field catalog (table) containing the descriptions and properties of the output fields.
Regards
Sailaja.

Similar Messages

  • Dont work 'REUSE_ALV_FIELDCATALOG_MERGE' with table type

    Hi Experts ;
    My problem about   'REUSE_ALV_FIELDCATALOG_MERGE' .
    I use intarnal table with Table Type ( with header line ). And 'REUSE_ALV_FIELDCATALOG_MERGE'  is not working . Field catalog is employ. I dont use 'REUSE_ALV_FIELDCATALOG_MERGE' have any problem.

    'REUSE_ALV_FIELDCATALOG_MERGE' expects a flat structure.
    Give the reference of the line type of the table type if you wish to have fieldcatalog as per that..
    Even if you dont use 'REUSE_ALV_FIELDCATALOG_MERGE' you can create your own Fieldcatalog..

  • How can i use reuse_alv_fieldcatalog_merge function module

    I am using below steps for populating the final internal table.How can I use reuse_alv_fieldcatalog_merge function module in the place of declaring all these fields.How canI put title of the report in reuse_alv_fieldcatalog_merge function module.
    FORM BUILD_FIELDCATALOG .
      FIELDCAT-TABNAME   = 'IT_FINAL'.
      FIELDCAT-FIELDNAME = 'KUNNR'.
      FIELDCAT-SELTEXT_M = 'Customer Name'.
      FIELDCAT-JUST      = 'L'.
      FIELDCAT-KEY       = 'X'.
      FIELDCAT-DATATYPE  = 'C'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME   = 'IT_FINAL'.
      FIELDCAT-FIELDNAME = 'VBELN'.
      FIELDCAT-SELTEXT_M = 'Invoice Reference'.
      FIELDCAT-JUST      = 'L'.
      FIELDCAT-KEY       = 'X'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME   = 'IT_FINAL'.
      FIELDCAT-FIELDNAME = 'VKBUR'.
      FIELDCAT-SELTEXT_M = 'Sales Office'.
      FIELDCAT-JUST      = 'L'.
    FIELDCAT-KEY       = 'X'.
      FIELDCAT-DATATYPE  = 'C'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME   = 'IT_FINAL'.
      FIELDCAT-FIELDNAME = 'VKGRP'.
      FIELDCAT-SELTEXT_M = 'Sales Person'.
      FIELDCAT-JUST      = 'L'.
    FIELDCAT-KEY       = 'X'.
      FIELDCAT-DATATYPE  = 'C'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME   = 'IT_FINAL'.
      FIELDCAT-FIELDNAME = 'POSNR'.
      FIELDCAT-SELTEXT_M = 'Item No'.
      FIELDCAT-JUST      = 'L'.
      FIELDCAT-KEY       = 'X'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME   = 'IT_FIANL'.
      FIELDCAT-FIELDNAME = 'ARKTX'.
      FIELDCAT-SELTEXT_M = 'Item Description'.
      FIELDCAT-JUST      = 'L'.
      FIELDCAT-DATATYPE  = 'C'.
      APPEND FIELDCAT TO I_FIELDCAT.
      CLEAR FIELDCAT.

    Hello,
    It is very easy to use reuse_alv_fieldcatalog_merge.
    You try this it will work.
    example
    data:
    DATA : gv_repid        TYPE syrepid VALUE sy-repid .  " Report id
      PERFORM set_field_catalog USING gst_struct CHANGING lst_fieldcat.
    FORM set_field_catalog  USING uv_tab TYPE slis_tabname
                         CHANGING  xt_fieldcatalog TYPE slis_t_fieldcat_alv.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = gv_repid
          i_internal_tabname     = uv_tab
          i_inclname             = gv_repid
        CHANGING
          ct_fieldcat            = xt_fieldcatalog
        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.
    ENDFORM.                    " set_field_catalog_spec

  • Doubt in REUSE_ALV_FIELDCATALOG_MERGE

    Hi All.
    I created ALV report by using function module REUSE_ALV_FIELDCATALOG_MERGE, Some field label is not getting populated in ALV output.
    I checked in table level- Domain, fields and table are all in active mode.
    But while debugging I found that particular Fields not available in field catalog internal table. please let me where I done mistake.
    Please help me to resolve this issue.
    Regards.
    Kalidas.

    Hi,
      REUSE_ALV_FIELDCATALOG_MERGE function never consider those fields which are define using 'TYPE' ref to table field.
    E.g. matnr type mara-matnr
           It will not consider matnr but if you write
           matnr like mara-matnr then it will consider
    Try

  • "Purpose of REUSE_ALV_FIELDCATALOG_MERGE"

    What is the purpose of "REUSE_ALV_FIELDCATALOG_MERGE" function module in ALV Reports?

    Hi,
    Let say I ask you to Prepare a ALV with all fields of the Table MARA and two fields from different Table.
    Then there is no point of you creating the Field Catalogue for 70(approx) fields of MARA and then Two other fields, inspite of this you just create a Zstrucutre for those Two fields and in the FM REUSE_ALV_FIELDCATALOG_MERGE pass this Strucutre and the MARA strucutre and in the resultant Field Catalogue , you will have the complete fields of MARA and these Two Extra fields.
    In this Way you will save yourself from a lot of Redundant Code.
    This function module is used to pass the field catalog to the report output and merge it with the internal output table.
    FUNCTION reuse_alv_fieldcatalog_merge.                                
    *u201D IMPORTING                                                    
    *"   VALUE(I_PROGRAM_NAME) LIKE  SY-REPID OPTIONAL          
    *"  VALUE(I_INTERNAL_TABNAME) TYPE  SLIS_TABNAME OPTIONAL  
    *"  VALUE(I_STRUCTURE_NAME) LIKE  DD02L-TABNAME OPTIONAL   
    *"  VALUE(I_CLIENT_NEVER_DISPLAY) TYPE  SLIS_CHAR_1 default u2018Xu2019
    *"   VALUE(I_INCLNAME) LIKE  TRDIR-NAME OPTIONAL            
    *"   CHANGING                                                     
    *"         VALUE(CT_FIELDCAT) TYPE  SLIS_T_FIELDCAT_ALV           
    *"   EXCEPTIONS                                                   
    *"              INCONSISTENT_INTERFACE                                
    *"              PROGRAM_ERROR                                         
    Import parameters 
    I_PROGRAM_NAME: Program in which the internal output table is declared and populated   
    I_INTERNAL_TABNAME: Internal output table name
    I_STRUCTURE_NAME: Structure name (structure, table, and view)
    I_CLIENT_NEVER_DISPL: Hide client fields default u2018Xu2019
    I_INCLNAME: Data declarations include name
    CHANGING parameter
    CT_FIELDCAT: Field catalog with field descriptions

  • What is the use of REUSE_ALV_FIELDCATALOG_MERGE

    Hi
    in alv's what is the use of REUSE_ALV_FIELDCATALOG_MERGE OTHER THAN ADDING FIELD HEADINGS
    Title Edited by: Alvaro Tejada Galindo on Jan 11, 2008 4:20 PM

    Hi,
    This is the functionality of that FM,
    Supports the creation of the field catalog for the ALV function modules
    based either on a structure or table defined in the ABAP Data
    Dictionary, or a program-internal table.
    The program-internal table must either be in a TOP Include or its
    Include must be specified explicitly in the interface.
    The variant based on a program-internal table should only be used for
    rapid prototyping since the following restrictions apply:
    o   Performance is affected since the code of the table definition must
        always be read and interpreted at runtime.
    o   Dictionary references are only considered if the keywords LIKE or
        INCLUDE STRUCTURE (not TYPE) are used.
    If the field catalog contains more than 90 fields, the first 90 fields
    are output in the list by default whereas the remaining fields are only
    available in the field selection.
    If the field catalog is passed with values, they are merged with the
    'automatically' found information.
    reward points if useful,
    seshu.

  • USE OF FUNCTION MODULE 'REUSE_ALV_FIELDCATALOG_MERGE'

    HI all ,
    Please help me with this function module :
    <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
    How to use this function module ?

    The function REUSE_ALV_FIELDCATALOG_MERGE is used for retrieve a catalog from a table defined in DDICT. Then you can modify it as you want. You can see an example in BALV* programs demos.
    Example:
    in the program J_1AINFG is called as:
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' =20
    EXPORTING =20
    i_internal_tabname =3D TABLEINT
    i_structure_name =3D 'J_1AIFALVHDR' =20
    CHANGING =20
    ct_fieldcat =3D i_fieldcat[]. =20
    where i_structure name is defined in DDICT. Then you can add, delete, or modify masks, lengths, etc. properties of fields in this table.
    In a program if u need to add lot of fields
    LOOP AT i_fieldcat INTO wa_fieldcat. =20
    MOVE wa_fieldcat TO wa_auxfieldcat. =20
    CASE wa_fieldcat-col_pos. =20
    WHEN 27. =20
    CLEAR wa_fieldcat. =20
    wa_fieldcat-fieldname =3D 'COEFIC1'. =20
    wa_fieldcat-tabname =3D g_tabname_header. =20
    wa_fieldcat-col_pos =3D 27. =20
    wa_fieldcat-seltext_s =3D 'Coef.Per.'. =20
    wa_fieldcat-seltext_m =3D 'Coefic.Per=EDodo'. =20
    wa_fieldcat-seltext_l =3D 'Coeficiente del Per=EDodo'. =20
    wa_fieldcat-outputlen =3D 9. =20
    wa_fieldcat-just =3D 'R'. =20
    APPEND wa_fieldcat TO auxcatalogo. =20
    ADD 1 TO wa_auxfieldcat-col_pos. =20
    ENDCASE.
    ENDLOOP.
    i_fieldcat[] =3D auxcatalogo[].

  • In 'REUSE_ALV_FIELDCATALOG_MERGE' what is the role of structurename?

    'REUSE_ALV_FIELDCATALOG_MERGE' in this FM if structure name is mandatory or not?
    i hv created 1 program in that internal table contains 2 fields.
    while structure contain 5 fields
    when output is displayed it shows all fields of structure instead of internal table fields
    please help.

    TYPE-POOLS:SLIS.
    TYPES:BEGIN OF TEITAB,
          CARRID like scarr-CARRID,
          carrname  like scarr-CARRNAME,
          END OF TEITAB.
    DATA: ITAB TYPE TABLE OF TEITAB.
    DATA: WA TYPE TEITAB.
    DATA: FIELDCATALOGU TYPE SLIS_T_FIELDCAT_ALV.
    PERFORM POPULATE_ITAB.
    PERFORM POPULATE_FIELCATALOGU.
    PERFORM POPULATE_ALV.
    *&      Form  POPULATE_ITAB
          POPULATE INTERNAL TABLE.
    -->  p1        text
    <--  p2        text
    form POPULATE_ITAB .
       SELECT CARRID CARRNAME FROM SCARR INTO CORRESPONDING FIELDS OF TABLE ITAB.
    endform.                    " POPULATE_ITAB
    *&      Form  POPULATE_FIELCATALOGU
        CREATING FIELD CATALOGU.
    -->  p1        text
    <--  p2        text
    form POPULATE_FIELCATALOGU .
         CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            I_PROGRAM_NAME               = sy-repid
            I_INTERNAL_TABNAME           = 'ITAB'
            I_STRUCTURE_NAME             = 'SCARR'
           I_CLIENT_NEVER_DISPLAY       = 'X'
           I_INCLNAME                   =
           I_BYPASSING_BUFFER           =
           I_BUFFER_ACTIVE              =
           CHANGING
             ct_fieldcat                  = FIELDCATALOGU
          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.
    endform.                    " POPULATE_FIELCATALOGU
    in this report when i hv to display only two fields carrid and carrname , then why the program ask me for structure name otherwise it sends short dump to me.
    explain!!!

  • What are the disadvantages in reuse_alv_fieldcatalog_merge

    hi
    what are the disadvantages in reuse_alv_fieldcatalog_merge.
    by using this can we create any number of field headings? is there no limit? explain in detail?

    1. reuse_alv_fieldcatalog_merge have many lititations such as you can not change the sequences of tha column. Suppose in table the fields are f1,f2,f3,f4 and f5. But in display i want the sequesce say f3,f4,f2,f1,f5. Using the fm reuse_alv_fieldcatalog_merge is not possible. But you can do it by manually process by passing the sequence in col_pos field of the fieldcatalog.
    2. Similarly you can give the column length as you wish by 'outputlen' paramater of fieldcatalog.
    3.  you can give the column heading of your own by seltext_m, seltext_l, seltext_s paramater of fieldcatalog. 
    4. You can make a field hotspot by hotspot parameter of fieldcatalog.
    5. you can emphasize a field by emphasize parameter of fieldcatalog.
    6. You can display the sum of a field by do_sum parameters of fieldcatalog.
    there are many more functionality which you can not get by FM  reuse_alv_fieldcatalog_merge.
    What you can do is that use both the FM to filled the functionality of the fieldcatalog  what you get autometically from the reuse_alv_fieldcatalog_merge and for the rest of the functinality you can add the functionality by manually append the fieldcalatog. It is call semi autometic fieldcatalog built.

  • Issue in using FM REUSE_ALV_GRID_DISPLAY & FM REUSE_ALV_FIELDCATALOG_MERGE.

    I have added a new filed in structure MERE_OUTTAB_MKVZ. Then I am calling FM REUSE_ALV_FIELDCATALOG_MERGE to display in ALV.  
    Also I have added the data in table lt_fieldcat[] of FM REUSE_ALV_GRID_DISPLAY (even in this new filed) . But when I am calling FM REUSE_ALV_GRID_DISPLAY, but this new field is not getting displayed on UI.
    Can you help me in solving this problem.
    Thanks in Advance
    Ziya

    Hi,
    Check whether you have created the field in the final internal table used in ALV Grid.  If yes, Check for the hidden columns in Default layout of report output.
    Regards
    Vinod

  • Dump when using REUSE_ALV_FIELDCATALOG_MERGE

    Hello friends,
    I am getting the following dump when using REUSE_ALV_FIELDCATALOG_MERGE.
    The occupied line length in the program text must not exceed the width of the internal table.
    The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72
      characters wide. The program line is 75 characters wide.
    Regards,
    K.Sibi

    Hello Ajay ,
    THanks for the reply .
    DATA : BEGIN OF it_data OCCURS 0,
       matnr like RMMG1-MATNR , " Material number
       mbrsh like RMMG1-MBRSH, " Industry sector
       mtart like RMMG1-MTART, " Material type
       meins like MARA-MEINS, " Base unit of measure
       maktx like MAKT-MAKTX, " Material description
       spras like makt-spras , " Language key
       END OF it_data.
    my fm
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = ge_repid
       I_INTERNAL_TABNAME           = 'it_data'
    *   I_STRUCTURE_NAME             = 'it_data'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = ge_repid
    *   I_BYPASSING_BUFFER           = 'X'
    *   I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = alv_fieldcat
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    Regards,
    K.Sibi
    Edited by: sibi k  kanagaraj on Apr 27, 2009 9:21 PM

  • What's  REUSE_ALV_FIELDCATALOG_MERGE ?!

    Hi,
    is there a whole reference about such "REUSE_ALV......" functions ?
    Moreover, i really need something about ALV.
    thanks,

    hi,
    fn module reuse_alv_fieldcatalog_merge is used for providing column headings.
    check below demo for this fn module.
    REPORT  ZSR_ALV_GRID.
    *& declaratin of table                             *
    TABLES : lfa1.
    declaraing selectoptions                           *
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
    declaraing internal table                       *
    DATA : BEGIN OF itab OCCURS 0,
           lifnr LIKE lfa1-lifnr,
           land1 LIKE lfa1-land1,
           name1 LIKE lfa1-name1,
           END OF itab.
    declaraing TYPEPOLL SLIS                       *
    TYPE-POOLS : slis.
    DATA : b_lfa1 TYPE slis_t_fieldcat_alv,
           w_lfa1 TYPE slis_fieldcat_alv.
    START-OF-SELECTION.
    retrieving data from lfa1*
      SELECT lifnr
             land1
             name1
             FROM lfa1
             INTO TABLE itab
             WHERE lifnr IN s_lifnr.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
      I_INTERNAL_TABNAME           =
       I_STRUCTURE_NAME             = 'LFA1'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_INCLNAME                   =
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = B_LFA1
    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.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  = 'lfa1'
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
         it_fieldcat                       = b_lfa1
        TABLES
          t_outtab                          = itab
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    if helpful reward points

  • Field catalog issue using REUSE_ALV_FIELDCATALOG_MERGE

    Hello experts,
    I am using FM REUSE_ALV_FIELDCATALOG_MERGE and the field catalog is created fron the program.
    The field catalog finds the date field from the program but my internal table has been changed to make the date output YYYY/MM/DD.
    When I input the internal table in FM REUSE_ALV_GRID_DISPLAY the output displays the date as DD/MM/YYYY which is not what I want.
    How can I get FM REAUSE_ALV_GRID_DISPLAY to output the date in the format YYYY/MM/DD which is in my input table.
    I have spent a lot of time researching SDN on this but cannot find a similar solution however I did find some examples of changing the field catalogue. Can anybody suggest this is the way to go and if I would use the edit mask field in the field catalog or is there a better way.
    Thanks for any suggestions

    I think you can use a field exit for this.
    This means creating a field element and a domain in the data dictionary, the domain will need to have a conversion exit set by putting an entry in the 'Convers. Routine' field, eg MYDAT.
    You will need to create two function mdules as below:
    eg, CONVERSION_EXIT_MYDAT_OUTPUT
    and CONVERSION_EXIT_MYDAT_INPUT
    Your internal table will now need to refer to the data element you have created instead of the one you are currently using. ALV should automatically pick up the conversion exits and show the ouitput as you desire.
    FUNCTION CONVERSION_EXIT_MYDAT_OUTPUT.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT) TYPE  DATS
    *"  EXPORTING
    *"     REFERENCE(OUTPUT)
    concatenate input(4) '/' input4(2) '/' input6
    into output.
    ENDFUNCTION.
    FUNCTION CONVERSION_EXIT_MYDAT_INPUT.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT)
    *"  EXPORTING
    *"     REFERENCE(OUTPUT) TYPE  DATS
    data l_string type string.
    l_string = input.
    replace all occurrences of '/' in l_string with ' '.
    output = l_string.
    ENDFUNCTION.

  • Using 'REUSE_ALV_FIELDCATALOG_MERGE'

    Hi,
    I am facing problem with 'REUSE_ALV_FIELDCATALOG_MERGE'. when i execute the following code, IO get the message ' Field Catalog Not Found'. What could be the problem?
    *& Report  Y_NORMAL_ALV2
    REPORT  y_normal_alv2.
    TABLES : equi.
    TYPE-POOLS : slis.
    SELECT-OPTIONS : opt1 FOR equi-equnr,
                     opt2 FOR equi-ernam.
    TYPES : BEGIN OF t_equi ,
            equnr LIKE equi-equnr,
            ernam LIKE equi-ernam,
            erdat LIKE equi-erdat,
            brgew LIKE equi-brgew,
            END OF t_equi.
    DATA : i_equi TYPE standard table of t_equi ,
          wa_equi TYPE t_equi,
           lt_fieldcat TYPE slis_t_fieldcat_alv,
           ls_layout TYPE slis_layout_alv,
           i_repid LIKE sy-repid.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM build_layout.
      PERFORM build_fieldcat.
      PERFORM display_data.
    END-OF-SELECTION.
    *&      Form  get-data
          text
    FORM get_data.
      SELECT * FROM  equi INTO  corresponding fields of TABLE i_equi WHERE equnr IN opt1 OR ernam IN opt2.
    ENDFORM.                    "get-data
    *&      Form  build_layout
          text
    FORM build_layout.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-window_titlebar = 'WOW'.
    ENDFORM.                    "build_layout
    *&      Form  build_fieldcat
          text
    FORM build_fieldcat.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name               = i_repid
         i_internal_tabname           = 'I_EQUI'
      I_STRUCTURE_NAME             = 'EQUI'
      I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = i_repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        CHANGING
         ct_fieldcat                  = lt_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.
    DATA : ls_fieldcat TYPE slis_fieldcat_alv.
    CONSTANTS: cons_l_tab     TYPE char8 VALUE  'I_EQUI',
                cons_l_1       TYPE char1 VALUE  '1',
                cons_l_2       TYPE char1 VALUE  '2',
                cons_l_3       TYPE char1 VALUE  '3',
                cons_l_4       TYPE char1 VALUE  '4',
                cons_l_equnr   TYPE char5 VALUE  'EQUNR',
                cons_l_ernam   TYPE char5 VALUE  'ERNAM',
                cons_l_erdat   TYPE char5 VALUE  'ERDAT',
                cons_l_brgew   TYPE char5 VALUE  'BRGEW'.
    REFRESH: lt_fieldcat1.
    ls_fieldcat-tabname = cons_l_tab.
    ls_fieldcat-col_pos = cons_l_1.
    ls_fieldcat-fieldname = cons_l_equnr.
    ls_fieldcat-ref_tabname = 'EQUI'.
    ls_fieldcat-ref_fieldname = 'EQUNR'.
    ls_fieldcat-seltext_m = 'Equipment Number'.
    APPEND ls_fieldcat TO lt_fieldcat1.
    CLEAR ls_fieldcat.
    ls_fieldcat-tabname = cons_l_tab.
    ls_fieldcat-col_pos = cons_l_2.
    ls_fieldcat-fieldname = cons_l_ernam.
    ls_fieldcat-ref_tabname = 'EQUI'.
    ls_fieldcat-ref_fieldname = 'ERNAM'.
    ls_fieldcat-seltext_m = 'Created By'.
    APPEND ls_fieldcat TO lt_fieldcat1.
    CLEAR ls_fieldcat.
    ls_fieldcat-tabname = cons_l_tab.
    ls_fieldcat-col_pos = cons_l_3.
    ls_fieldcat-fieldname = cons_l_erdat.
    ls_fieldcat-ref_tabname = 'EQUI'.
    ls_fieldcat-ref_fieldname = 'ERDAT'.
    ls_fieldcat-seltext_m = 'Creation Date'.
    APPEND ls_fieldcat TO lt_fieldcat1.
    CLEAR ls_fieldcat.
    ls_fieldcat-tabname = cons_l_tab.
    ls_fieldcat-col_pos = cons_l_4.
    ls_fieldcat-fieldname = cons_l_brgew.
    ls_fieldcat-ref_tabname = 'EQUI'.
    ls_fieldcat-ref_fieldname = 'BRGEW'.
    ls_fieldcat-seltext_m = 'Wazan'.
    APPEND ls_fieldcat TO lt_fieldcat1.
    CLEAR ls_fieldcat.
    ENDFORM.                    "build_fieldcat
    *&      Form  display_data
          text
    FORM display_data.
      CHECK NOT i_equi IS INITIAL.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = 'i_repid'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
        is_layout                         = ls_layout
         it_fieldcat                       = lt_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = i_equi
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "display_data

    Hi Sachin,
    There are certainly some isues in the report, but I am not getting any error as 'Field catalog not found'
    I could get the alv grid displayed:
    This is my code: compare and check if  you have missed out somethg.
    TABLES : equi.
    TYPE-POOLS : slis.
    SELECT-OPTIONS : opt1 FOR equi-equnr,
                     opt2 FOR equi-ernam.
    TYPES : BEGIN OF t_equi ,
            equnr LIKE equi-equnr,
            ernam LIKE equi-ernam,
            erdat LIKE equi-erdat,
            brgew LIKE equi-brgew,
            END OF t_equi.
    DATA : i_equi TYPE STANDARD TABLE OF t_equi ,
           wa_equi TYPE t_equi,
           lt_fieldcat TYPE slis_t_fieldcat_alv,
           lt_fieldcat1 TYPE slis_t_fieldcat_alv,
           ls_layout TYPE slis_layout_alv,
           i_repid LIKE sy-repid.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM build_layout.
      PERFORM build_fieldcat.
      PERFORM display_data.
    END-OF-SELECTION.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
      SELECT * FROM equi INTO CORRESPONDING FIELDS OF TABLE i_equi WHERE equnr IN opt1 OR ernam IN opt2.
    ENDFORM.                    " get_data
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    FORM build_layout .
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-window_titlebar = 'WOW'.
    ENDFORM.                    " build_layout
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
      i_program_name = i_repid
      i_internal_tabname = 'I_EQUI'
      i_structure_name = 'EQUI'
      i_client_never_display = 'X'
      i_inclname = i_repid
    *I_BYPASSING_BUFFER =
    *I_BUFFER_ACTIVE =
      CHANGING
      ct_fieldcat = lt_fieldcat
      EXCEPTIONS
      inconsistent_interface = 1
      program_error = 2
      OTHERS = 3
      IF sy-subrc EQ 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      DATA : ls_fieldcat TYPE slis_fieldcat_alv.
      CONSTANTS: cons_l_tab TYPE char8 VALUE 'I_EQUI',
      cons_l_1 TYPE char1 VALUE '1',
      cons_l_2 TYPE char1 VALUE '2',
      cons_l_3 TYPE char1 VALUE '3',
      cons_l_4 TYPE char1 VALUE '4',
      cons_l_equnr TYPE char5 VALUE 'EQUNR',
      cons_l_ernam TYPE char5 VALUE 'ERNAM',
      cons_l_erdat TYPE char5 VALUE 'ERDAT',
      cons_l_brgew TYPE char5 VALUE 'BRGEW'.
      REFRESH: lt_fieldcat1.
      ls_fieldcat-tabname = cons_l_tab.
      ls_fieldcat-col_pos = cons_l_1.
      ls_fieldcat-fieldname = cons_l_equnr.
      ls_fieldcat-ref_tabname = 'EQUI'.
      ls_fieldcat-ref_fieldname = 'EQUNR'.
      ls_fieldcat-seltext_m = 'Equipment Number'.
      APPEND ls_fieldcat TO lt_fieldcat1.
      CLEAR ls_fieldcat.
      ls_fieldcat-tabname = cons_l_tab.
      ls_fieldcat-col_pos = cons_l_2.
      ls_fieldcat-fieldname = cons_l_ernam.
      ls_fieldcat-ref_tabname = 'EQUI'.
      ls_fieldcat-ref_fieldname = 'ERNAM'.
      ls_fieldcat-seltext_m = 'Created By'.
      APPEND ls_fieldcat TO lt_fieldcat1.
      CLEAR ls_fieldcat.
      ls_fieldcat-tabname = cons_l_tab.
      ls_fieldcat-col_pos = cons_l_3.
      ls_fieldcat-fieldname = cons_l_erdat.
      ls_fieldcat-ref_tabname = 'EQUI'.
      ls_fieldcat-ref_fieldname = 'ERDAT'.
      ls_fieldcat-seltext_m = 'Creation Date'.
      APPEND ls_fieldcat TO lt_fieldcat1.
      CLEAR ls_fieldcat.
      ls_fieldcat-tabname = cons_l_tab.
      ls_fieldcat-col_pos = cons_l_4.
      ls_fieldcat-fieldname = cons_l_brgew.
      ls_fieldcat-ref_tabname = 'EQUI'.
      ls_fieldcat-ref_fieldname = 'BRGEW'.
      ls_fieldcat-seltext_m = 'Wazan'.
      APPEND ls_fieldcat TO lt_fieldcat1.
      CLEAR ls_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data.
      CHECK NOT i_equi IS INITIAL.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      i_interface_check = ' '
      i_bypassing_buffer = ' '
      i_buffer_active = ' '
      i_callback_program = 'i_repid'
    i_callback_pf_status_set = ' '
    i_callback_user_command = ' '
    i_callback_top_of_page = ' '
    i_callback_html_top_of_page = ' '
    i_callback_html_end_of_list = ' '
    i_structure_name =
    **I_BACKGROUND_ID = ' '
    i_grid_title =
    *I_GRID_SETTINGS =
      is_layout = ls_layout
      it_fieldcat = lt_fieldcat
    it_excluding =
    it_special_groups =
    it_sort =
    it_filter =
    is_sel_hide =
      i_default = 'X'
      i_save = 'A'
    is_variant =
    it_events =
    it_event_exit =
    is_print =
    is_reprep_id =
      i_screen_start_column = 0
      i_screen_start_line = 0
      i_screen_end_column = 0
      i_screen_end_line = 0
      i_html_height_top = 0
      i_html_height_end = 0
    it_alv_graphics =
    it_hyperlink =
    it_add_fieldcat =
    it_except_qinfo =
    ir_salv_fullscreen_adapter =
    importing
    e_exit_caused_by_caller =
    es_exit_caused_by_user =
      tables
      t_outtab = i_equi
      EXCEPTIONS
      program_error = 1
      OTHERS = 2
    IF sy-subrc eq 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.                    " display_data

  • Change in column name in REUSE_ALV_FIELDCATALOG_MERGE

    Hi Everyone,
    In my requirement  I need to change the column name in the internal table t_fieldcat. But where can i find the way to change the names of column in REUSE_ALV_FIELDCATALOG_MERGE
       CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
           i_structure_name       = 'YV_TAB'
         CHANGING
           ct_fieldcat            = t_fieldcat
         EXCEPTIONS
           inconsistent_interface = 1
           program_error          = 2
           OTHERS                 = 3.

    Hi,
    you can do it in different ways, please try
    1) Build field catelog
    CLEAR wa_fieldcat.
      wa_fieldcat-tabname     = tab_name
      wa_fieldcat-fieldname   = 'Field Name'
      wa_fieldcat-seltext_l   = 'Field Text'.
      wa_fieldcat-outputlen   = 15.
      APPEND wa_fieldcat TO it_fieldcat.
    2) Create a structure with required fileds and create new data element refer with standard domain. Then you can give your require text in the Field Label tab. pass this structure to the FM.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'internal_tab_name'
    i_structure_name       = 'structure_name'
    i_inclname             = sy-repid
    CHANGING
    ct_fieldcat            = it_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2
    OTHERS                 = 3.
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • Unable to Populate fieldcat using FM  REUSE_ALV_FIELDCATALOG_MERGE

    Hi ,
    I am using the function Module REUSE_ALV_FIELDCATALOG_MERGE for Populating the fieldcatlog for my alv report.code as follows.Please help me out...
    TABLES: EKKO,EKPO.
    TYPE-POOLS:SLIS.
    SELECTION-SCREEN BEGIN OF SCREEN 500 TITLE TEXT-001.
    SELECT-OPTIONS: SO_EKORG FOR EKKO-EKORG,
    SELECTION-SCREEN END OF SCREEN 500.
    TYPES: BEGIN OF TY_EKKO,
            EBELN TYPE EKKO-EBELN,
            EKORG TYPE EKKO-EBELN,
            AEDAT TYPE EKKO-AEDAT,
            LIFNR TYPE EKKO-LIFNR,
           END OF TY_EKKO.
    DATA: IT_EKKO TYPE TABLE OF TY_EKKO,
          WA_EKKO TYPE TY_EKKO.
    DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: REPID LIKE SY-REPID VALUE 'ZSAP1_PRAC'.
    INITIALIZATION.
    CALL SCREEN 500 STARTING AT 10 10 .
    START-OF-SELECTION.
    SELECT EBELN
           EKORG
           AEDAT
           LIFNR
           FROM EKKO
           INTO TABLE IT_EKKO
           WHERE EBELN IN SO_EBELN AND
                 EKORG IN SO_EKORG AND
                 AEDAT IN SO_AEDAT.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = REPID
       I_INTERNAL_TABNAME           = 'IT_EKKO'
       I_INCLNAME                   = REPID
      CHANGING
        CT_FIELDCAT                  = IT_FCAT.
    Moderator message - please use code tags and remove commented out lines.
    Edited by: Rob Burbank on Jun 22, 2009 4:02 PM

    Hi Kiran,
    TYPE reference is not worked here to generate fieldcatalog for a table. Always use LIKE statement how I used. Check the changed program of yours. It works fine.
    <pre>REPORT ztest_notepad.
    TABLES: ekko,ekpo.
    TYPE-POOLS:slis.
    *SELECTION-SCREEN BEGIN OF SCREEN 500 TITLE text-001.
    *SELECT-OPTIONS: so_ekorg FOR ekko-ekorg.
    *selection-screen end of screen 500.
    *TYPES: BEGIN OF ty_ekko,
           ebeln TYPE ekko-ebeln,
           ekorg TYPE ekko-ebeln,
           aedat TYPE ekko-aedat,
           lifnr TYPE ekko-lifnr,
          END OF ty_ekko.
    *DATA: it_ekko TYPE TABLE OF ty_ekko,
         wa_ekko TYPE ty_ekko.
    *<font color="red"> TYPEing does not work to generate Fieldcatalog.
    *Always LIKE statement has to be used.</font>
    DATA: BEGIN OF it_ekko OCCURS 0,
            ebeln LIKE ekko-ebeln,
            ekorg LIKE ekko-ebeln,
            aedat LIKE ekko-aedat,
            lifnr LIKE ekko-lifnr,
           END OF it_ekko.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
          wa_fcat TYPE slis_fieldcat_alv.
    *DATA: repid LIKE sy-repid VALUE 'ZSAP1_PRAC'.
    DATA: repid LIKE sy-repid VALUE sy-repid.
    *INITIALIZATION.
    CALL SCREEN 500 STARTING AT 10 10 .
    START-OF-SELECTION.
    *SELECT EBELN
          EKORG
          AEDAT
          LIFNR
          FROM EKKO
          INTO TABLE IT_EKKO
          WHERE EBELN IN SO_EBELN AND
                EKORG IN SO_EKORG AND
                AEDAT IN SO_AEDAT.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = repid
          i_internal_tabname = 'IT_EKKO'
          i_inclname         = repid
          i_bypassing_buffer = 'X'
        CHANGING
          ct_fieldcat        = it_fcat.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK              = ' '
        I_BYPASSING_BUFFER             =
        I_BUFFER_ACTIVE                = ' '
         i_callback_program             = repid
        I_CALLBACK_PF_STATUS_SET       = ' '
        I_CALLBACK_USER_COMMAND        = ' '
        I_STRUCTURE_NAME               =
        IS_LAYOUT                      =
         it_fieldcat                    = it_fcat
        IT_EXCLUDING                   =
        IT_SPECIAL_GROUPS              =
        IT_SORT                        =
        IT_FILTER                      =
        IS_SEL_HIDE                    =
        I_DEFAULT                      = 'X'
        I_SAVE                         = ' '
        IS_VARIANT                     =
        IT_EVENTS                      =
        IT_EVENT_EXIT                  =
        IS_PRINT                       =
        IS_REPREP_ID                   =
        I_SCREEN_START_COLUMN          = 0
        I_SCREEN_START_LINE            = 0
        I_SCREEN_END_COLUMN            = 0
        I_SCREEN_END_LINE              = 0
        IR_SALV_LIST_ADAPTER           =
        IT_EXCEPT_QINFO                =
        I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER        =
        ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = it_ekko
      EXCEPTIONS
        PROGRAM_ERROR                  = 1
        OTHERS                         = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.</pre>
    Let me know if u have any problem.
    Thanks
    Venkat.O

Maybe you are looking for