05-07-2009 9:35 AM
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.
05-07-2009 12:00 PM
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.
05-07-2009 9:47 AM
**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
05-07-2009 9:57 AM
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.
05-07-2009 9:57 AM
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.
05-07-2009 12:00 PM
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.
06-04-2009 1:13 PM