‎2006 Dec 08 6:36 AM
Hi,
I have one query regarding internal table.
my que is like
gs_itab-land1 = ls_lfa1-land1.
gs_itab-name1 = ls_lfa1-name1.
append gs_itab to gt_itab.
now i did some calculation & calculated TAXBS.
gs_itab-taxbs = lv_taxbs.
*now my req is to populate the taxbs in my internal table gt_itab.
*my ques is i have to first as append it to internal table then modify or i have to modify directly.
append gs_itab to gt_itab.
or
modify gt_itab from gs_itab transporting taxbs.
could u pls tell me which one is write approch.
‎2006 Dec 08 6:40 AM
hi,
Append statement will add another record at the last. it will not modify any records so use <b>modify statement</b>.
Use <b>append lines of</b> instead of normal append statement.
‎2006 Dec 08 6:45 AM
Hi salil,
1. Instead of using append and then modify,
use append once only, at the last.
2. In this sequence.
gs_itab-land1 = ls_lfa1-land1.
gs_itab-name1 = ls_lfa1-name1
now i did some calculation & calculated TAXBS.
gs_itab-taxbs = lv_taxbs.
append gs_itab to gt_itab
regards,
amit m.
‎2006 Dec 08 6:47 AM
if you are adding new record to anternal table use append only,
I think u r requirement is to modify one field of each record in an internal table.
to achive this use the Field-symbols. don't use modify, fielsd syibols are is better way.
FIELD-SYMBOLS: <FS_L_WA_itab> TYPE ty_itab.
loop at gs_itab assigning <fs_wa_itab>
<fs_wa_itab>-taxbs = lv_taxbs
endloop.
Regards
Naresh REddy
‎2006 Dec 08 6:56 AM
Hi Sahil ,
If this code which you have written is in a loop endloop. , then what i suggest is that you calculate all the values first and then append.
Regards
Arun
‎2006 Dec 08 7:02 AM
Hi Salil Singh ,
Use the modify statement
Regards ,
Dhera Kamlesh H. R.
‎2006 Dec 08 7:23 AM
‎2006 Dec 08 9:13 AM
Hi ,
U can do it in two fashions
first : u can use append statement at the last...which will just insert the record to ur table at last
second : u can use modify statement...
modify internal table from work area transporting fields where condition..
regards
Rajkumar.G
‎2006 Dec 08 9:19 AM
Hi Salil Singh,
The following is best approach as if your using standrad table.
<i>modify gt_itab from gs_itab transporting taxbs.</i>
Regards
Bhupal Reddy
‎2006 Dec 08 9:42 AM
Hello Salil,
<u>Case 1:</u>
By assuming you are appending the rows in the internal table inside the loop I'm giving my answer,
Better do what ever calculation you want and then append the waork area to internal table.
gs_itab-land1 = ls_lfa1-land1.
gs_itab-name1 = ls_lfa1-name1.
now i did some calculation & calculated TAXBS.
gs_itab-taxbs = lv_taxbs.
Now append
append gs_itab to gt_itab.
<u>Case 2:</u>
By assuming that you already appended the entries in to internal table my answer here as follows provided the modification operation should be inside the loop,
loop at gt_itab into gs_itab.
now i did some calculation & calculated TAXBS.
gs_itab-taxbs = lv_taxbs.
modify gt_itab from gs_itab transporting taxbs.
endloop.
Note: The keyword "Transporting" is very important. Otherwise u cant see the changes made to this field "TAXBS".
Hope u understood.
Regs,
Venkat Ramanan N
Message was edited by:
Venkat Ramanan Natarajan