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: 

Local structure - FIELDCAT - REUSE_ALV_FIELDCATALOG_MERGE

vitorssan
Explorer
0 Kudos

Hello guys, good afternoon.
I'm new and trying to adapt a few programs previously made using factory to alv_grid_display and can't find the reason why isn't my fieldcatalog recognized.


I defined a local structure and used an include to declare;
Also defined lt_fieldcat as slis_t_fieldcat_alv
already have a local table named lt_alv, "LIKE TABLE OF" my structure "lt_foralv" filled correctly through the loop

but I get this error: Field catalog not found

I don't know if anyone has experienced similar problem, but everything I found was fixed defining the structure inside the include.

Can someone help? Thank you very much.=======================================================<br>

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv. 
---Content of INCLUDE "zlt_foralv"---
DATA: BEGIN OF lt_foralv OCCURS 0, 
Name LIKE KNA1-MCOD1, 
Surname LIKE KNA1-MCOD2, 
Country LIKE KNA1-LAND1, 
City LIKE KNA1-ORT01, 
Postal_Code LIKE KNA1-PSTLZ.
DATA END OF lt_foralv.

DATA: lt_alv LIKE TABLE OF lt_foralv.
---------------------------
" Then I used gui_upload method to fill a local table, splitted its lines, 
made a loop in its work area, and apped to lt_alv. " lt_alv is correctly filled in debbug (all columns are setted as the structure,
all lines are inserted in lt_alv from csv). ======================================================= PERFORM build_fieldcat. ======================================================= FORM BUILD_FIELDCAT . CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_INTERNAL_TABNAME = 'lt_alv' I_INCLNAME = 'zlt_foralv' * I_STRUCTURE_NAME = I_BYPASSING_BUFFER = 'X' CHANGING CT_FIELDCAT = lt_fieldcat ======================================================= PERFORM alv_grid_display. ======================================================= FORM ALV_GRID_DISPLAY . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING IT_FIELDCAT = lt_fieldcat TABLES T_OUTTAB = lt_alv * EXCEPTIONS * PROGRAM_ERROR = 1 * OTHERS = 2 . ENDFORM. =======================================================
6 REPLIES 6

former_member751591
Participant

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with Community Q&A , as the overview provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your Profile you encourage readers to respond.

Sandra_Rossi
Active Contributor

Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.

Sandra_Rossi
Active Contributor

To avoid the popup with the text "Field catalog not found", while running REUSE_ALV_FIELDCATALOG_MERGE, indicate the names in upper case, and indicate the program name too.

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: BEGIN OF lt_foralv OCCURS 0,
        name        LIKE kna1-mcod1,
        surname     LIKE kna1-mcod2,
        country     LIKE kna1-land1,
        city        LIKE kna1-ort01,
        postal_code LIKE kna1-pstlz,
      END OF lt_foralv.
DATA: lt_alv LIKE TABLE OF lt_foralv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name     = sy-repid " <========= the program which contains I_INCLNAME below
    i_internal_tabname = 'LT_ALV' " <========= UPPER CASE
    i_inclname         = sy-repid " <========= the include which contains LT_ALV
    i_bypassing_buffer = 'X'
  CHANGING
    ct_fieldcat        = lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    it_fieldcat = lt_fieldcat
  TABLES
    t_outtab    = lt_alv
  EXCEPTIONS
    OTHERS      = 2.

0 Kudos

Sandra, thanks for your reply.
I've changed it but still doesn't work.

"Field catalog not found Message no.0K530
Diagnosis The field catalog cannot be determined because the output table structure name was not specified."

I got this error while it's processing build_fieldcat perform, so it's probably related to the structure, right? I know if I prepare a structure it's gonna work, but declaring a local structure should work, shouldn't it?

Perhaps the way I filled the internal table is the problem:

DATA: wa_guiupload TYPE string.
DATA: wa_guiupload2 LIKE LINE OF lt_alv.
LOOP AT lt_guiupload INTO wa_guiupload. SPLIT wa_guiupload AT ';' INTO
wa_guiupload2-Name
wa_guiupload2-Surname
wa_guiupload2-Country
wa_guiupload2-City
wa_guiupload2-Postal_Code. APPEND wa_guiupload2 TO lt_alv. ENDLOOP.

0 Kudos

The parameter I_PROGRAM_NAME was missing in your program. Answer fixed.

vitorssan
Explorer
0 Kudos

Thanks for the tips. I've fixed the post. I think it's correct now.