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: 

Please chek my modify code.

former_member130219
Participant
0 Kudos

Hi all

My code for modifying the rows in my internal table is not working.

**MODIFY STATEMENT

*wa_scarr-carrid = 'RG1'.

*wa_scarr-carrname = 'RG Airlines1'.

*loop at it_scarr into wa_scarr.

*wa_scarr-currcode = 'USD'.

*modify it_scarr index 3 from wa_scarr transporting currcode.

*endloop.

*loop at it_scarr into wa_scarr.

  • write: / wa_scarr-carrid,

  • wa_scarr-carrname,

  • wa_scarr-currcode.

*endloop.

Please help.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If you want to modify only the third record then use

wa_scarr-currcode = 'USD'.

modify it_scarr index 3 from wa_scarr transporting currcode.

clear wa_scarr.

otherwise use

wa_scarr-currcode = 'USD'.

modify it_scarr wa_scarr transporting currcode.

5 REPLIES 5

Former Member
0 Kudos
**MODIFY STATEMENT
*wa_scarr-carrid = 'RG1'.
*wa_scarr-carrname = 'RG Airlines1'.
*wa_scarr-currcode = 'USD'.
*modify it_scarr index 3 from wa_scarr transporting currcode. " If  modifying 3rd record no loop is required
*loop at it_scarr into wa_scarr.
* write: / wa_scarr-carrid,
* wa_scarr-carrname,
* wa_scarr-currcode.
*endloop.

If you want to modify all the records use:

**MODIFY STATEMENT
*wa_scarr-carrid = 'RG1'.
*wa_scarr-carrname = 'RG Airlines1'.
*loop at it_scarr into wa_scarr.
*wa_scarr-currcode = 'USD'.
*modify table it_scarr from wa_scarr transporting currcode. 
*endloop.
*loop at it_scarr into wa_scarr.
* write: / wa_scarr-carrid,
* wa_scarr-carrname,
* wa_scarr-currcode.
*endloop.

Regards,

Gurpreet

Former Member
0 Kudos

Hi .

Do u want to modify only currcode field in table?

If yes then just remove index keyword from ur code of modify line.

Also u dont want print

wa_scarr-carrid = 'RG1'.

wa_scarr-carrname = 'RG Airlines1'. fields thiese values?

If u want to print then first append it to it_scarr.(before first loop statement )

TRy it, revert if clarification needed.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

wa_scarr-currcode = 'USD'.

modify it_scarr index 3 from wa_scarr transporting currcode.

This will modify only the specified row.

For modfiying all the records,

modify it_scarr from wa_scarr transporting currcode.

Former Member
0 Kudos

Hi,

If you want to modify only the third record then use

wa_scarr-currcode = 'USD'.

modify it_scarr index 3 from wa_scarr transporting currcode.

clear wa_scarr.

otherwise use

wa_scarr-currcode = 'USD'.

modify it_scarr wa_scarr transporting currcode.

former_member130219
Participant
0 Kudos

Thank you.