09-29-2014 10:18 AM
Hi,
I'm a new user of ABAP. I'm trying to define an ALV Grid using two functional module ( REUSE_ALV_FIELDCATALOG_MERGE and REUSE_ALV_GRID_DISPLAY ) but the program dump and give this error: "No field catalog available".
This is my code:
REPORT ztest_0003.
*&---------------------------------------------------------------------*
TABLES: zfi_employee1,
zprenotazioni.
*&---------------------------------------------------------------------*
DATA: BEGIN OF ls_output,
sct LIKE zprenotazioni-sct,
wkr LIKE zprenotazioni-wkr,
twkr LIKE zprenotazioni-twkr,
zname LIKE zprenotazioni-zname,
zsurname LIKE zprenotazioni-zsurname,
mans LIKE zfi_employee1-mans,
zpagamento LIKE zprenotazioni-zpagamento,
zprice LIKE zprenotazioni-zprice,
END OF ls_output.
DATA ls_zprenotazioni TYPE zprenotazioni.
DATA lt_output LIKE ls_output OCCURS 0 WITH HEADER LINE.
DATA: va_num TYPE i.
TYPE-POOLS: slis.
DATA: g_repid LIKE sy-repid.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : lt_fieldcat_layout TYPE slis_layout_alv.
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_soc LIKE zfi_employee1-sct VISIBLE LENGTH 3,
p_twkr LIKE zfi_employee1-twkr OBLIGATORY VISIBLE LENGTH 3.
SELECT-OPTIONS s_wkr FOR zfi_employee1-wkr VISIBLE LENGTH 4.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK a1.
SELECTION-SCREEN BEGIN OF BLOCK a2 WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_rad1 RADIOBUTTON GROUP g DEFAULT 'X',
p_rad2 RADIOBUTTON GROUP g,
p_rad3 RADIOBUTTON GROUP g.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_zprice LIKE zprenotazioni-zprice." OBLIGATORY.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK a2.
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN.
IF p_rad1 = 'X' OR p_rad2 = 'X'.
IF p_zprice IS INITIAL.
MESSAGE e000(su) WITH 'Inserire Importo!'.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
REFRESH lt_output.
CLEAR va_num.
*&---------------------------------------------------------------------*
START-OF-SELECTION.
IF p_soc IS NOT INITIAL.
SELECT a~mans
a~sct
a~wkr
a~twkr
b~zname
b~zsurname
b~zpagamento
b~zprice
INTO CORRESPONDING FIELDS OF TABLE lt_output
FROM zfi_employee1 AS a INNER JOIN zprenotazioni AS b
ON a~sct = b~sct
AND a~twkr = b~twkr
AND a~wkr = b~wkr
WHERE a~sct = p_soc AND a~twkr = p_twkr AND a~wkr IN s_wkr.
ELSE.
SELECT a~mans
a~sct
a~wkr
a~twkr
b~zname
b~zsurname
b~zpagamento
b~zprice
INTO CORRESPONDING FIELDS OF TABLE lt_output
FROM zfi_employee1 AS a INNER JOIN zprenotazioni AS b
ON a~twkr = b~twkr
AND a~wkr = b~wkr
WHERE a~twkr = p_twkr AND a~wkr IN s_wkr.
ENDIF.
IF p_rad1 = 'X'.
CLEAR: ls_output.
LOOP AT lt_output INTO ls_output.
IF ls_output-zprice < p_zprice.
ls_output-zprice = ls_output-zprice * 11 / 10.
MODIFY TABLE lt_output FROM ls_output.
CLEAR ls_zprenotazioni.
SELECT SINGLE * FROM zprenotazioni INTO ls_zprenotazioni
WHERE sct = ls_output-sct
AND wkr = ls_output-wkr
AND twkr = ls_output-twkr.
IF sy-subrc = 0.
MOVE ls_output-zprice TO ls_zprenotazioni-zprice.
MODIFY zprenotazioni FROM ls_zprenotazioni.
CLEAR: ls_output,
ls_zprenotazioni.
ENDIF.
ENDIF.
ENDLOOP.
ELSEIF p_rad2 = 'X'.
CLEAR ls_output.
LOOP AT lt_output INTO ls_output.
IF ls_output-zprice > p_zprice.
DELETE FROM zprenotazioni WHERE sct = ls_output-sct
AND wkr = ls_output-wkr
AND twkr = ls_output-twkr.
DELETE TABLE lt_output FROM ls_output.
CLEAR ls_output.
ENDIF.
ENDLOOP.
ELSE.
ENDIF.
CLEAR va_num.
DESCRIBE TABLE lt_output LINES va_num.
*&---------------------------------------------------------------------*
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = g_repid
i_internal_tabname = 'LT_OUTPUT'
I_STRUCTURE_NAME = 'LS_OUTPUT'
i_client_never_display = 'X'
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP-OF-PAGE'
i_structure_name = 'LS_OUTPUT'
is_layout = lt_fieldcat_layout
it_fieldcat = lt_fieldcat[]
TABLES
t_outtab = lt_output
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.
Can anyone let me know what the issue is.
Thanks,
Andrea
09-29-2014 11:03 AM
Hi,
Create the structure in SE11, and use in i_structure_name and data definition.
Best regads.
09-29-2014 10:25 AM
Add parameter I_INCLNAME (same value g_repid) - read FM documentation
Regards,
Raymond
09-29-2014 10:25 AM
Hi,
Put a breakpoint in function module REUSE_ALV_FIELDCATALOG_MERGE and check if lt_fieldcat table is empty.
Best regards.
09-29-2014 10:35 AM
I add the parameter I_INCLNAME but when i proceed with debug i find lt_fieldcat empty (sy-subrc = 4).
Best regards.
09-29-2014 10:49 AM
Now
DATA: BEGIN OF lt_output OCCURS 0,
sct LIKE zprenotazioni-sct,
wkr LIKE zprenotazioni-wkr,
twkr LIKE zprenotazioni-twkr,
zname LIKE zprenotazioni-zname,
zsurname LIKE zprenotazioni-zsurname,
mans LIKE zfi_employee1-mans,
zpagamento LIKE zprenotazioni-zpagamento,
zprice LIKE zprenotazioni-zprice,
END OF ls_output.
Regards,
Raymond
09-29-2014 10:42 AM
Hi,
Try using I_STRUCTURE_NAME = 'LS_OUTPUT' only. Delete i_internal_tabname = 'LT_OUTPUT'.
Best regads.
09-29-2014 10:48 AM
I have always the same error.
Error analysis:
A RAISE statement in the program "CL_GUI_ALV_GRID===============CP" raised the
exception
condition "NO_FIELDCATALOG_AVAILABLE".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
-
Start of run-time error:
Punto di inizio dell'errore di run-time
Programma CL_GUI_ALV_GRID===============CP
Include CL_GUI_ALV_GRID===============CM01J
Riga 14
Tipo modulo (METHOD)
Nome modulo SET_SORT_CRITERIA
Details of program error:
1 method set_sort_criteria.
2
3 *... (1) Trace?
4 if not mr_trace is initial.
5 call method mr_trace->add_trace_item
6 exporting
7 i_trace_item = 'SET_SORT_CRITERIA'
8 ir_variant = m_cl_variant
9 it_data = mt_data
10 it_info = mt_info.
11 endif.
12
13 if m_cl_variant->mt_fieldcatalog is initial.
>>>> raise no_fieldcatalog_available.
15 endif.
16
17 m_cl_variant->mt_sort = it_sort.
18
19 call function 'LVC_SORT_COMPLETE'
20 exporting
21 it_fieldcat = m_cl_variant->mt_fieldcatalog
22 changing
23 ct_sort = m_cl_variant->mt_sort.
24
25 endmethod.
Best regards.
09-29-2014 10:52 AM
Hi,
In function module REUSE_ALV_GRID_DISPLAY delete i_structure_name = 'LS_OUTPUT'.
Best regads.
09-29-2014 10:57 AM
Nothing. Always the same problem. I tryied a lot of solution but the program dump everytime.
09-29-2014 11:03 AM
Hi,
Create the structure in SE11, and use in i_structure_name and data definition.
Best regads.
09-29-2014 11:29 AM
09-29-2014 11:27 AM
Hi,
This code example works fine:
DATA: BEGIN OF lt_material OCCURS 0,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
END OF lt_material.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gv_progname LIKE sy-repid.
gv_progname = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = gv_progname
i_internal_tabname = 'LT_MATERIAL'
i_inclname = gv_progname
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Best regads.