‎2009 Aug 18 8:06 AM
Hi ,
I need to create a dynamic internal table which should hold fields from 4 data base tables( AUFK, AFKO, AFPO, MAKT) . Can anyone provide a sample code for this?
For all entries is not working with Field Symbols while trying to join these tables.
Regards,
Deepthi
Edited by: Deepthi Gopinath on Aug 18, 2009 9:17 AM
‎2009 Aug 18 8:18 AM
Hello Deepthi
Have you had already a look at my Wiki posting
[Creating Flat and Complex Internal Tables Dynamically using RTTI|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI] ?
However, you can apply this solution only if are already on SAP release >= 6.20.
Regards
Uwe
‎2009 Aug 19 12:30 PM
Hi ,
Thanks for your replies.
I am now able to create the dynamic internal table. But now the requirement is to have the output in the following manner.
HEADER
AUFK-WERKS,
AFKO-AUFNR
BOMCOMPONENT
MAKT-MAKTX, component1
RESB-POSNR, 0010
'HEADER' and "BOMCOMPONENT' should be hard coded.
Please help in this regard.
‎2009 Aug 18 8:21 AM
Hi,
Dynamic internal table is used when the number of fields is not known at the design time or until the compile time.
one example is :
PARAMETERS : p_table(10) TYPE C.
DATA: w_tabname TYPE w_tabname,
w_dref TYPE REF TO data,
w_grid TYPE REF TO cl_gui_alv_grid.
FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
w_tabname = p_table.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
SELECT *
FROM (w_tabname) UP TO 20 ROWS
INTO TABLE <t_itab>.
CREATE OBJECT w_grid
EXPORTING i_parent = cl_gui_container=>screen0.
CALL METHOD w_grid->set_table_for_first_display
EXPORTING
i_structure_name = w_tabname
CHANGING
it_outtab = <t_itab>.
CALL SCREEN 100.
Regards,
Sham
‎2009 Aug 18 8:37 AM
‎2009 Aug 19 8:33 AM
‎2009 Aug 19 8:33 AM
hi Deepthi,
check the link below,
[https://wiki.sdn.sap.com/wiki/display/Snippets/Creatingadynamicinternaltablebasedon+data]
Regards,
Sakthi.