‎2006 Sep 22 4:15 PM
Hello friends,
I have internal table it_vbrk and has the field it_vbrk-netwr.
I have looped the table.
i want to change the value of netwr to another value.
can i write the logic as,
loop at it_vbrk.
IT_VBRK-NETWR = total_netwr.
modify it_vbrk.
endloop.
or is there any other way that would be better than this.
Shejal.
‎2006 Sep 22 4:18 PM
Hi,
Yes that is correct. But that will assign the same value(total_netwr) to all the records in IT_VBRK. Is tht your requirement ?
Best regards,
Prashant
‎2006 Sep 22 4:18 PM
Hi,
Yes that is correct. But that will assign the same value(total_netwr) to all the records in IT_VBRK. Is tht your requirement ?
Best regards,
Prashant
‎2006 Sep 22 4:19 PM
HI Shejal,
try this..
loop at it_vbrk where ( some condition).
IT_VBRK-NETWR = total_netwr.
modify it_vbrk transporting netwr.
endloop.
other wise it will modify the it_vbrk-netwr with same value.
or
loop at it_vbrk.
IT_VBRK-NETWR = total_netwr.
modify it_vbrk transporting netwr where ( condition ).
endloop.
so then it modifies the required records.
regards
Message was edited by: srinu k
‎2006 Sep 22 4:19 PM
U can also do like this.
loop at it_vbrk into wa_vbrk.
wa_VBRK-NETWR = total_netwr.
modify it_vbrk from wa_vbrk transporting netwr.
endloop.
Regards,
Prakash.
‎2006 Sep 22 4:20 PM
Hi Shejal,
what ever u r doign in correct.
and use transporting for which are the values u r changing this will change only those values which u r changing.
-Anu
‎2006 Sep 22 4:21 PM
Hi,
This is okie till the time you are changing all the netwr ( for all records ) to same value.
in brief what you have written is right.
It will modify the value of that row which is currently being accessed
Another way is using field-symbols
you do
field-symbols : <fs> type it_vbrk.
loop at it_vbrk assigning <fs>.
<fs>-netwr = total_netwr.
Endloop.
this wil directly assign the value and change the value for the row being accessed.
Regards
Nishant
‎2006 Sep 22 4:21 PM
Hi,
If all the records in the internal table it_vbrk-netwr will have the same value. Then you can use one modify statement.
IT_VBRK-NETWR = TOTAL_NETWR.
MODIFY IT_VBRK TRANSPORTING NETWR
WHERE NETWR IS INITIAL
OR NOT NETWR IS INITIAL.
If each row is going to have different values then you have do loop at..as you did..
THanks
Naren
‎2006 Sep 22 4:23 PM
Thanks friends,
I am not using the total-netwr for all the records however i am changing in the loop. But i didnt paste it because that was too big.
Thanks again,
Shejal.
‎2006 Sep 22 4:23 PM
Hi Shejal,
field-symbols: <wa>.
loop at it_vbrk assigning <wa>.
<wa>-NETWR = total_netwr.
endloop.
It's better for performance.
Matteo