‎2008 Jul 19 5:31 PM
Hi all,
I have problem to display data in this code, please correct me.
REPORT zbtest.
TYPE-POOLS: slis.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>.
DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
it_fldcat TYPE lvc_t_fcat.
DATA: it_kna1 TYPE TABLE OF kna1 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_kunnr FOR it_kna1-kunnr.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
SELECT * INTO TABLE it_kna1 FROM kna1
WHERE kunnr IN s_kunnr.
PERFORM 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.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = 'PERIOD' .
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 6.
APPEND wa_it_fldcat TO it_fldcat .
LOOP AT it_kna1.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = it_kna1-kunnr .
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 4.
APPEND wa_it_fldcat TO it_fldcat .
ENDLOOP.
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. "
‎2008 Jul 19 7:47 PM
> Hi all,
> I have problem to display data in this code, please correct me.
> "
Nick can you give more details about your issue. where is your display part of the code?
a®
‎2008 Jul 19 10:10 PM
it should be ALV display.
ASSIGN new_table->* TO <dyn_table>. not working corect, but why I dont know.
Edited by: Nick Thedick on Jul 19, 2008 11:11 PM
‎2008 Jul 20 12:42 AM
Hi,
As per your code, you have data in IT_KNA1 internal table.
Why, do you want to create another dynamic internal table?????
Use REUSE_ALV_GRID_DISPLAY func.module to display the contents in IT_KNA1.
Use LVC_FIELDCATALOG_MERGE and use the structure KNA1 for build the fieldcatalog.
Regards,
Subramanian