‎2007 Apr 17 4:30 AM
Hi ,
1. How to modify an internal table without using modify statement ?
2. How we can create a dynamoic data reference ?
Kumar
‎2007 Apr 17 4:46 AM
Kumar,
2.
Creating Data Objects Dynamically
All of the data objects that you define in the declaration part of a program using statements such as DATA are created statically, and already exist when you start the program. To create a data object dynamically during a program, you need a data reference variable and the following statement:
CREATE DATA <dref> TYPE <type>|LIKE <obj>.
This statement creates a data object in the internal session of the current ABAP program. After the statement, the data reference in the data reference variable <dref> points to the object. The data object that you create does not have its own name. You can only address it using a data reference variable. To access the contents of the data object, you must dereference the data reference.
You must specify the data type of the object using the TYPE or LIKE addition. In the TYPE addition, you can specify the data type dynamically as the contents of a field (this is not possible with other uses of TYPE).
CREATE DATA <dref> TYPE (<name>).
Here, <name> is the name of a field that contains the name of the required data type.
1. IF you want to change the values without modify:
First take that row into other work area change whatever values you want to change in work area by using "MOVE" statement ,delete previous row from internal table and by using "INSERT" statement insert the workarea row into that internal table..
Don't forget to reward if useful...
‎2007 Apr 17 4:46 AM
Kumar,
2.
Creating Data Objects Dynamically
All of the data objects that you define in the declaration part of a program using statements such as DATA are created statically, and already exist when you start the program. To create a data object dynamically during a program, you need a data reference variable and the following statement:
CREATE DATA <dref> TYPE <type>|LIKE <obj>.
This statement creates a data object in the internal session of the current ABAP program. After the statement, the data reference in the data reference variable <dref> points to the object. The data object that you create does not have its own name. You can only address it using a data reference variable. To access the contents of the data object, you must dereference the data reference.
You must specify the data type of the object using the TYPE or LIKE addition. In the TYPE addition, you can specify the data type dynamically as the contents of a field (this is not possible with other uses of TYPE).
CREATE DATA <dref> TYPE (<name>).
Here, <name> is the name of a field that contains the name of the required data type.
1. IF you want to change the values without modify:
First take that row into other work area change whatever values you want to change in work area by using "MOVE" statement ,delete previous row from internal table and by using "INSERT" statement insert the workarea row into that internal table..
Don't forget to reward if useful...
‎2007 Apr 17 4:52 AM
1. Using field-symbols one can modify an internal tale.
ex:
loop at itab assigning <wa>.
etc...
endloop.
2.Have a look at the link ;
‎2007 Apr 17 4:55 AM
Hi ,
Can i use field symbols to modify the data without using modify keyword ? Can anyone give coding from the start ?
‎2007 Apr 17 4:56 AM
‎2007 Apr 17 5:01 AM
Ex Code:
FIELD-SYMBOLS:
<wa> TYPE any.
LOOP AT itab assigning <wa>.
<wa>-fld1 = x.
---
etc..
endloop.
Changes done to <wa> will be automaitcally reflected to itab.
‎2007 Apr 17 5:11 AM
Use field symbols:
FIELD-SYMBOLS : <fs_name> TYPE structure-name.
loop at itab assigning <fs_name>.
any change made to fs_name will update the internal table
‎2007 Apr 17 5:36 AM
Hi,
try this code....
1) for doing modification for ur internal table..
<b>FIELD-SYMBOLS: <WA> TYPE ANY.
LOOP AT ITAB ASSIGNING <WA>.
<WA>-FIELD1 = X.
ENDLOOP.</b>
2) dynamic reefrence can be done by using the OOP concepts
<b>data : obj1 type ref to <class_name>.
create object obj1 .</b>
hope this is useful to u...
reward points if helpful...
Ginni..