‎2007 Mar 01 9:53 AM
Hi,
When I call method SET_TABLE_FOR_FIRST_DISPLAY of ALV I get runtime error 'UC_OBJECTS_NOT_CHARLIKE'.
Actually i have set in the fieldcatalog the field 'CHK' of internal table as checkbox.
wa_fcat-fieldname = 'CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
Field CHK is of type c.
when i dont set the field as checkbox, I stop getting the error.
Please find a solution.
regards,
auro
‎2007 Mar 01 9:57 AM
GIve the field name as 'ITAB_CHK' (If ITAB is your internal table:
<b>wa_fcat-fieldname = 'ITAB-CHK' .</b>
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
Regards,
Ravi
‎2007 Mar 01 10:12 AM
This is not helping.
Actually it gives a runtime error when the table is filled and value of field CHK is either '' or 'X'.
when i DONT specify the field CHK as checkbox in the field catalog then i dont get the error but by specifying it i am getting the error.
the details of the error log is:
Program SAPLSLVC
include LSLVCF05
Form DATA_TABLE_GET
*... CHECKBOX/RADIOBUTTON
if <ls_fieldcat>-checkbox = 'X'.
if <g_field> ca '01'.----
error occured here
add alv_style_enabled to gs_lvc_data-style.
else.
add alv_style_disabled to gs_lvc_data-style.
endif.
if <g_field> = 'X' or <g_field> = '1'.
add alv_style_checkbox_checked to gs_lvc_data-style.
elseif <g_field> = space or <g_field> = '0'.
add alv_style_checkbox_not_checked to gs_lvc_data-style.
elseif <g_field> = '-'.
add alv_style_checkbox_no to gs_lvc_data-style.
endif.
elseif <ls_fieldcat>-checkbox = 'R'.
if <g_field> ca '01'.
add alv_style_enabled to gs_lvc_data-style.
else.
add alv_style_disabled to gs_lvc_data-style.
endif.
if <g_field> = 'X' or <g_field> = '1'.
add alv_style_radio_checked to gs_lvc_data-style.
‎2007 Mar 01 10:14 AM
can you show your complete coding, or atleast the data declaration part?
Regards,
Ravi
‎2007 Mar 01 10:20 AM
Relevant parts of code are:
Data Declaration:
types: begin of tt_revenue_det,
chk type c,
budat like zefit0006-zefibudat,
racct_txt like skat-txt50,
amount like zefit0006-zefihsl,
pbar_txt like tgsbt-gtext,
sgtxt like zefit0006-zefisgtxt,
costcentertxt like cskt-ktext,
bar_txt like skat-txt50,
doctype like zefit0006-zefiblart,
ch_flag type c,
end of tt_revenue_det,
data: gt_revenue_det type table of tt_revenue_det.
FIELD CATALOG
&----
*& Form set_fieldcatalog_rev_det
&----
text
----
-->P_LT_FIELDCATALOG text
----
form set_fieldcatalog_rev_det using p_lt_fieldcatalog type lvc_t_fcat.
data:wa_fcat type lvc_s_fcat.
wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date' .
wa_fcat-seltext = 'Posting Date' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'RACCT_TXT' .
wa_fcat-coltext = 'Account Item Text' .
wa_fcat-seltext = 'Account Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'AMOUNT' .
wa_fcat-coltext = 'Amount' .
wa_fcat-seltext = 'Amount' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'PBAR_TXT' .
wa_fcat-coltext = 'Partner Business Area' .
wa_fcat-seltext = 'Partner Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'SGTXT' .
wa_fcat-coltext = 'Item Text' .
wa_fcat-seltext = 'Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'COSTCENTERTXT' .
wa_fcat-coltext = 'Cost Center' .
wa_fcat-seltext = 'Cost Center' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BAR_TXT' .
wa_fcat-coltext = 'Business Area' .
wa_fcat-seltext = 'Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'DOCTYPE' .
wa_fcat-coltext = 'Type' .
wa_fcat-seltext = 'Type' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'CH_FLAG' .
wa_fcat-coltext = 'Split' .
wa_fcat-seltext = 'Split' .
APPEND wa_fcat to p_lt_fieldcatalog .
endform. " set_fieldcatalog_rev_det
CREATE ALV
&----
*& Form create_alv_revenue_det
&----
text
----
-->P_GT_REVENUE_DET text
----
form create_alv_revenue_det using p_gt_revenue_det.
ALV related data declaration
DATA: lf_layout TYPE lvc_s_layo, "alv layout
lt_fieldcatalog type table of lvc_s_fcat, "field catalog internal table
wa_fieldcatalog type lvc_s_fcat. "work area for field catalog
create alv only if container is initial
IF G_CUSTOM_CONTAINER_REV_DET IS INITIAL.
lf_layout-no_toolbar = 'X'. " no toolbar
lf_layout-sel_mode = 'B'.
populate field catalog
perform set_fieldcatalog_rev_det using lt_fieldcatalog.
create instance of container class
CREATE OBJECT G_CUSTOM_CONTAINER_REV_DET
EXPORTING CONTAINER_NAME = G_CONTAINER_REV2.
create instance of alv grid class
CREATE OBJECT GR_ALVGRID_REV_DET
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_REV_DET.
call method to display table in alv grid by passing layout and fieldcatalog
CALL METHOD GR_ALVGRID_REV_DET->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = lf_layout
CHANGING
IT_OUTTAB = p_gt_revenue_det
IT_FIELDCATALOG = lt_fieldcatalog.
ENDIF.
endform. " create_alv_revenue_det
‎2007 Mar 01 10:24 AM
Hi,
Did you try:
wa_fcat-fieldname = 'GT_REVENUE_DET-CHK' .?
Because your internal table is GT_REVENUE.
Also make similar changes for all other fields and see.
Regards,
Ravi
‎2007 Mar 01 10:30 AM
the internal table being passed to the method is P_GT_REVENUE_DET.
‎2011 Feb 15 3:14 PM
Hi!
I had the same problem recently and managed to find a solution. Now I'll try to explain it to you and will try to remove that error from your life.
Lets analyze a fragment of your code. There is a part in your code, in which you prepare the field catalog like that:
data:wa_fcat type lvc_s_fcat.
wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date' .
wa_fcat-seltext = 'Posting Date' .
APPEND wa_fcat to p_lt_fieldcatalog .Now, you attempt to insert the first catalog as the one with a checkbox, isn't it? For this purpose, you set the fields CHECKBOX and EDIT as X. Although this seems quite simple and innocent, I am afraid this line may be causing some problems. Lets see why:
In the next part (until the next append) you did not set the CHECKBOX and EDIT fields as X because you don't want them to be checkbox fields. So you expect them not to be set as X right? But unfortunately this is not true. Because you did not clear the wa_fcat struct before the second append, it still marks as the second column as it is intended to be a checkbox field (this is because the value of CHECKBOX and EDIT fields did not change since the last assignment). So, the computer thinks that you want the second column (and all columns after it) to be a checkbox column too, but the field name you supplied is not compatible with it.
Possible solution is to put a clear statement after every append statement like:
.
.
.
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
" Put this statement after every append in the field cat adjustment
CLEAR wa_fcat.
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date'
.
.
.
This worked for me, I hope it becomes helpful for you too.