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: 

REUSE_ALV_FIELDCATALOG_MERGE missing fields

Former Member
0 Kudos

Hi experts, I'm using FM REUSE_ALV_FIELDCATALOG_MERGE in 4.6 C. It works fine, but in 6.0 two fields are missing when displaying the ALV list. The two fields existing in the data dictionary, so I can't understand why is it.

FORM f_prepare_fcat CHANGING p_gt_fieldcat TYPE slis_t_fieldcat_alv.

....

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'I_LIST'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = p_gt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

.....

.

14 REPLIES 14

sarbajitm
Contributor
0 Kudos

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'I_LIST'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = p_gt_fieldcat[] <<< it may resolve the issue

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

Regards

Sarbajit

Former Member
0 Kudos

It doesn't help :'(

Former Member
0 Kudos

just check whether any layout is already saved or anyvarient u r using as a default.

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer code, its working:-


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid  "report id
      i_internal_tabname     = 'IT_FINAL' "<--pass your internal table here
      i_inclname             = sy-repid "<--add this parameter
    CHANGING
      ct_fieldcat            = it_field "<--field catalog table
    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.

If your field catalog table is with header line then pass it_field[] instead of it_field.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

My internal table is with occurs 0 specification.

I already passed the required parameters, but it isn't working correctly.

Former Member
0 Kudos

Please provide ur code.

r u defined that two fields in fieldcat?

0 Kudos

Hi,

Follow this code, its working:-


*INTERNAL TABLE
DATA : BEGIN OF it_final OCCURS 0.
        INCLUDE STRUCTURE tcurc.
DATA : END OF it_final.

*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv WITH HEADER LINE.

START-OF-SELECTION.

*fill internal table
  PERFORM get_data. "<--fill your internal table

*create field catalogs
  PERFORM field_cat. "<-build field catalog

END-OF-SELECTION.

  PERFORM alv_display. "<--display data in alv

*&-----------------------------------------------------------------*
*&      Form  GET_DATA
*&-----------------------------------------------------------------*
*       Get data from database table
*------------------------------------------------------------------*
FORM get_data .
  "select query
ENDFORM.                    " GET_DATA

*&-----------------------------------------------------------------*
*&      Form  FIELD_CAT
*&-----------------------------------------------------------------*
*       Create Field Catalogs
*------------------------------------------------------------------*
FORM field_cat .

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_FINAL'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = it_field[]
    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.                    " FIELD_CAT

*&-----------------------------------------------------------------*
*&      Form  ALV_DISPLAY
*&-----------------------------------------------------------------*
*       Display data in ALV Grid
*------------------------------------------------------------------*
FORM alv_display .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      it_fieldcat                 = it_field[]
    TABLES
      t_outtab                    = it_final[]
    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.                    " ALV_DISPLAY

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

The fieldcat is automatic, and I have all the fields in my defined internal table.

0 Kudos

Hi,

Either you can refer the code in my previous reply or you can also refer this code:-


TYPE-POOLS : slis.

*INTERNAL TABLE
DATA : BEGIN OF it_final OCCURS 0.
        INCLUDE STRUCTURE tcurc.
DATA : END OF it_final.

*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
       wa_field TYPE slis_fieldcat_alv.

*LAYOUT
DATA : wa_layout TYPE slis_layout_alv.

START-OF-SELECTION.

*fill internal table
  PERFORM get_data.

*create field catalogs
  PERFORM field_cat.

END-OF-SELECTION.

  PERFORM alv_display.

*&-----------------------------------------------------------------*
*&      Form  GET_DATA
*&-----------------------------------------------------------------*
*       Get data from database table
*------------------------------------------------------------------*
FORM get_data .

  SELECT * FROM tcurc UP TO 10 ROWS
  INTO CORRESPONDING FIELDS OF TABLE it_final.

ENDFORM.                    " GET_DATA

*&-----------------------------------------------------------------*
*&      Form  FIELD_CAT
*&-----------------------------------------------------------------*
*       Create Field Catalogs
*------------------------------------------------------------------*
FORM field_cat .

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_FINAL'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = it_field
    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.                    " FIELD_CAT

*&-----------------------------------------------------------------*
*&      Form  ALV_DISPLAY
*&-----------------------------------------------------------------*
*       Display data in ALV Grid
*------------------------------------------------------------------*
FORM alv_display .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      it_fieldcat                 = it_field
    TABLES
      t_outtab                    = it_final[]
    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.                    " ALV_DISPLAY

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Hi ,

Try following solution.

You loop thru this p_gt_fieldcat table as -

loop at p_gt_fieldcat into gs_fieldcat.

case gs_fieldcat-fieldname.

when 'Fieldname'. "The field which is not appearing e.g 'GJAHR'

ls_fieldcat-outputlen = ' ' "Set the output length of that field here

ls_fieldcat-no_zero = ' '.

modify p_gt_fieldcat from gs_fieldcat.

Endloop.

Set the output length for both the fields .

ChadRichardson
Participant
0 Kudos

We had a similiar issue and were able to get around it by changing the definition of the fields from TYPE to LIKE or LIKE to TYPE within the structure I_LIST.

Worked for us. Hope this works for you.

Chad

Former Member
0 Kudos

Hi Mrwhite,

*"Table declarations...................................................
TABLES:
  spfli,
   sflight.

*"Type pools...................................................
TYPE-POOLS:
  slis.
*"Selection screen elements............................................
SELECT-OPTIONS:
  s_carrid FOR spfli-carrid,
  s_connid FOR spfli-connid.
*"Data declarations...................................................
DATA:
  BEGIN OF t_spfli OCCURS 0,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    cityfrom LIKE spfli-cityfrom,
    cityto LIKE spfli-cityto,
  END OF t_spfli.
*"Data declarations...................................................
DATA:
  BEGIN OF fs_sflight,
   carrid LIKE sflight-carrid,
   connid LIKE sflight-connid,
   fldate LIKE sflight-fldate,
   seatsmax LIKE sflight-seatsmax,
   seatsocc LIKE sflight-seatsocc,
  END OF fs_sflight.
*"Data declarations...................................................
DATA:
  BEGIN OF t_final OCCURS 0,
     carrid LIKE spfli-carrid,
     connid LIKE spfli-connid,
     cityfrom LIKE spfli-cityfrom,
     cityto LIKE spfli-cityto,
     fldate LIKE sflight-fldate,
     seatsmax LIKE sflight-seatsmax,
     seatsocc LIKE sflight-seatsocc,
END OF t_final.
*"--------------------------------------------------------------------*
* Internal table to hold sflight details                              *
*"--------------------------------------------------------------------*
DATA:
  t_sflight LIKE
    STANDARD TABLE OF fs_sflight.
*"--------------------------------------------------------------------*
* Internal table to hold fieldcatlog                                  *
*"--------------------------------------------------------------------*
DATA:
  t_fieldcat TYPE slis_t_fieldcat_alv,
  l_fieldcat LIKE LINE OF t_fieldcat.
*"Data declarations...................................................
DATA:
  w_layout TYPE slis_layout_alv,
  w_repid LIKE sy-repid.

*"--------------------------------------------------------------------*
*                       START-OF-SELECTION EVENT                      *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
  w_repid = sy-repid.

 SELECT carrid
        connid
        cityfrom
        cityto
 FROM spfli
 INTO TABLE t_spfli
 WHERE carrid IN s_carrid
 AND connid IN s_connid.


 SELECT carrid
        connid
        fldate
        seatsmax
        seatsocc
 FROM sflight
 INTO TABLE t_sflight
 FOR ALL ENTRIES IN t_spfli
 WHERE carrid EQ t_spfli-carrid
 AND connid EQ t_spfli-connid.


  LOOP AT t_sflight INTO fs_sflight.
    READ TABLE t_spfli WITH KEY carrid = fs_sflight-carrid
                                connid = fs_sflight-connid.

    IF sy-subrc EQ 0.

      t_final-carrid = t_spfli-carrid.
      t_final-connid = t_spfli-connid.
      t_final-cityfrom = t_spfli-cityfrom.
      t_final-cityto = t_spfli-cityto.
      t_final-fldate = fs_sflight-fldate.
      t_final-seatsmax = fs_sflight-seatsmax.
      t_final-seatsocc = fs_sflight-seatsocc.
      APPEND t_final.

    ENDIF.                             " IF sy-subrc eq 0
    CLEAR t_final.

  ENDLOOP.                             " LOOP AT t_sflight....



  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
  i_program_name = w_repid
  i_internal_tabname = 'T_FINAL'
  i_inclname = w_repid
  CHANGING
  ct_fieldcat = t_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.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      is_layout     = w_layout
      it_fieldcat   = t_fieldcat
    TABLES
      t_outtab      = t_final
    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.

Regards,

Sravanthi

Mohamed_Mukhtar
Active Contributor
0 Kudos

hi,

See the below code...it may help you out.


TYPE-POOLS : slis.

DATA   : BEGIN OF it_vbak OCCURS 0,
        vbeln LIKE vbak-vbeln,    
        erdat LIKE vbak-erdat,
        ernam LIKE vbak-ernam,
        netwr LIKE vbak-netwr,
        END OF it_vbak,
       it_fieldcat TYPE slis_t_fieldcat_alv,
       wa_fieldcat TYPE slis_fieldcat_alv,
      tbx TYPE sy-tabix.
PARAMETERS : p_kunnr TYPE kna1-kunnr.


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_VBAK'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_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.
SELECT vbeln
       erdat
       ernam
       netwr FROM vbak INTO TABLE it_vbak WHERE kunnr = p_kunnr.

LOOP AT it_fieldcat INTO wa_fieldcat.
  wa_fieldcat-no_zero = 'X'.
  tbx = sy-tabix.
  MODIFY it_fieldcat INDEX tbx  FROM wa_fieldcat  TRANSPORTING no_zero.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    it_fieldcat        = it_fieldcat
  TABLES
    t_outtab           = it_vbak
  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.

Thanks & REgards

Former Member
0 Kudos

Sorry it was a memory issue, I think some buffer was not cleared.