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

modify itab

Former Member
0 Likes
874

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.

9 REPLIES 9
Read only

Former Member
0 Likes
818

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.

Read only

Former Member
0 Likes
818

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.

Read only

Former Member
0 Likes
818

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

Read only

Former Member
0 Likes
818

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

Read only

Former Member
0 Likes
818

Hi Salil Singh ,

Use the modify statement

Regards ,

Dhera Kamlesh H. R.

Read only

Former Member
0 Likes
818

hi

just check this if u can fix ur logic .

regards,

vijay

regards,

vijay

Read only

Former Member
0 Likes
818

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

Read only

Former Member
0 Likes
818

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

Read only

Former Member
0 Likes
818

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