Application Development 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: 

Modify Statement

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

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

8 REPLIES 8

former_member223537
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

Hi Shejal,

field-symbols: <wa>.

loop at it_vbrk assigning <wa>.

<wa>-NETWR = total_netwr.

endloop.

It's better for performance.

Matteo