‎2008 Dec 04 6:54 AM
Dear All,
I want to modify the dynamic table content .
i.e. I have a Date value in the dyn. int. table and I want to modify it to the Year value.
fied-symbol : <fs_year> TYPE ANY.
DATA: lv_string TYPE char20,
lv_year TYPE char04.
LOOP AT <fs_t_son> ASSIGNING <wa_son>.
* Get the Field and Value for the Date/Year
ASSIGN COMPONENT 'BUDAT' OF STRUCTURE <wa_son> TO <fs_year>.
IF sy-subrc = 0.
CLEAR lv_string.
MOVE <fs_year> TO lv_string.
CLEAR lv_year.
lv_year = lv_string.
<fs_year> = lv_year.
" How to modify my dyn. int. table with this value of <fs_year> now ????
ENDIF. " if sy-subrc = 0. "Assign
endloop.
Any clues ???
Regards,
Deepu.K
‎2008 Dec 04 7:17 AM
When using FIELD-SYMBOLS assignation during a LOOP, there is no need to MODIFY the internal table, you only need MODIFY when using work area. (Look at [Access Methods to Individual Table Entries|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fc/eb3612358411d1829f0000e829fbfe/frameset.htm])
I suppose you have a BUDAT and a YEAR field in structure, so
LOOP AT <fs_t_son> ASSIGNING <wa_son>.
ASSIGN COMPONENT 'BUDAT' OF STRUCTURE <wa_son> TO <fs_date>.
CHECK sy-subrc EQ 0.
ASSIGN COMPONENT 'GJAHR' OF STRUCTURE <wa_son> TO <fs_year>.
CHECK sy-subrc EQ 0.
<fs_year> = <fs_date>+0(4).
ENDLOOP..
Regards
‎2008 Dec 04 7:17 AM
When using FIELD-SYMBOLS assignation during a LOOP, there is no need to MODIFY the internal table, you only need MODIFY when using work area. (Look at [Access Methods to Individual Table Entries|http://help.sap.com/erp2005_ehp_04/helpdata/EN/fc/eb3612358411d1829f0000e829fbfe/frameset.htm])
I suppose you have a BUDAT and a YEAR field in structure, so
LOOP AT <fs_t_son> ASSIGNING <wa_son>.
ASSIGN COMPONENT 'BUDAT' OF STRUCTURE <wa_son> TO <fs_date>.
CHECK sy-subrc EQ 0.
ASSIGN COMPONENT 'GJAHR' OF STRUCTURE <wa_son> TO <fs_year>.
CHECK sy-subrc EQ 0.
<fs_year> = <fs_date>+0(4).
ENDLOOP..
Regards
‎2008 Dec 04 7:25 AM
HI
to modify ur table we dont need structure assignment. Do it like this:
fied-symbol : <fs_year> TYPE ANY.
DATA: lv_year TYPE char04.
LOOP AT <fs_t_son> ASSIGNING <wa_son>.
<wa_son>-year = lv_year.
endloop.
In your case by just assigning the desired value to work area will modify the internal table dynamically.
no need to use explicit data movement or modify statement.
Thanks
Vishal Kapoor
‎2008 Dec 04 7:30 AM
Hi,
You have assigned field-symbols <wa_son> to line of <fs_t_son>
<fs_year> is pointing to BUDAT component of <wa_son>,
Hence any changes made to <f_year> will directly get changed in <wa_son> and hence your internal table. [As you are using field-symbols in both assignments].
Although, I am not able to understand functionality of this portion of your code -
CLEAR lv_string.
MOVE <fs_year> TO lv_string.
CLEAR lv_year.
lv_year = lv_string.
<fs_year> = lv_year.Regards,
Mohaiyuddin