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

Dump during fileld symbol assignment.

Former Member
0 Likes
1,120

Hi,

Below is the piece of code which is causing a dump:

   MOVE : <fs_temp> TO <fs_work> .

Here <fs_temp> is an dynamically created field symbol it has a character type of 'C' and <fs_work> is a dynamically created field symbol of type 'P'.

<fs_temp> has a value '1,001.00' .

Now I want to move this value to <fs_work>, it gives a dump saying it can not recognize 1,001.00 as number. Bothe the filed symbols are dynamically assigned.

Is there any possible way to overcome this.

Regards,

Ravi Kasnale

Hi,

Below is the piece of code which is causing a dump:

   MOVE : <fs_temp> TO <fs_work> .

Here <fs_temp> is an dynamically created field symbol it has a character type of 'C' and <fs_work> is a dynamically created field symbol of type 'P'.

<fs_temp> has a value '1,001.00' .

Now I want to move this value to <fs_work>, it gives a dump saying it can not recognize 1,001.00 as number. Bothe the filed symbols are dynamically assigned.

Is there any possible way to overcome this.

Regards,

Ravi Kasnale

7 REPLIES 7
Read only

vigneshyeram
Active Participant
0 Likes
941

Dear Ravi,

Data type P will take decimal it will not identify comma.

Please do the string operations remove the comma then please try to move in <fs_work>.

Hope it helps you.

Please let me know your feedback.

Thanks & Regards,

Vignesh Yeram

Read only

Former Member
0 Likes
941

Hello Ravi,

Is it possible for you to remove the  dynamic assignment of  typing to the field symbols and  use the generic type of ANY, instead?.

For example:

         FIELD-SYMBOLS: <fs_temp>  TYPE any

                                        <fs_work>  TYPE any.

      

       {{{..then your code assigns values to <fs_temp> and then you can....}}}

        ASSIGN <fs_temp> TO <fs_work>.

If you can  use"TYPE ANY", you just need to be careful if you then move to a statically defined data type. 

You will need to ensure the data is compatible before the move. 

Regards,

Kim

Read only

0 Likes
941

Hi Kim,

No I can not use the 'Type Any' .

<fs_temp> will be always of CHAR type.

<fs_work> will be assigned dynamically with the properties of any ztable field.

In this case it got assigned as type P, so is there any way availabe to copy vallues from Char data type to any other type field symbol.

Regards,

Ravi Kasnale

Read only

0 Likes
941

Hi Ravi,

I looked for a solid coversion exit and method but I could not find one.

I suggest you try Nitin's suggestion.

Be sure to follow his suggestion about CATCHing potential system exceptions.

Before you move the value, you may also want to add a statment to check for characters.

For example:

lr_ref_desc = cl_abap_typedescr=>describe_by_data( p_data = <fs_work> ).

    CASE lr_ref_desc->type_kind.

      WHEN cl_abap_typedescr=>typekind_packed.

IF <fs_temp> CO ' 0123456789'.     "include a space in the string

  {{ ...then move value..}}}

ELSE.

  {{{ raise exception }}}

ENDIF.

   ENDCASE,

If you find a conversion method, please let us know.

Regards,

Kim

Read only

Former Member
0 Likes
941

Hi Ravi,

you are trying to move the value of character  format to pact value. so try to convert character format value to pat format and then move it.

Thanks.

Pavan.

Read only

Former Member
0 Likes
941

Hi Ravi,

As you are trying to convert a character value into type P , and since the

<fs_temp> has a value '1,001.00' , it is giving dump because it does not recognize the comma(,) in the value 1,001,00.

Try the following code:

replace all occurence of ',' from <fs_temp> with '.' .

<fs_work> = <fs_temp>.

Now, it would not give you any dump

To be on a safer side , you can also catch the exception:

try.

<fs_work> = <fs_temp>.

  CATCH cx_sy_conversion_no_number.

endtry.

Hope this helps,

Thanks,

Nitin

Read only

Former Member
0 Likes
941

Hi Ravi,

                 As Kim said

         FIELD-SYMBOLS: <fs_temp>  TYPE any

                                        <fs_work>  TYPE any.

      

         ASSIGN <fs_temp> TO <fs_work>. " Here the <fs_work> is of type <fs_temp>.

  <fs_work>  =   <fs_temp>.  "Value of fs_temp is moved to fs_work.

Regards,

Anand raj.S