2007 Oct 17 11:52 AM
Hi,
I'm using the method "cl_alv_table_create=>create_dynamic_table" to create the internal table, it works when the table is not bigger than 15 columns, if there are more columns then an error occurrs "Unable to interpret "ID1(000010)". Possible causes 9 ID1(000010)".
All columns are defined with type 'CHAR' and length 10.
Anybody can help me?
Thanks and regards.
hi Alejandro,
can you copy here your whole code?
thanks
ec
2007 Oct 17 12:06 PM
report zrich_0003
no standard page heading.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform build_dyn_itab.
perform build_report.
Write out your dynamic internal table - one field at a time.
<b> loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
write:/ <dyn_field>.
enddo.
endloop.</b>
************************************************************************
Build_dyn_itab
************************************************************************
form build_dyn_itab.
data: index(3) type c.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields
clear index.
do 5 times.
index = sy-index.
clear wa_it_fldcat.
concatenate 'Field' index into
wa_it_fldcat-fieldname .
condense wa_it_fldcat-fieldname no-gaps.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
Add a field that is TYPE P
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'FIELDP' .
wa_it_fldcat-datatype = 'CURR'.
wa_it_fldcat-intlen = 10.
append wa_it_fldcat to it_fldcat .
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
*********************************************************************
Form build_report
*********************************************************************
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
Create a record to add to table
do 5 times.
index = sy-index.
Set up fieldname
concatenate 'FIELD' index into
fieldname .
condense fieldname no-gaps.
Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.
enddo.
assign component 'FIELDP' of structure <dyn_wa> to <fs1>.
<fs1> = '1234.75'.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
2007 Oct 17 12:53 PM
Hi Vasu G,
I don't understand your response.
My problem occurred when I call method "cl_alv_table_create=>create_dynamic_table".
Thanks.
2007 Oct 17 1:00 PM
2007 Oct 17 1:14 PM
Of course, this is the code:
I_VALUES contain the name of the fields
DATA: l_new_table TYPE REF TO data,
l_new_line TYPE REF TO data,
lw_strc_table TYPE lvc_s_fcat,
li_strc_table TYPE lvc_t_fcat,
Assing fields to dynamic table
CLEAR wa_values.
LOOP AT i_values INTO wa_values.
CLEAR lw_strc_table.
lw_strc_table-fieldname = wa_values-low. " Nombre del campo
lw_strc_table-datatype = 'CHAR'. " Tipo
lw_strc_table-intlen = 10. " Longitud del campo
APPEND lw_strc_table TO li_strc_table .
ENDLOOP.
To Create dynamic table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = li_strc_table
IMPORTING
ep_table = l_new_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc NE 0.
EXIT.
ENDIF.
Se asigna la referencia al field symbol
ASSIGN l_new_table->* TO <fs_table>.
Se crea una workarea para trabajar con la tabla
CREATE DATA l_new_line LIKE LINE OF <fs_table>.
ASSIGN l_new_line->* TO <fs_w_table>.
Thanks.
2007 Oct 17 1:24 PM
the <b>whole</b> code pls. including the data declarations as wel, I want to do a test run in our system.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |