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: 

Assignment of Refrence to a FieldSymbol

Former Member
0 Kudos

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?

6 REPLIES 6

Former Member
0 Kudos

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

Former Member
0 Kudos

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

vinod_gunaware2
Active Contributor
0 Kudos
  • 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

0 Kudos

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.

0 Kudos

for that you have to use

assign (vbak-vbeln)to <fs>.

Regards,

Suresh Datti

0 Kudos

Did you try my solution? that will work.

Regards,

Ravi