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

Field symbol problem

Former Member
0 Likes
868

Hi ,

Iam using field symbol in one program , the declaration is follows.

TYPES: BEGIN OF ly_fldtab,

fldval TYPE rsalc256,

END OF ly_fldtab.

FIELD-SYMBOLS <ls_fldtab> TYPE ly_fldtab.

FIELD-SYMBOLS <itab_comp> TYPE ANY.

FIELD-SYMBOLS <et_itab> TYPE ANY.

my problem is when iam assigning the value <ls_fldtab>-fldval to <itab_comp> its not assigning the total value

ex : <itab_comp> = september15, 2010

<itab_comp> = september15,201

can any one tell me how to declare <itab_comp>?.

Thanks in advane

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
838

Hi,

It works as is for me. Is it the code you have written or is it just an example?

TYPES: BEGIN OF ly_fldtab,

fldval TYPE rsalc256,

END OF ly_fldtab.

data : L_fldtab type ly_fldtab.

FIELD-SYMBOLS <ls_fldtab> TYPE ly_fldtab.

FIELD-SYMBOLS <itab_comp> TYPE ANY.

FIELD-SYMBOLS <et_itab> TYPE ANY.

l_fldtab = 'september15, 2010'.

assign l_fldtab TO <ls_fldtab>.

assign <ls_fldtab>-fldval TO <itab_comp>.

WRITE:/ <itab_comp>.

Output : september15, 2010

Sujay

6 REPLIES 6
Read only

Former Member
0 Likes
838

Hi

can you change the declaration of <itab_comp>.

FIELD-SYMBOLS <itab_comp> TYPE ly_fldtab.

regards,

Manju

Read only

Former Member
0 Likes
838

Hi,

Try to change the field symbol type to string.

Thanks,

Anmol.

Read only

Former Member
0 Likes
839

Hi,

It works as is for me. Is it the code you have written or is it just an example?

TYPES: BEGIN OF ly_fldtab,

fldval TYPE rsalc256,

END OF ly_fldtab.

data : L_fldtab type ly_fldtab.

FIELD-SYMBOLS <ls_fldtab> TYPE ly_fldtab.

FIELD-SYMBOLS <itab_comp> TYPE ANY.

FIELD-SYMBOLS <et_itab> TYPE ANY.

l_fldtab = 'september15, 2010'.

assign l_fldtab TO <ls_fldtab>.

assign <ls_fldtab>-fldval TO <itab_comp>.

WRITE:/ <itab_comp>.

Output : september15, 2010

Sujay

Read only

0 Likes
838

Hi ,

Here is my actual code

TYPES: BEGIN OF ly_fldtab,

fldval TYPE rsalc256,

END OF ly_fldtab.

FIELD-SYMBOLS <ls_fldtab> TYPE ly_fldtab.

FIELD-SYMBOLS <itab_comp> TYPE ANY.

FIELD-SYMBOLS <et_itab> TYPE ANY.

ASSIGN COMPONENT sy-tabix OF STRUCTURE cs_itab

TO <itab_comp>.

IF sy-subrc = 0.

<itab_comp> = <ls_fldtab>-fldval.

ENDIF.

when im assigning <ls_fldtab>-fldval. to <itab_comp> the toal value im not getting in <itab_comp> in the

debugging mode i found the values like <ls_fldtab>-fldval = " september 15,2010" But in the <itab_comp> = " september 15,201" this is the problem. Please suggest me how to declare <itab_comp> ?.

Thanks

Read only

0 Likes
838

Hi,

Check this code.

TYPES: BEGIN OF ly_fldtab,

fldval TYPE rsalc256,

END OF ly_fldtab.

FIELD-SYMBOLS <ls_fldtab> TYPE ly_fldtab.

data : cs_itab TYPE ly_fldtab.

FIELD-SYMBOLS <itab_comp> TYPE ANY.

FIELD-SYMBOLS <et_itab> TYPE ANY.

cs_itab-fldval = 'september 15,2010'.

ASSIGN cs_itab to <ls_fldtab>.

DO 1 TIMES.

ASSIGN COMPONENT sy-tabix OF STRUCTURE cs_itab

TO <itab_comp>.

IF sy-subrc = 0.

<itab_comp> = <ls_fldtab>-fldval.

ENDIF.

ENDDO.

WRITE:/ <itab_comp>.

I don't see any problem still.

Sujay

Read only

Former Member
0 Likes
838

Hi,

I think that you problem is at:

ASSIGN COMPONENT sy-tabix OF STRUCTURE cs_itab TO <itab_comp>.

...because cs_itab may have a component with length not equal to fldval (TYPE rsalc256).

<itab_comp> will assume the "properties" of an field of cs_itab.

Best regards,

Leandro Mengue