‎2007 Apr 17 9:54 AM
I need to modify a dynamic internal table, but i don't know how.
I've already built the table, but how can i access to the fields???
loop at <gt_table> assigning <wa_table>.
endloop.
‎2007 Apr 17 10:15 AM
Hi ..
I do not know how you have created the dynamic internal tables...
but just for your reference ... I am giving u a piece of code ... Its quiet simple ..
Say.. You want to change the 3rd column of the table. So to read the 3rd column, I write the statement : ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs_val>.
Then on it is simple since I am using the Field symbols.
Just see in debugging mode and you will understand everything.
FIELD-SYMBOLS : <fs_table> TYPE ANY TABLE,
<fs_wa> TYPE ANY,
<fs_val> TYPE ANY.
LOOP AT <fs_table> ASSIGNING <fs_wa>.
ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs_val>.
<fs_val> = 'Test Change'.
MODIFY TABLE <fs_table> FROM <fs_wa>.
BREAK-POINT.
ENDLOOP.
Feel free to contact in case it is not clear .. I can give u another example ..
Plz reward points if this was helpful ..
‎2007 Apr 17 9:57 AM
HI jose,
Just click on the below link.........
" http://www.saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm "
Here you can see the complete details of HOW TO CREATE DYANMIC INTERNAL TABLE. It is Crystal Clear.By analysing this code you get idea of solving your problem
on your own.
Hope you can understand it easily.
Reward all helpful answers.
Regards,
V.Raghavender.
‎2007 Apr 17 9:58 AM
chk this
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = new_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN new_table->* TO <it_final>.
*********CREATE WORK AREA****************************
CREATE DATA new_line LIKE LINE OF <it_final>.
ASSIGN new_line->* TO <wa_final>.
*********INSERTTING WORK AREAR TO INTERNAL TABLE******
INSERT <wa_final> INTO TABLE <it_final>.
*******POPULATING DATA*******************************
LOOP.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_final> TO <w_field>.
<w_field> = '12345'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_final> TO <w_field>.
<w_field> = '21453DD'.
FIELD1 AND FIELD2 ARE COMPONENTS OF FIELDCATALOG.
ENDLOOP.
‎2007 Apr 17 9:58 AM
field-symbols: <l_field> type any .
loop at <gt_table> assigning <wa_table>.
assign component 'FIELDNAME' of structure <wa_table> to <l_field>.
if <l_field> is assigned .
<l_field> = 'some value' .
endif .
endloop.
Raja
‎2007 Apr 17 10:05 AM
‎2007 Apr 17 10:15 AM
Hi ..
I do not know how you have created the dynamic internal tables...
but just for your reference ... I am giving u a piece of code ... Its quiet simple ..
Say.. You want to change the 3rd column of the table. So to read the 3rd column, I write the statement : ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs_val>.
Then on it is simple since I am using the Field symbols.
Just see in debugging mode and you will understand everything.
FIELD-SYMBOLS : <fs_table> TYPE ANY TABLE,
<fs_wa> TYPE ANY,
<fs_val> TYPE ANY.
LOOP AT <fs_table> ASSIGNING <fs_wa>.
ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs_val>.
<fs_val> = 'Test Change'.
MODIFY TABLE <fs_table> FROM <fs_wa>.
BREAK-POINT.
ENDLOOP.
Feel free to contact in case it is not clear .. I can give u another example ..
Plz reward points if this was helpful ..