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

how can i insert into dynamic table ?

Former Member
0 Likes
3,222

i have regular internal table with data .

i have dynamic table <dyn_tab>

i insert the data from itab

MOVE-CORRESPONDING ITAB TO <LS_LINE>.

INSERT <LS_LINE> INTO TABLE <DYN_TABLE>.

OK , NOW I WANT TO ADD THE DATA FROM OTHER TABLE

THAT HOLD THE DATA THAT ALL THE DYNAMIC TAB BUILD FOR

HOW CAN I DO THIS INSERT ?

I NEED TO INSERT "KOSTL" TO MATCH LINE in <DYN_TABLE>

THIS WHAT I TRIED TO DO :

SHIFT INDX1 LEFT DELETING LEADING SPACE.

CONCATENATE 'KOSTL' INDX1 INTO FIELD .

ASSIGN COMPONENT FIELD OF STRUCTURE <DYN_TABLE> TO <FS>.

<FS> = IT_EKKN-KOSTL.

but i get dump that <FS> not been assign .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,731

Hello,

Have a look at this link which will solve your problem

http://fr1041.de.bosch.com/saphelp46c/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/frameset.htm

Regards,

Balaji

4 REPLIES 4
Read only

Former Member
0 Likes
1,732

Hello,

Have a look at this link which will solve your problem

http://fr1041.de.bosch.com/saphelp46c/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/frameset.htm

Regards,

Balaji

Read only

0 Likes
1,731

The link does not work

Read only

Former Member
0 Likes
1,731

Check this....

searchsap.techtarget.com/tip/1,289483,sid21_gci783048,00.html

searchsap.techtarget.com/tip/0,289483,sid21_gci1163224,00.html

/people/community.user/blog/2006/11/08/calling-smartforms-dynamically-using-dynamic-function-parameters

sap.ittoolbox.com/code/archives.asp?i=10&d=3038&a=s

Read only

anversha_s
Active Contributor
0 Likes
1,731

hi,

pls chk the sample code below.

REPORT zmaschl_create_data_dynamic . 

TYPE-POOLS: slis. 

DATA: it_fcat TYPE slis_t_fieldcat_alv, 
is_fcat LIKE LINE OF it_fcat. 
DATA: it_fieldcat TYPE lvc_t_fcat, 
is_fieldcat LIKE LINE OF it_fieldcat. 
DATA: new_table TYPE REF TO data. 
DATA: new_line TYPE REF TO data. 
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE, 
<l_line> TYPE ANY, 
<l_field> TYPE ANY. 

* Build fieldcat 
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' 
EXPORTING 
i_structure_name = 'SYST' 
CHANGING 
ct_fieldcat = it_fcat[]. 
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial. 
MOVE-CORRESPONDING is_fcat TO is_fieldcat. 
is_fieldcat-fieldname = is_fcat-fieldname. 
is_fieldcat-ref_field = is_fcat-fieldname. 
is_fieldcat-ref_table = is_fcat-ref_tabname. 
APPEND is_fieldcat TO it_fieldcat. 
ENDLOOP. 

* Create a new Table 
CALL METHOD cl_alv_table_create=>create_dynamic_table 
EXPORTING 
it_fieldcatalog = it_fieldcat 
IMPORTING 
ep_table = new_table. 

* Create a new Line with the same structure of the table. 
ASSIGN new_table->* TO <l_table>. 
CREATE DATA new_line LIKE LINE OF <l_table>. 
ASSIGN new_line->* TO <l_line>. 

* Test it... 
DO 30 TIMES. 
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>. 
<l_field> = sy-index. 
INSERT <l_line> INTO TABLE <l_table>. 
ENDDO. 

LOOP AT <l_table> ASSIGNING <l_line>. 
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>. 
WRITE <l_field>. 
ENDLOOP.

Regards

Anver

<i>if hlped pls mark points</i>