2006 Dec 20 5:23 PM
Hi all,
I'm creating an OO ALV grid. I'm using
FUNCTION 'LVC_FIELDCATALOG_MERGE'
I would like to use my own structure, but it only allows me to use
one from the dictionary, otherwise my grid is pt_fieldcat is empty like my grid.
here is a small sample of my code:
********************************************
*DATA DECLARATIONS
DATA: BEGIN OF I_RESULTS OCCURS 0,
PERNR LIKE P0002-PERNR,
VORNA LIKE P0002-VORNA,
NACHN LIKE P0002-NACHN,
END OF I_RESULTS.
DATA: GR_ALVGRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: GC_CUSTOM_CONTROL_NAME TYPE SCRFNAME VALUE 'CC_ALV'.
DATA: GR_CCONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: GT_FIELDCAT TYPE LVC_T_FCAT.
DATA: GS_LAYOUT TYPE LVC_S_LAYO.
********************************************
********************************************
*FORM
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT.
DATA LS_FCAT TYPE LVC_S_FCAT.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'I_RESULTS'
CHANGING
CT_FIELDCAT = PT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
***************************************************
...
It only functions when I make I_STRUCTURE_NAME = pa00002
and DATA: BEGIN OF I_RESULTS OCCURS 0,
INCLUDE STRUCTURE PA0000,
END OF I_RESULTS.
otherwise I see only an empty grid on my screen. When it comes out
of that function, my PT_FIELDCAT[] is empty.
Thanks.
Warren
2006 Dec 20 6:54 PM
Hi,
Check the below code....
data : wa_fcat type lvc_s_fact,
lt_fcat type lvc_t_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 1.
wa_fcat-FIELDNAME = 'VBELN'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-KEY = 'X'.
wa_fcat-outputlen = '20'
wa_fcat-SCRTEXT_M = 'Sales Document
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 2.
wa_fcat-FIELDNAME = 'AUART'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-outputlen = '10'
wa_fcat-SCRTEXT_M = 'Doc Type'.
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
This way you can build your own field catalog. You can use all the parameters in the structure LVC_S_FCAT. Check the Structure LVC_S_FCAT for Field description.
The table LT_FCAT can later be passed to the ALV Display Method.
The function module 'LVC_FIELDCATALOG_MERGE' basically is used to copy the field catalog of the database structure.
Regards,
Vara
Hi,
Check the below code....
data : wa_fcat type lvc_s_fact,
lt_fcat type lvc_t_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 1.
wa_fcat-FIELDNAME = 'VBELN'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-KEY = 'X'.
wa_fcat-outputlen = '20'
wa_fcat-SCRTEXT_M = 'Sales Document
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 2.
wa_fcat-FIELDNAME = 'AUART'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-outputlen = '10'
wa_fcat-SCRTEXT_M = 'Doc Type'.
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
This way you can build your own field catalog. You can use all the parameters in the structure LVC_S_FCAT. Check the Structure LVC_S_FCAT for Field description.
The table LT_FCAT can later be passed to the ALV Display Method.
The function module 'LVC_FIELDCATALOG_MERGE' basically is used to copy the field catalog of the database structure.
Regards,
Vara
2006 Dec 20 5:43 PM
Hi Warren,
You should pass it as Internal table parameter rather than Structure.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'I_RESULTS'
<b> I_INTERNAL_TABNAME = 'I_RESULTS'</b>
Regards,
Vivek
PS: Award points if helpful
2006 Dec 20 6:04 PM
hi .
my understanding is that you can use this FM only for standrad structures and not for cusrom defined structures.
Regard
Arun
2006 Dec 20 6:54 PM
Hi,
Check the below code....
data : wa_fcat type lvc_s_fact,
lt_fcat type lvc_t_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 1.
wa_fcat-FIELDNAME = 'VBELN'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-KEY = 'X'.
wa_fcat-outputlen = '20'
wa_fcat-SCRTEXT_M = 'Sales Document
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
wa_fcat-ROW_POS = 1.
wa_fcat-COL_POS = 2.
wa_fcat-FIELDNAME = 'AUART'.
wa_fcat-TABNAME = 'ITAB'.
wa_fcat-outputlen = '10'
wa_fcat-SCRTEXT_M = 'Doc Type'.
APPEND WA_FCAT TO LT_FCAT.
clear wa_fcat.
This way you can build your own field catalog. You can use all the parameters in the structure LVC_S_FCAT. Check the Structure LVC_S_FCAT for Field description.
The table LT_FCAT can later be passed to the ALV Display Method.
The function module 'LVC_FIELDCATALOG_MERGE' basically is used to copy the field catalog of the database structure.
Regards,
Vara
2006 Dec 20 7:56 PM
thanks for all your help, I just created my own dictionary structure and included that.
Thanks again
Warren
2006 Dec 20 8:12 PM
Warren, curious to check, if my suggestion didn't work? I think you could have used internal table parameter rather than structure name parameter to pass the internal table name.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |