06-12-2006 11:58 AM
Hi Folks
I need to retrieve the field's value in one table which is as value in another table.
Table x has field a with value b.
Table y has field with b and I need to update b with the help of table x.
using dynamic field symbols would help?
06-12-2006 12:03 PM
Hi,
Do like this.
<u>PSEUDO CODE</u>
read table t_x with key field1 = 'X' .
loop at y assigning <l_y>.
if <l_y>-field = 'X' .
<l_oem>-field = x-field.
endif.
endloop.
Regards,
Raghav
06-12-2006 12:04 PM
Hi,
Yes you can do using the field symbols.
loop at x.
loop at y into wa_y.
assign (x-a) of structure wa_y to <fs_any>.
<fs_any> = 'XXX'
This statement will update field b in y.
endloop.
endloop.
You can either user loop at y or a READ statement.
Regards,
Ravi
06-12-2006 12:23 PM
Defining a Field Symbol
FIELD-SYMBOLS <FS>.
Variable for later use
DATA FIELD VALUE 'X'.
Assigning a field to a Field Symbol
ASSIGN FIELD TO <FS>.
Using a Field Symbol which has an assigned field
WRITE <FS>.
Table work area for later use
TABLES CUSTOMERS.
Defining a Field Symbol
FIELD-SYMBOLS <OUTPUT>.
Displaying all fields of all table entries
SELECT * FROM CUSTOMERS.
NEW-LINE.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE CUSTOMERS TO <OUTPUT>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE <OUTPUT>.
ENDDO.
ENDSELECT.
regards
vinod
06-12-2006 1:47 PM
Hi Vinod
Thanks for your solution, but here my case is, I am need to retrive few values from a table, according that one
I need to take a table field into a variable, now the variable contains the table field name.
Now I need to assing the variable value, it means the table field value into that one.
Below I am giving the example to you.
Select * from vbak.
var = vbak-vbeln.
<FS1>- Field symbol
Now the contains vbak-vbeln. Actually here I need to assing the value of vbak-vbeln to Field Symbol.
vbak-vbeln = '100000', now I need to see the value of field symbol as '100000' not vbak-vbeln which contains the var, after assiging the var to field symbol.
Please can you help me out.
06-12-2006 2:03 PM
for that you have to use
assign (vbak-vbeln)to <fs>.
Regards,
Suresh Datti
06-12-2006 4:00 PM