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

Please chek my modify code.

former_member130219
Participant
0 Likes
789

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
Read only

Former Member
0 Likes
732

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
Read only

Former Member
0 Likes
732
**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

Read only

Former Member
0 Likes
732

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.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
732

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.

Read only

Former Member
0 Likes
733

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.

Read only

former_member130219
Participant
0 Likes
732

Thank you.