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: 

Field-Symbols Dump

Former Member
0 Kudos

Hi,

I have values in a field-symbol which is of type CHAR1024. Now i have to move this values into a workarea of a strucutre which have few CHAR, NUMC, QUAN data types. when i am assining this< FS1> to <FS2> it is dumping saying type mismatch.

What is the best solvable way for this type of mismatch. I am using ECC6.0.

Can some one help?

7 REPLIES 7

Former Member
0 Kudos

convert your non-character fields (not C, not N) to C's first...

0 Kudos

check this sample program:

REPORT zv_program2.

TYPES: BEGIN OF t_type1,

data1(20) TYPE c,

data2(10) TYPE c,

data3 TYPE i,

END OF t_type1.

FIELD-SYMBOLS: <fs_abc1> TYPE char1024.

DATA: lv_data TYPE char1024,

lk_data TYPE t_type1.

START-OF-SELECTION.

lv_data = 'aaaaaaaaaaaaaaaammmm12mmmmm1221392'.

ASSIGN lv_data TO <fs_abc1>.

  • Assigning value directly to the components on the basis of their sizes

lk_data-data1 = <fs_abc1>+0(20).

lk_data-data2 = <fs_abc1>+20(10).

lk_data-data3 = <fs_abc1>+30(4)." size of int is 4 by default

Former Member
0 Kudos

Use the ASSIGN ... CASTING option.

former_member191735
Active Contributor
0 Kudos

If you specify Assign <Fs1> to <fs2> then it is a type mismatch as the first one is different type than the second one.

use

<Fs2>-fld1 = <fs1>+0(10) as some one already suggested.

Clemenss
Active Contributor
0 Kudos

Hi pavan,

it depends much on the type of your field-symbol. You can assign anything to a TYPE ANY field-symbol. If you

ASSIGN <FS1> to <FS2>

it will always dump if FS1 is not assigned to any data.

You can always use the try..catch clause to make sure the target structure is compatible, i.e.

TRY.
  ASSIGN your_data_structure_or_field_symbol TO <FS_ANY>.
CATCH CX_ROOT.
* Assignment failed, do what is required
ENDTRY.

Regards,

Clemens

Former Member
0 Kudos

Hello Pavan,

I believe the only way to do this is by substring operation of your CHAR1024 field symbol unless that field symbol has field sperators like tab,comma etc. In that case you use SPLIT <FS1> into <FS2>-field1 <FS2>-field2... at "#".

If you do not have a field seperator, then use the following code as reference,

PARAMETERS : p1 type char1024.

types: begin of typ1,

fld1(10) type c,

dat1 type sy-datum,

num1 type n,

end of typ1.

data : lt_stru1 type table of typ1,

lw_stru1 type typ1.

FIELD-SYMBOLS : <f1> type char1024,

<lit_f2> type STANDARD TABLE,

<lwa_f2> type typ1.

Assign p1 to <f1>.

assign lt_stru1 to <lit_f2>.

assign lw_stru1 to <lwa_f2>.

<lwa_f2>-fld1 = <f1>+0(10).

<lwa_f2>-dat1 = <f1>+10(08).

<lwa_f2>-num1 = <f1>+18(01).

APPEND <lwa_f2> to <lit_f2>.

Former Member
0 Kudos

Hi Frends..thansk for the input. I just resolvd the issue. Here i just need to add CASTING in the statement and SAP takes care of rest.

READ TABLE <fs_t_total_rtr> ASSIGNING <fs_wa_total_rtr> CASTING

INDEX sy-tabix.

Regards,

Pavan.