Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Internal Table craetion sample code

Former Member
0 Likes
845

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

6 REPLIES 6
Read only

uwe_schieferstein
Active Contributor
0 Likes
807

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

Read only

0 Likes
807

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.

Read only

Former Member
0 Likes
807

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

Read only

Former Member
0 Likes
807

Hi,

see this fallowing link,

http://www.sap-img.com/ab030.htm

it will help you.

Regards,

Vijay.

Read only

Former Member
0 Likes
807

hi Deepthi,

check the link below,

Read only

Former Member
0 Likes
807

hi Deepthi,

check the link below,

[https://wiki.sdn.sap.com/wiki/display/Snippets/Creatingadynamicinternaltablebasedon+data]

Regards,

Sakthi.