2013 Nov 24 1:40 PM
HI all..
I have seen many post and i try to follow their steps but still i am facing the issue.. please suggest.. i am using
TYPES : BEGIN OF ty_inttab,
plant LIKE aufk-werks,
work_ctr LIKE crhd-arbpl,
age(3) TYPE n,
type LIKE aufk-auart,
order LIKE aufk-aufnr,
vornr LIKE afvc-vornr,
empge LIKE cobrb-aufnr,
rec_text LIKE sy-msgli,
part LIKE afko-stlbez,
desc LIKE makt-maktx,
unit_cost LIKE mbew-stprs,
date LIKE aufk-erdat,
date1 LIKE cobk-budat,
date2 LIKE cobk-budat,
dlast LIKE cobk-budat,
qty LIKE afko-gamng,
deliv LIKE afko-gamng,
remaining LIKE afko-gamng,
ooqty LIKE afvv-mgvrg,
due LIKE coep-wtgbtr,
co_cost LIKE coep-wtgbtr,
del_amt LIKE coep-wtgbtr,
diff LIKE coep-wtgbtr,
prctr LIKE aufk-prctr,
ernam LIKE aufk-ernam,
open TYPE i,
aufpl LIKE afko-aufpl,
objnr LIKE aufk-objnr,
count TYPE i,
select TYPE c,
celcol TYPE slis_t_specialcol_alv,
lincol(4) TYPE c,
END OF ty_inttab.
DATA : it_inttab TYPE TABLE OF ty_inttab,
ws_inttab TYPE ty_inttab.
TYPES : BEGIN OF ty_icoep,
aufnr LIKE aufk-aufnr,
kokrs LIKE coep-kokrs,
belnr LIKE coep-belnr,
buzei LIKE coep-buzei,
wtgbtr LIKE coep-wtgbtr,
budat LIKE cobk-budat,
mbgbtr LIKE coep-mbgbtr,
END OF ty_icoep.
DATA : it_icoep TYPE TABLE OF ty_icoep,
ws_icoep TYPE ty_icoep.
USING 2 FIELDCATALOGES as shown below:
FORM alv_fieldcat_init USING _fieldcat TYPE slis_t_fieldcat_alv
_program
_itabname
_include_name.
CLEAR _fieldcat.
REFRESH _fieldcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' (FIRST)
EXPORTING
i_program_name = _program
i_internal_tabname = _itabname
i_inclname = _include_name
CHANGING
ct_fieldcat = _fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE 'Error generating field catalog' TYPE 'E' .
ENDIF.
ENDFORM. " alv_fieldcat_init
*&---------------------------------------------------------------------*
FORM alv_fieldcat_merge USING _fieldcat TYPE slis_t_fieldcat_alv
_program
_itabname
_include_name.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' (SECOND)
EXPORTING
i_program_name = _program
i_internal_tabname = _itabname
i_inclname = _include_name
CHANGING
ct_fieldcat = _fieldcat[].
ENDFORM. " alv_fieldcat_merge
2 GRID using
FORM display_alv .
repid = sy-repid.
PERFORM alv_variant_initialize USING p_varis g_save_all.
PERFORM alv_basic_layout USING 'X' space 'X' 'X' 'LINCOL'.
gt_layout-coltab_fieldname = 'CELCOL'.
PERFORM alv_print_options USING gt_print.
PERFORM alv_grid_settings USING gt_grid_settings.
PERFORM alv_layout_selector USING 'SELECT'.
PERFORM alv_events USING gt_events[].
IF NOT p_subt IS INITIAL.
PERFORM build_sort USING gt_sort[].
ENDIF.
PERFORM build_comment USING gt_list_top_of_page[].
PERFORM build_fieldcat USING gt_fieldcat[].
gt_status = 'STATDET'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = gt_status
i_callback_user_command = g_user_command
is_layout = gt_layout
is_print = gt_print
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
it_sort = gt_sort[]
i_grid_settings = gt_grid_settings
i_save = g_save_all
is_variant = gx_variant
TABLES
t_outtab = it_inttab.
ENDFORM. " DISPLAY_ALV
FORM display_alv_details .
repid = sy-repid.
PERFORM alv_variant_initialize USING p_varid g_save_all.
PERFORM alv_basic_layout USING 'X' space 'X' 'X' space.
PERFORM alv_print_options USING gt_print.
PERFORM alv_grid_settings USING gt_grid_settings.
PERFORM alv_events USING gt_events[].
PERFORM build_sort USING gt_sort[].
PERFORM build_comment USING gt_list_top_of_page[].
PERFORM build_fieldcat_icoep USING gt_fieldcat[].
gt_status = 'ZSTANDARD'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = gt_status
i_callback_user_command = g_user_command
is_layout = gt_layout
is_print = gt_print
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
it_sort = gt_sort[]
i_grid_settings = gt_grid_settings
i_save = g_save_all
is_variant = gx_variant
TABLES
t_outtab = it_icoep.
ENDFORM. " DISPLAY_ALV_DETAILS
facing a below dump..
Short text
Exception condition "NO_FIELDCATALOG_AVAILABLE" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
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.
2013 Nov 24 2:33 PM
Whenever you are using the Function Module "REUSE_ALV_FIELDCATALOG_MERGE", you need to take care of the internal table you pass to the FM.
1) If you are passing a structure which is in SE11, then there would be no issue.
2) If you are passing an internal table, then make sure you have declared the components using "LIKE".
For instance,
Data : BEGIN of gt_tab occurs 0,
vbeln like vbeln,
posnr like posnr,
end of gt_tab.
Dont use "TYPE" addition.
Hope it helps.
Regards,
Sumit
2013 Nov 24 1:59 PM
2013 Nov 24 2:33 PM
Whenever you are using the Function Module "REUSE_ALV_FIELDCATALOG_MERGE", you need to take care of the internal table you pass to the FM.
1) If you are passing a structure which is in SE11, then there would be no issue.
2) If you are passing an internal table, then make sure you have declared the components using "LIKE".
For instance,
Data : BEGIN of gt_tab occurs 0,
vbeln like vbeln,
posnr like posnr,
end of gt_tab.
Dont use "TYPE" addition.
Hope it helps.
Regards,
Sumit
2013 Nov 25 11:31 AM
The last time I used the Function REUSE_ALV_FIELDCATALOG_MERGE with iternal table I respect all the points in the function description. But there came no fieldcat back. So I debug the function and I decided the function has a prolbem with programs with code columns higher than (I think) the colum 73. The old editor have such a limit. The function can't read such programs and don't get the internal definition for the itab. So I define the structure in the DDIC and the function have no problem to built the fieldcat.
I don't know if the function has still this problem. Maybe it's fixed.
HTH
Myriam
2013 Nov 28 3:52 PM
Its solved.. we have to use Occurs 0 while using Merge, as structure declaration doesnt work with it.
Thanks
2013 Nov 24 3:59 PM
Try Checking the TABNAME field value in the fieldcatalog internal table.
Thanks
SaiKrishna