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

Assign Component not Working

former_member220853
Participant
0 Likes
5,485

Dear All

Please help me. Points will be rewarded

I am having trouble assigning the value to field -symbol using ASSIGN Component syntax

I am using BRFPLus Function which contains a Structure names 'GRACBPROC' and this structure contains Fields 'BPROC'

On run time it is throwing Dump stating Field is not yet assigned

Code is follows

report  z_brfplus_test.

parameters: userid type if_fdt_types=>element_text.

data lv_counter type i value 1.

   types:

     begin of s_name_id_value,

            id    type if_fdt_types=>id,

            name  type abap_parmname,

            data_object_type type if_fdt_types=>data_object_type,

            value type ref to data,

            value_set type abap_bool,

          end of s_name_id_value .

   types:

     t_name_id_value type hashed table of s_name_id_value

                     with unique key name .

types : begin of ys_access_item,

    role_name type if_fdt_types=>element_text,

    system type if_fdt_types=>element_text,

    roleid type if_fdt_types=>element_text,

    roletype type if_fdt_types=>element_text,

   end of ys_access_item.

data: lo_fuction    type ref to if_fdt_function,

       lo_context    type ref to if_fdt_context,

       ls_value      type ys_access_item,

       lt_value   type table of ys_access_item,

       lt_name_value type t_name_id_value,

       ls_name_value like line of  lt_name_value,

       lv_result_string type string,

       lv_data type ref to data,

       lo_result     type ref to if_fdt_result.

data: lo_message    type ref to cx_fdt.

field-symbols  <la_data> type any .

field-symbols  <fs_any> type any .

data                lr_data type ref to data.

data: ls_role_name      type if_fdt_types=>element_text,

       ls_connname   type if_fdt_types=>element_text,

       rt_object type if_fdt_types=>ts_object_id.

constants lc_fct_id type if_fdt_types=>id value '3440B5B078B21ED497D7BAB0BF3DFD1E'.

start-of-selection.

data lv_value type string.

   try .

       " Get BRFplus function

       lo_fuction ?= cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function( lc_fct_id  ).

       " Set the BRFplus function context ( input variables )

       lo_context = lo_fuction->get_process_context( ).

       ls_name_value-name = 'GRACBPROC'.

       cl_fdt_function_process=>get_data_object_reference(

         exporting

           iv_function_id      =   lc_fct_id  " Function ID

           iv_data_object      =   ls_name_value-name  " Data object: Name or ID

         importing

           er_data             ls_name_value-value   " Reference to the data object ( no value )

       ).

*        catch cx_fdt_input.    "

      create data lr_data type s_name_id_value-value.

      assign lr_data->* to  <fs_any> .

      assign component 'BPROC' of structure <fs_any> to <la_data>.

      <la_data> ='AP00'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,531

  create data lr_data type s_name_id_value-value.

But S_name_id_value-value itself is a reference

so if you see in debug, you dont have a type for <FS_ANY>.

They'll be like this:

Hence your assign fails

6 REPLIES 6
Read only

Former Member
0 Likes
4,532

  create data lr_data type s_name_id_value-value.

But S_name_id_value-value itself is a reference

so if you see in debug, you dont have a type for <FS_ANY>.

They'll be like this:

Hence your assign fails

Read only

Former Member
0 Likes
4,531

Hi Gaurav,

Please check the s_name_id_value-value  have value, at least it need reference a object.

regards,

Archer

Read only

former_member220853
Participant
0 Likes
4,529

Dear All

Thanks for the help I awarded points

Syntax error is gone however the process method of cl_fdt_function is throwing error

"Parameter not found"

It works fine when I do simulation from Application

I am attaching my source code (in txt file)  and document containing attachment which explains the issue

Best Regards

Gaurav

Read only

0 Likes
4,529


Uploading the Files

Read only

0 Likes
4,526

Uploading remaining Files

Read only

former_member220853
Participant
0 Likes
4,526

Last set of files